Merge "Use Cinder API V2 if V1 is disabled"
diff --git a/HACKING.rst b/HACKING.rst
index 45c35df..e15e213 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -15,6 +15,8 @@
- [T106] vim configuration should not be kept in source files.
- [T107] Check that a service tag isn't in the module path
- [T108] Check no hyphen at the end of rand_name() argument
+- [T109] Cannot use testtools.skip decorator; instead use
+ decorators.skip_because from tempest-lib
- [N322] Method's default argument shouldn't be mutable
Test Data/Configuration
@@ -72,11 +74,10 @@
Most other assert method can include more information by default.
For example ``self.assertIn`` can include the whole set.
-It is recommended to use testtools matcher for the more tricky assertions.
-`[doc] <http://testtools.readthedocs.org/en/latest/for-test-authors.html#matchers>`_
+It is recommended to use testtools `matcher`_ for the more tricky assertions.
+You can implement your own specific `matcher`_ as well.
-You can implement your own specific matcher as well.
-`[doc] <http://testtools.readthedocs.org/en/latest/for-test-authors.html#writing-your-own-matchers>`_
+.. _matcher: http://testtools.readthedocs.org/en/latest/for-test-authors.html#matchers
If the test case fails you can see the related logs and the information
carried by the exception (exception class, backtrack and exception info).
@@ -158,8 +159,8 @@
sections for the test (one of those is mandatory):
- A resource (part of the URL of the request): Resources needed for a test
- must be created in `setUpClass` and registered with `set_resource` e.g.:
- `cls.set_resource("server", server['id'])`
+ must be created in `setUpClass` and registered with `set_resource` e.g.:
+ `cls.set_resource("server", server['id'])`
- A json schema: defines properties for a request.
@@ -275,7 +276,7 @@
Test Documentation
------------------
For tests being added we need to require inline documentation in the form of
-docstings to explain what is being tested. In API tests for a new API a class
+docstrings to explain what is being tested. In API tests for a new API a class
level docstring should be added to an API reference doc. If one doesn't exist
a TODO comment should be put indicating that the reference needs to be added.
For individual API test cases a method level docstring should be used to
@@ -319,7 +320,7 @@
Every function that provides a test must have an ``idempotent_id`` decorator
that is a unique ``uuid-4`` instance. This ID is used to complement the fully
-qualified test name and track test funcionality through refactoring. The
+qualified test name and track test functionality through refactoring. The
format of the metadata looks like::
@test.idempotent_id('585e934c-448e-43c4-acbf-d06a9b899997')
diff --git a/README.rst b/README.rst
index d7063ba..7108eaf 100644
--- a/README.rst
+++ b/README.rst
@@ -32,67 +32,73 @@
parts as load generation for an OpenStack cloud.
- Tempest should attempt to clean up after itself, whenever possible
we should tear down resources when done.
-- Tempest should be self testing.
+- Tempest should be self-testing.
Quickstart
----------
-To run Tempest, you first need to create a configuration file that
-will tell Tempest where to find the various OpenStack services and
-other testing behavior switches.
+To run Tempest, you first need to create a configuration file that will tell
+Tempest where to find the various OpenStack services and other testing behavior
+switches. Where the configuration file lives and how you interact with it
+depends on how you'll be running Tempest. There are 2 methods of using Tempest.
+The first, which is a newer and recommended workflow treats Tempest as a system
+installed program. The second older method is to run Tempest assuming your
+working dir is the actually Tempest source repo, and there are a number of
+assumptions related to that. For this section we'll only cover the newer method
+as it is simpler, and quicker to work with.
-The easiest way to create a configuration file is to copy the sample
-one in the ``etc/`` directory ::
+#. You first need to install Tempest this is done with pip, after you check out
+ the Tempest repo you simply run something like::
- $> cd $TEMPEST_ROOT_DIR
- $> cp etc/tempest.conf.sample etc/tempest.conf
+ $ pip install tempest
-After that, open up the ``etc/tempest.conf`` file and edit the
-configuration variables to match valid data in your environment.
-This includes your Keystone endpoint, a valid user and credentials,
-and reference data to be used in testing.
+ This can be done within a venv, but the assumption for this guide is that
+ the Tempest cli entry point will be in your shell's PATH.
-.. note::
+#. Installing Tempest will create a /etc/tempest dir which will contain the
+ sample config file packaged with Tempest. The contents of /etc/tempest will
+ be copied to all local working dirs, so if there is any common configuration
+ you'd like to be shared between anyone setting up local Tempest working dirs
+ it's recommended that you copy or rename tempest.conf.sample to tempest.conf
+ and make those changes to that file in /etc/tempest
- If you have a running devstack environment, Tempest will be
- automatically configured and placed in ``/opt/stack/tempest``. It
- will have a configuration file already set up to work with your
- devstack installation.
+#. Setup a local working Tempest dir. This is done using the tempest init
+ command::
-Tempest is not tied to any single test runner, but `testr`_ is the most commonly
-used tool. Also, the nosetests test runner is **not** recommended to run Tempest.
+ tempest init cloud-01
-After setting up your configuration file, you can execute the set of Tempest
-tests by using ``testr`` ::
+ works the same as::
- $> testr run --parallel
+ mkdir cloud-01 && cd cloud-01 && tempest init
-.. _testr: http://testrepository.readthedocs.org/en/latest/MANUAL.html
+ This will create a new directory for running a single Tempest configuration.
+ If you'd like to run Tempest against multiple OpenStack deployments the idea
+ is that you'll create a new working directory for each to maintain separate
+ configuration files and local artifact storage for each.
-To run one single test serially ::
+#. Then cd into the newly created working dir and also modify the local
+ config files located in the etc/ subdir created by the ``tempest init``
+ command. Tempest is expecting a tempest.conf file in etc/ so if only a
+ sample exists you must rename or copy it to tempest.conf before making
+ any changes to it otherwise Tempest will not know how to load it.
- $> testr run tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_reboot_non_existent_server
+#. Once the configuration is done you're now ready to run Tempest. This can
+ be done with testr directly or any `testr`_ based test runner, like
+ `ostestr`_. For example, from the working dir running::
-Alternatively, you can use the run_tempest.sh script which will create a venv
-and run the tests or use tox to do the same. Tox also contains several existing
-job configurations. For example::
+ $ ostestr --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|thirdparty))'
- $> tox -efull
+ will run the same set of tests as the default gate jobs.
-which will run the same set of tests as the OpenStack gate. (it's exactly how
-the gate invokes Tempest) Or::
-
- $> tox -esmoke
-
-to run the tests tagged as smoke.
-
+.. _testr: https://testrepository.readthedocs.org/en/latest/MANUAL.html
+.. _ostestr: http://docs.openstack.org/developer/os-testr/
Configuration
-------------
Detailed configuration of Tempest is beyond the scope of this
document see :ref:`tempest-configuration` for more details on configuring
-Tempest. The etc/tempest.conf.sample attempts to be a self documenting version
+Tempest. The etc/tempest.conf.sample attempts to be a self-documenting version
of the configuration.
You can generate a new sample tempest.conf file, run the following
@@ -140,7 +146,64 @@
support running with Python 3.4. A gating unit test job was added to also run
Tempest's unit tests under Python 3.4. This means that the Tempest code at
least imports under Python 3.4 and things that have unit test coverage will
-work on Python 3.4. However, because large parts of Tempest are self verifying
+work on Python 3.4. However, because large parts of Tempest are self-verifying
there might be uncaught issues running on Python 3.4. So until there is a gating
job which does a full Tempest run using Python 3.4 there isn't any guarantee
that running Tempest under Python 3.4 is bug free.
+
+Legacy run method
+-----------------
+
+The legacy method of running Tempest is to just treat the Tempest source code
+as a python unittest repository and run directly from the source repo. When
+running in this way you still start with a Tempest config file and the steps
+are basically the same except that it expects you know where the Tempest code
+lives on your system and requires a bit more manual interaction to get Tempest
+running. For example, when running Tempest this way things like a lock file
+directory do not get generated automatically and the burden is on the user to
+create and configure that.
+
+To start you need to create a configuration file. The easiest way to create a
+configuration file is to generate a sample in the ``etc/`` directory ::
+
+ $> cd $TEMPEST_ROOT_DIR
+ $> oslo-config-generator --config-file \
+ tools/config/config-generator.tempest.conf \
+ --output-file etc/tempest.conf
+
+After that, open up the ``etc/tempest.conf`` file and edit the
+configuration variables to match valid data in your environment.
+This includes your Keystone endpoint, a valid user and credentials,
+and reference data to be used in testing.
+
+.. note::
+
+ If you have a running devstack environment, Tempest will be
+ automatically configured and placed in ``/opt/stack/tempest``. It
+ will have a configuration file already set up to work with your
+ devstack installation.
+
+Tempest is not tied to any single test runner, but `testr`_ is the most commonly
+used tool. Also, the nosetests test runner is **not** recommended to run Tempest.
+
+After setting up your configuration file, you can execute the set of Tempest
+tests by using ``testr`` ::
+
+ $> testr run --parallel
+
+To run one single test serially ::
+
+ $> testr run tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_reboot_non_existent_server
+
+Alternatively, you can use the run_tempest.sh script which will create a venv
+and run the tests or use tox to do the same. Tox also contains several existing
+job configurations. For example::
+
+ $> tox -efull
+
+which will run the same set of tests as the OpenStack gate. (it's exactly how
+the gate invokes Tempest) Or::
+
+ $> tox -esmoke
+
+to run the tests tagged as smoke.
diff --git a/REVIEWING.rst b/REVIEWING.rst
index 74bd2ad..12ccb75 100644
--- a/REVIEWING.rst
+++ b/REVIEWING.rst
@@ -34,7 +34,7 @@
Reject Copy and Paste Test Code
-------------------------
+-------------------------------
When creating new tests that are similar to existing tests it is tempting to
simply copy the code and make a few modifications. This increases code size and
the maintenance burden. Such changes should not be approved if it is easy to
diff --git a/doc/source/account_generator.rst b/doc/source/account_generator.rst
index 1c30473..032a20d 100644
--- a/doc/source/account_generator.rst
+++ b/doc/source/account_generator.rst
@@ -1,5 +1,5 @@
---------------------------------
+--------------------------------------
Tempest Test-Account Generator Utility
---------------------------------
+--------------------------------------
-.. automodule:: tempest.cmd.account_generator
\ No newline at end of file
+.. automodule:: tempest.cmd.account_generator
diff --git a/doc/source/conf.py b/doc/source/conf.py
index daa293c..3ec25ea 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -13,6 +13,19 @@
import sys
import os
+import subprocess
+
+# Build a tempest sample config file:
+def build_sample_config(app):
+ root_dir = os.path.dirname(
+ os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+ subprocess.call(["oslo-config-generator", "--config-file",
+ "tools/config/config-generator.tempest.conf",
+ "--output-file", "doc/source/_static/tempest.conf"],
+ cwd=root_dir)
+
+def setup(app):
+ app.connect('builder-inited', build_sample_config)
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 3e6013d..ec430b7 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -6,7 +6,8 @@
This guide is a starting point for configuring tempest. It aims to elaborate
on and explain some of the mandatory and common configuration settings and how
they are used in conjunction. The source of truth on each option is the sample
-config file which explains the purpose of each individual option.
+config file which explains the purpose of each individual option. You can see
+the sample config file here: :ref:`tempest-sampleconf`
Lock Path
---------
@@ -24,7 +25,7 @@
Tempest currently has 2 different ways in configuration to provide credentials
to use when running tempest. One is a traditional set of configuration options
in the tempest.conf file. These options are in the identity section and let you
-specify a regular user, a global admin user, and a alternate user set of
+specify a regular user, a global admin user, and an alternate user set of
credentials. (which consist of a username, password, and project/tenant name)
These options should be clearly labelled in the sample config file in the
identity section.
@@ -187,7 +188,7 @@
#. image_ref_alt
Both options are expecting an image id (not name) from nova. The *image_ref*
-option is what what will be used for booting the majority of servers in tempest.
+option is what will be used for booting the majority of servers in tempest.
*image_ref_alt* is used for tests that require 2 images such as rebuild. If 2
images are not available you can set both options to the same image_ref and
those tests will be skipped.
diff --git a/doc/source/index.rst b/doc/source/index.rst
index e9f2161..fe6074f 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -24,7 +24,6 @@
field_guide/index
field_guide/api
- field_guide/cli
field_guide/scenario
field_guide/stress
field_guide/thirdparty
diff --git a/doc/source/plugin.rst b/doc/source/plugin.rst
index 4e97dbe..f92f63e 100644
--- a/doc/source/plugin.rst
+++ b/doc/source/plugin.rst
@@ -91,6 +91,21 @@
of the tempest developer and reviewer documentation to ensure that the tests
being added in the plugin act and behave like the rest of tempest.
+Dealing with configuration options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Historically Tempest didn't provide external guarantees on its configuration
+options. However, with the introduction of the plugin interface this is no
+longer the case. An external plugin can rely on using any configuration option
+coming from Tempest, there will be at least a full deprecation cycle for any
+option before it's removed. However, just the options provided by Tempest
+may not be sufficient for the plugin. If you need to add any plugin specific
+configuration options you should use the ``register_opts`` and
+``get_opt_lists`` methods to pass them to Tempest when the plugin is loaded.
+When adding configuration options the ``register_opts`` method gets passed the
+CONF object from tempest. This enables the plugin to add options to both
+existing sections and also create new configuration sections for new options.
+
Using Plugins
=============
diff --git a/requirements.txt b/requirements.txt
index 415eaa5..5ebcb65 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,23 +1,23 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-pbr<2.0,>=1.3
-cliff>=1.13.0 # Apache-2.0
+pbr<2.0,>=1.4
+cliff>=1.14.0 # Apache-2.0
anyjson>=0.3.3
httplib2>=0.7.5
jsonschema!=2.5.0,<3.0.0,>=2.0.0
testtools>=1.4.0
boto>=2.32.1
paramiko>=1.13.0
-netaddr>=0.7.12
+netaddr>=0.7.12,!=0.7.16
testrepository>=0.0.18
pyOpenSSL>=0.14
oslo.concurrency>=2.3.0 # Apache-2.0
-oslo.config>=1.11.0 # Apache-2.0
+oslo.config>=2.1.0 # Apache-2.0
oslo.i18n>=1.5.0 # Apache-2.0
-oslo.log>=1.6.0 # Apache-2.0
+oslo.log>=1.8.0 # Apache-2.0
oslo.serialization>=1.4.0 # Apache-2.0
-oslo.utils>=1.9.0 # Apache-2.0
+oslo.utils>=2.0.0 # Apache-2.0
six>=1.9.0
iso8601>=0.1.9
fixtures>=1.3.1
diff --git a/setup.cfg b/setup.cfg
index ab40f12..46e21f1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -42,5 +42,8 @@
build-dir = doc/build
source-dir = doc/source
+[pbr]
+warnerrors = True
+
[wheel]
universal = 1
diff --git a/tempest/README.rst b/tempest/README.rst
index fec2874..f93a173 100644
--- a/tempest/README.rst
+++ b/tempest/README.rst
@@ -57,7 +57,7 @@
stress job.
:ref:`third_party_field_guide`
------------------------------
+------------------------------
Many openstack components include 3rdparty API support. It is
completely legitimate for Tempest to include tests of 3rdparty APIs,
diff --git a/tempest/api/baremetal/admin/test_nodes.py b/tempest/api/baremetal/admin/test_nodes.py
index 4830dcd..b6dee18 100644
--- a/tempest/api/baremetal/admin/test_nodes.py
+++ b/tempest/api/baremetal/admin/test_nodes.py
@@ -20,7 +20,7 @@
class TestNodes(base.BaseBaremetalTest):
- '''Tests for baremetal nodes.'''
+ """Tests for baremetal nodes."""
def setUp(self):
super(TestNodes, self).setUp()
diff --git a/tempest/api/compute/admin/test_agents.py b/tempest/api/compute/admin/test_agents.py
index d9a1ee5..38f5fb7 100644
--- a/tempest/api/compute/admin/test_agents.py
+++ b/tempest/api/compute/admin/test_agents.py
@@ -38,7 +38,7 @@
hypervisor='common', os='linux', architecture='x86_64',
version='7.0', url='xxx://xxxx/xxx/xxx',
md5hash='add6bb58e139be103324d04d82d8f545')
- body = self.client.create_agent(**params)
+ body = self.client.create_agent(**params)['agent']
self.agent_id = body['agent_id']
def tearDown(self):
@@ -67,7 +67,7 @@
hypervisor='kvm', os='win', architecture='x86',
version='7.0', url='xxx://xxxx/xxx/xxx',
md5hash='add6bb58e139be103324d04d82d8f545')
- body = self.client.create_agent(**params)
+ body = self.client.create_agent(**params)['agent']
self.addCleanup(self.client.delete_agent, body['agent_id'])
for expected_item, value in params.items():
self.assertEqual(value, body[expected_item])
@@ -78,7 +78,7 @@
params = self._param_helper(
version='8.0', url='xxx://xxxx/xxx/xxx2',
md5hash='add6bb58e139be103324d04d82d8f547')
- body = self.client.update_agent(self.agent_id, **params)
+ body = self.client.update_agent(self.agent_id, **params)['agent']
for expected_item, value in params.items():
self.assertEqual(value, body[expected_item])
@@ -88,13 +88,13 @@
self.client.delete_agent(self.agent_id)
# Verify the list doesn't contain the deleted agent.
- agents = self.client.list_agents()
+ agents = self.client.list_agents()['agents']
self.assertNotIn(self.agent_id, map(lambda x: x['agent_id'], agents))
@test.idempotent_id('6a326c69-654b-438a-80a3-34bcc454e138')
def test_list_agents(self):
# List all agents.
- agents = self.client.list_agents()
+ agents = self.client.list_agents()['agents']
self.assertTrue(len(agents) > 0, 'Cannot get any agents.(%s)' % agents)
self.assertIn(self.agent_id, map(lambda x: x['agent_id'], agents))
@@ -105,11 +105,12 @@
hypervisor='xen', os='linux', architecture='x86',
version='7.0', url='xxx://xxxx/xxx/xxx1',
md5hash='add6bb58e139be103324d04d82d8f546')
- agent_xen = self.client.create_agent(**params)
+ agent_xen = self.client.create_agent(**params)['agent']
self.addCleanup(self.client.delete_agent, agent_xen['agent_id'])
agent_id_xen = agent_xen['agent_id']
- agents = self.client.list_agents(hypervisor=agent_xen['hypervisor'])
+ agents = (self.client.list_agents(hypervisor=agent_xen['hypervisor'])
+ ['agents'])
self.assertTrue(len(agents) > 0, 'Cannot get any agents.(%s)' % agents)
self.assertIn(agent_id_xen, map(lambda x: x['agent_id'], agents))
self.assertNotIn(self.agent_id, map(lambda x: x['agent_id'], agents))
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 9334fb6..3553ce7 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -40,7 +40,7 @@
cls.aggregate_name_prefix = 'test_aggregate'
cls.az_name_prefix = 'test_az'
- hosts_all = cls.os_adm.hosts_client.list_hosts()
+ hosts_all = cls.os_adm.hosts_client.list_hosts()['hosts']
hosts = map(lambda x: x['host_name'],
filter(lambda y: y['service'] == 'compute', hosts_all))
cls.host = hosts[0]
@@ -57,7 +57,8 @@
def test_aggregate_create_delete(self):
# Create and delete an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self._try_delete_aggregate, aggregate['id'])
self.assertEqual(aggregate_name, aggregate['name'])
self.assertIsNone(aggregate['availability_zone'])
@@ -71,7 +72,7 @@
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
aggregate = self.client.create_aggregate(
- name=aggregate_name, availability_zone=az_name)
+ name=aggregate_name, availability_zone=az_name)['aggregate']
self.addCleanup(self._try_delete_aggregate, aggregate['id'])
self.assertEqual(aggregate_name, aggregate['name'])
self.assertEqual(az_name, aggregate['availability_zone'])
@@ -83,10 +84,11 @@
def test_aggregate_create_verify_entry_in_list(self):
# Create an aggregate and ensure it is listed.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- aggregates = self.client.list_aggregates()
+ aggregates = self.client.list_aggregates()['aggregates']
self.assertIn((aggregate['id'], aggregate['availability_zone']),
map(lambda x: (x['id'], x['availability_zone']),
aggregates))
@@ -95,10 +97,11 @@
def test_aggregate_create_update_metadata_get_details(self):
# Create an aggregate and ensure its details are returned.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- body = self.client.show_aggregate(aggregate['id'])
+ body = self.client.show_aggregate(aggregate['id'])['aggregate']
self.assertEqual(aggregate['name'], body['name'])
self.assertEqual(aggregate['availability_zone'],
body['availability_zone'])
@@ -107,10 +110,10 @@
# set the metadata of the aggregate
meta = {"key": "value"}
body = self.client.set_metadata(aggregate['id'], metadata=meta)
- self.assertEqual(meta, body["metadata"])
+ self.assertEqual(meta, body['aggregate']["metadata"])
# verify the metadata has been set
- body = self.client.show_aggregate(aggregate['id'])
+ body = self.client.show_aggregate(aggregate['id'])['aggregate']
self.assertEqual(meta, body["metadata"])
@test.idempotent_id('4d2b2004-40fa-40a1-aab2-66f4dab81beb')
@@ -119,7 +122,7 @@
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
aggregate = self.client.create_aggregate(
- name=aggregate_name, availability_zone=az_name)
+ name=aggregate_name, availability_zone=az_name)['aggregate']
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertEqual(aggregate_name, aggregate['name'])
@@ -133,11 +136,11 @@
resp_aggregate = self.client.update_aggregate(
aggregate_id,
name=new_aggregate_name,
- availability_zone=new_az_name)
+ availability_zone=new_az_name)['aggregate']
self.assertEqual(new_aggregate_name, resp_aggregate['name'])
self.assertEqual(new_az_name, resp_aggregate['availability_zone'])
- aggregates = self.client.list_aggregates()
+ aggregates = self.client.list_aggregates()['aggregates']
self.assertIn((aggregate_id, new_aggregate_name, new_az_name),
map(lambda x:
(x['id'], x['name'], x['availability_zone']),
@@ -148,16 +151,19 @@
# Add an host to the given aggregate and remove.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- body = self.client.add_host(aggregate['id'], host=self.host)
+ body = (self.client.add_host(aggregate['id'], host=self.host)
+ ['aggregate'])
self.assertEqual(aggregate_name, body['name'])
self.assertEqual(aggregate['availability_zone'],
body['availability_zone'])
self.assertIn(self.host, body['hosts'])
- body = self.client.remove_host(aggregate['id'], host=self.host)
+ body = (self.client.remove_host(aggregate['id'], host=self.host)
+ ['aggregate'])
self.assertEqual(aggregate_name, body['name'])
self.assertEqual(aggregate['availability_zone'],
body['availability_zone'])
@@ -168,13 +174,14 @@
# Add an host to the given aggregate and list.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], host=self.host)
self.addCleanup(self.client.remove_host, aggregate['id'],
host=self.host)
- aggregates = self.client.list_aggregates()
+ aggregates = self.client.list_aggregates()['aggregates']
aggs = filter(lambda x: x['id'] == aggregate['id'], aggregates)
self.assertEqual(1, len(aggs))
agg = aggs[0]
@@ -187,13 +194,14 @@
# Add an host to the given aggregate and get details.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], host=self.host)
self.addCleanup(self.client.remove_host, aggregate['id'],
host=self.host)
- body = self.client.show_aggregate(aggregate['id'])
+ body = self.client.show_aggregate(aggregate['id'])['aggregate']
self.assertEqual(aggregate_name, body['name'])
self.assertIsNone(body['availability_zone'])
self.assertIn(self.host, body['hosts'])
@@ -205,7 +213,7 @@
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
aggregate = self.client.create_aggregate(
- name=aggregate_name, availability_zone=az_name)
+ name=aggregate_name, availability_zone=az_name)['aggregate']
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], host=self.host)
self.addCleanup(self.client.remove_host, aggregate['id'],
diff --git a/tempest/api/compute/admin/test_aggregates_negative.py b/tempest/api/compute/admin/test_aggregates_negative.py
index 231c88f..bc1a854 100644
--- a/tempest/api/compute/admin/test_aggregates_negative.py
+++ b/tempest/api/compute/admin/test_aggregates_negative.py
@@ -39,7 +39,7 @@
cls.aggregate_name_prefix = 'test_aggregate'
cls.az_name_prefix = 'test_az'
- hosts_all = cls.os_adm.hosts_client.list_hosts()
+ hosts_all = cls.os_adm.hosts_client.list_hosts()['hosts']
hosts = map(lambda x: x['host_name'],
filter(lambda y: y['service'] == 'compute', hosts_all))
cls.host = hosts[0]
@@ -76,7 +76,8 @@
# creating an aggregate with existent aggregate name is forbidden
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
aggregate = self.client.create_aggregate(name=aggregate_name)
- self.addCleanup(self.client.delete_aggregate, aggregate['id'])
+ self.addCleanup(self.client.delete_aggregate,
+ aggregate['aggregate']['id'])
self.assertRaises(lib_exc.Conflict,
self.client.create_aggregate,
@@ -87,7 +88,8 @@
def test_aggregate_delete_as_user(self):
# Regular user is not allowed to delete an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(lib_exc.Forbidden,
@@ -106,7 +108,8 @@
def test_aggregate_get_details_as_user(self):
# Regular user is not allowed to get aggregate details.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(lib_exc.Forbidden,
@@ -131,7 +134,7 @@
@test.idempotent_id('0ef07828-12b4-45ba-87cc-41425faf5711')
def test_aggregate_add_non_exist_host(self):
# Adding a non-exist host to an aggregate should raise exceptions.
- hosts_all = self.os_adm.hosts_client.list_hosts()
+ hosts_all = self.os_adm.hosts_client.list_hosts()['hosts']
hosts = map(lambda x: x['host_name'], hosts_all)
while True:
non_exist_host = data_utils.rand_name('nonexist_host')
@@ -139,7 +142,8 @@
break
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(lib_exc.NotFound, self.client.add_host,
@@ -150,7 +154,8 @@
def test_aggregate_add_host_as_user(self):
# Regular user is not allowed to add a host to an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(lib_exc.Forbidden,
@@ -162,7 +167,8 @@
def test_aggregate_add_existent_host(self):
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], host=self.host)
@@ -178,7 +184,8 @@
# Regular user is not allowed to remove a host from an aggregate.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], host=self.host)
self.addCleanup(self.client.remove_host, aggregate['id'],
@@ -193,7 +200,8 @@
def test_aggregate_remove_nonexistent_host(self):
non_exist_host = data_utils.rand_name('nonexist_host')
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = (self.client.create_aggregate(name=aggregate_name)
+ ['aggregate'])
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(lib_exc.NotFound, self.client.remove_host,
diff --git a/tempest/api/compute/admin/test_availability_zone.py b/tempest/api/compute/admin/test_availability_zone.py
index 22eae03..1b36ff2 100644
--- a/tempest/api/compute/admin/test_availability_zone.py
+++ b/tempest/api/compute/admin/test_availability_zone.py
@@ -32,10 +32,10 @@
def test_get_availability_zone_list(self):
# List of availability zone
availability_zone = self.client.list_availability_zones()
- self.assertTrue(len(availability_zone) > 0)
+ self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
@test.idempotent_id('ef726c58-530f-44c2-968c-c7bed22d5b8c')
def test_get_availability_zone_list_detail(self):
# List of availability zones and available services
availability_zone = self.client.list_availability_zones(detail=True)
- self.assertTrue(len(availability_zone) > 0)
+ self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
diff --git a/tempest/api/compute/admin/test_baremetal_nodes.py b/tempest/api/compute/admin/test_baremetal_nodes.py
index 4d95f0a..2599d86 100644
--- a/tempest/api/compute/admin/test_baremetal_nodes.py
+++ b/tempest/api/compute/admin/test_baremetal_nodes.py
@@ -46,11 +46,11 @@
# List all baremetal nodes and ensure our created test nodes are
# listed
bm_node_ids = set([n['id'] for n in
- self.client.list_baremetal_nodes()])
+ self.client.list_baremetal_nodes()['nodes']])
test_node_ids = set([n['uuid'] for n in test_nodes])
self.assertTrue(test_node_ids.issubset(bm_node_ids))
# Test getting each individually
for node in test_nodes:
baremetal_node = self.client.show_baremetal_node(node['uuid'])
- self.assertEqual(node['uuid'], baremetal_node['id'])
+ self.assertEqual(node['uuid'], baremetal_node['node']['id'])
diff --git a/tempest/api/compute/admin/test_fixed_ips.py b/tempest/api/compute/admin/test_fixed_ips.py
index 3e20b46..669585c 100644
--- a/tempest/api/compute/admin/test_fixed_ips.py
+++ b/tempest/api/compute/admin/test_fixed_ips.py
@@ -51,7 +51,7 @@
@test.services('network')
def test_list_fixed_ip_details(self):
fixed_ip = self.client.show_fixed_ip(self.ip)
- self.assertEqual(fixed_ip['address'], self.ip)
+ self.assertEqual(fixed_ip['fixed_ip']['address'], self.ip)
@test.idempotent_id('5485077b-7e46-4cec-b402-91dc3173433b')
@test.services('network')
diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py
index a3c25a2..42a2984 100644
--- a/tempest/api/compute/admin/test_flavors.py
+++ b/tempest/api/compute/admin/test_flavors.py
@@ -69,7 +69,7 @@
id=flavor_id,
ephemeral=self.ephemeral,
swap=self.swap,
- rxtx_factor=self.rxtx)
+ rxtx_factor=self.rxtx)['flavor']
self.addCleanup(self.flavor_clean_up, flavor['id'])
self.assertEqual(flavor['name'], flavor_name)
self.assertEqual(flavor['vcpus'], self.vcpus)
@@ -82,7 +82,7 @@
self.assertEqual(flavor['os-flavor-access:is_public'], True)
# Verify flavor is retrieved
- flavor = self.client.show_flavor(flavor['id'])
+ flavor = self.client.show_flavor(flavor['id'])['flavor']
self.assertEqual(flavor['name'], flavor_name)
return flavor['id']
@@ -121,11 +121,11 @@
id=new_flavor_id,
ephemeral=self.ephemeral,
swap=self.swap,
- rxtx_factor=self.rxtx)
+ rxtx_factor=self.rxtx)['flavor']
self.addCleanup(self.flavor_clean_up, flavor['id'])
flag = False
# Verify flavor is retrieved
- flavors = self.client.list_flavors(detail=True)
+ flavors = self.client.list_flavors(detail=True)['flavors']
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -150,7 +150,7 @@
flavor = self.client.create_flavor(name=flavor_name,
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
- id=new_flavor_id)
+ id=new_flavor_id)['flavor']
self.addCleanup(self.flavor_clean_up, flavor['id'])
self.assertEqual(flavor['name'], flavor_name)
self.assertEqual(flavor['ram'], self.ram)
@@ -160,12 +160,12 @@
verify_flavor_response_extension(flavor)
# Verify flavor is retrieved
- flavor = self.client.show_flavor(new_flavor_id)
+ flavor = self.client.show_flavor(new_flavor_id)['flavor']
self.assertEqual(flavor['name'], flavor_name)
verify_flavor_response_extension(flavor)
# Check if flavor is present in list
- flavors = self.user_client.list_flavors(detail=True)
+ flavors = self.user_client.list_flavors(detail=True)['flavors']
for flavor in flavors:
if flavor['name'] == flavor_name:
verify_flavor_response_extension(flavor)
@@ -186,11 +186,11 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=new_flavor_id,
- is_public="False")
+ is_public="False")['flavor']
self.addCleanup(self.flavor_clean_up, flavor['id'])
# Verify flavor is retrieved
flag = False
- flavors = self.client.list_flavors(detail=True)
+ flavors = self.client.list_flavors(detail=True)['flavors']
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -198,7 +198,7 @@
# Verify flavor is not retrieved with other user
flag = False
- flavors = self.user_client.list_flavors(detail=True)
+ flavors = self.user_client.list_flavors(detail=True)['flavors']
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -215,7 +215,7 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=new_flavor_id,
- is_public="False")
+ is_public="False")['flavor']
self.addCleanup(self.flavor_clean_up, flavor['id'])
# Verify flavor is not used by other user
@@ -235,12 +235,12 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=new_flavor_id,
- is_public="True")
+ is_public="True")['flavor']
self.addCleanup(self.flavor_clean_up, flavor['id'])
flag = False
self.new_client = self.flavors_client
# Verify flavor is retrieved with new user
- flavors = self.new_client.list_flavors(detail=True)
+ flavors = self.new_client.list_flavors(detail=True)['flavors']
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -258,7 +258,7 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=flavor_id_not_public,
- is_public="False")
+ is_public="False")['flavor']
self.addCleanup(self.flavor_clean_up, flavor['id'])
# Create a public flavor
@@ -266,7 +266,7 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=flavor_id_public,
- is_public="True")
+ is_public="True")['flavor']
self.addCleanup(self.flavor_clean_up, flavor['id'])
def _flavor_lookup(flavors, flavor_name):
@@ -278,7 +278,8 @@
def _test_string_variations(variations, flavor_name):
for string in variations:
params = {'is_public': string}
- flavors = self.client.list_flavors(detail=True, **params)
+ flavors = (self.client.list_flavors(detail=True, **params)
+ ['flavors'])
flavor = _flavor_lookup(flavors, flavor_name)
self.assertIsNotNone(flavor)
@@ -297,7 +298,7 @@
flavor = self.client.create_flavor(name=flavor_name,
ram=ram, vcpus=self.vcpus,
disk=self.disk,
- id=new_flavor_id)
+ id=new_flavor_id)['flavor']
self.addCleanup(self.flavor_clean_up, flavor['id'])
self.assertEqual(flavor['name'], flavor_name)
self.assertEqual(flavor['vcpus'], self.vcpus)
diff --git a/tempest/api/compute/admin/test_flavors_access.py b/tempest/api/compute/admin/test_flavors_access.py
index ccfe20b..0a11d52 100644
--- a/tempest/api/compute/admin/test_flavors_access.py
+++ b/tempest/api/compute/admin/test_flavors_access.py
@@ -43,8 +43,6 @@
# Non admin tenant ID
cls.tenant_id = cls.flavors_client.tenant_id
- # Compute admin tenant ID
- cls.adm_tenant_id = cls.client.tenant_id
cls.flavor_name_prefix = 'test_flavor_access_'
cls.ram = 512
cls.vcpus = 1
@@ -60,9 +58,10 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=new_flavor_id,
- is_public='False')
+ is_public='False')['flavor']
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
- flavor_access = self.client.list_flavor_access(new_flavor_id)
+ flavor_access = (self.client.list_flavor_access(new_flavor_id)
+ ['flavor_access'])
self.assertEqual(len(flavor_access), 0, str(flavor_access))
@test.idempotent_id('59e622f6-bdf6-45e3-8ba8-fedad905a6b4')
@@ -74,26 +73,28 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=new_flavor_id,
- is_public='False')
+ is_public='False')['flavor']
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# Add flavor access to a tenant.
resp_body = {
"tenant_id": str(self.tenant_id),
"flavor_id": str(new_flavor['id']),
}
- add_body = \
- self.client.add_flavor_access(new_flavor['id'], self.tenant_id)
+ add_body = (self.client.add_flavor_access(new_flavor['id'],
+ self.tenant_id)
+ ['flavor_access'])
self.assertIn(resp_body, add_body)
# The flavor is present in list.
- flavors = self.flavors_client.list_flavors(detail=True)
+ flavors = self.flavors_client.list_flavors(detail=True)['flavors']
self.assertIn(new_flavor['id'], map(lambda x: x['id'], flavors))
# Remove flavor access from a tenant.
- remove_body = \
- self.client.remove_flavor_access(new_flavor['id'], self.tenant_id)
+ remove_body = (self.client.remove_flavor_access(new_flavor['id'],
+ self.tenant_id)
+ ['flavor_access'])
self.assertNotIn(resp_body, remove_body)
# The flavor is not present in list.
- flavors = self.flavors_client.list_flavors(detail=True)
+ flavors = self.flavors_client.list_flavors(detail=True)['flavors']
self.assertNotIn(new_flavor['id'], map(lambda x: x['id'], flavors))
diff --git a/tempest/api/compute/admin/test_flavors_access_negative.py b/tempest/api/compute/admin/test_flavors_access_negative.py
index 03898c2..89ae1b5 100644
--- a/tempest/api/compute/admin/test_flavors_access_negative.py
+++ b/tempest/api/compute/admin/test_flavors_access_negative.py
@@ -61,7 +61,7 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=new_flavor_id,
- is_public='True')
+ is_public='True')['flavor']
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
self.assertRaises(lib_exc.NotFound,
self.client.list_flavor_access,
@@ -77,7 +77,7 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=new_flavor_id,
- is_public='False')
+ is_public='False')['flavor']
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
self.assertRaises(lib_exc.Forbidden,
self.flavors_client.add_flavor_access,
@@ -94,7 +94,7 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=new_flavor_id,
- is_public='False')
+ is_public='False')['flavor']
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# Add flavor access to a tenant.
self.client.add_flavor_access(new_flavor['id'], self.tenant_id)
@@ -115,7 +115,7 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=new_flavor_id,
- is_public='False')
+ is_public='False')['flavor']
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# Add flavor access to a tenant.
@@ -140,7 +140,7 @@
ram=self.ram, vcpus=self.vcpus,
disk=self.disk,
id=new_flavor_id,
- is_public='False')
+ is_public='False')['flavor']
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# An exception should be raised when flavor access is not found
diff --git a/tempest/api/compute/admin/test_flavors_extra_specs.py b/tempest/api/compute/admin/test_flavors_extra_specs.py
index 6039cb2..25dce6a 100644
--- a/tempest/api/compute/admin/test_flavors_extra_specs.py
+++ b/tempest/api/compute/admin/test_flavors_extra_specs.py
@@ -55,7 +55,8 @@
disk=disk,
id=cls.new_flavor_id,
ephemeral=ephemeral,
- swap=swap, rxtx_factor=rxtx)
+ swap=swap,
+ rxtx_factor=rxtx)['flavor']
@classmethod
def resource_cleanup(cls):
@@ -70,11 +71,12 @@
# Assigning extra specs values that are to be set
specs = {"key1": "value1", "key2": "value2"}
# SET extra specs to the flavor created in setUp
- set_body = \
- self.client.set_flavor_extra_spec(self.flavor['id'], **specs)
+ set_body = self.client.set_flavor_extra_spec(self.flavor['id'],
+ **specs)['extra_specs']
self.assertEqual(set_body, specs)
# GET extra specs and verify
- get_body = self.client.list_flavor_extra_specs(self.flavor['id'])
+ get_body = (self.client.list_flavor_extra_specs(self.flavor['id'])
+ ['extra_specs'])
self.assertEqual(get_body, specs)
# UPDATE the value of the extra specs key1
@@ -86,7 +88,8 @@
# GET extra specs and verify the value of the key2
# is the same as before
- get_body = self.client.list_flavor_extra_specs(self.flavor['id'])
+ get_body = (self.client.list_flavor_extra_specs(self.flavor['id'])
+ ['extra_specs'])
self.assertEqual(get_body, {"key1": "value", "key2": "value2"})
# UNSET extra specs that were set in this test
@@ -97,7 +100,8 @@
def test_flavor_non_admin_get_all_keys(self):
specs = {"key1": "value1", "key2": "value2"}
self.client.set_flavor_extra_spec(self.flavor['id'], **specs)
- body = self.flavors_client.list_flavor_extra_specs(self.flavor['id'])
+ body = (self.flavors_client.list_flavor_extra_specs(self.flavor['id'])
+ ['extra_specs'])
for key in specs:
self.assertEqual(body[key], specs[key])
@@ -105,7 +109,8 @@
@test.idempotent_id('12805a7f-39a3-4042-b989-701d5cad9c90')
def test_flavor_non_admin_get_specific_key(self):
body = self.client.set_flavor_extra_spec(self.flavor['id'],
- key1="value1", key2="value2")
+ key1="value1",
+ key2="value2")['extra_specs']
self.assertEqual(body['key1'], 'value1')
self.assertIn('key2', body)
body = self.flavors_client.show_flavor_extra_spec(
diff --git a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
index f1e11f4..aa95454 100644
--- a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
+++ b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
@@ -58,7 +58,8 @@
disk=disk,
id=cls.new_flavor_id,
ephemeral=ephemeral,
- swap=swap, rxtx_factor=rxtx)
+ swap=swap,
+ rxtx_factor=rxtx)['flavor']
@classmethod
def resource_cleanup(cls):
@@ -80,7 +81,7 @@
def test_flavor_non_admin_update_specific_key(self):
# non admin user is not allowed to update flavor extra spec
body = self.client.set_flavor_extra_spec(
- self.flavor['id'], key1="value1", key2="value2")
+ self.flavor['id'], key1="value1", key2="value2")['extra_specs']
self.assertEqual(body['key1'], 'value1')
self.assertRaises(lib_exc.Forbidden,
self.flavors_client.
diff --git a/tempest/api/compute/admin/test_floating_ips_bulk.py b/tempest/api/compute/admin/test_floating_ips_bulk.py
index 4ac1915..e979616 100644
--- a/tempest/api/compute/admin/test_floating_ips_bulk.py
+++ b/tempest/api/compute/admin/test_floating_ips_bulk.py
@@ -45,7 +45,7 @@
@classmethod
def verify_unallocated_floating_ip_range(cls, ip_range):
# Verify whether configure floating IP range is not already allocated.
- body = cls.client.list_floating_ips_bulk()
+ body = cls.client.list_floating_ips_bulk()['floating_ip_info']
allocated_ips_list = map(lambda x: x['address'], body)
for ip_addr in netaddr.IPNetwork(ip_range).iter_hosts():
if str(ip_addr) in allocated_ips_list:
@@ -70,14 +70,16 @@
# anywhere. Using the below mentioned interface which is not ever
# expected to be used. Clean Up has been done for created IP range
interface = 'eth0'
- body = self.client.create_floating_ips_bulk(self.ip_range,
- pool,
- interface)
+ body = (self.client.create_floating_ips_bulk(self.ip_range,
+ pool,
+ interface)
+ ['floating_ips_bulk_create'])
self.addCleanup(self._delete_floating_ips_bulk, self.ip_range)
self.assertEqual(self.ip_range, body['ip_range'])
- ips_list = self.client.list_floating_ips_bulk()
+ ips_list = self.client.list_floating_ips_bulk()['floating_ip_info']
self.assertNotEqual(0, len(ips_list))
for ip in netaddr.IPNetwork(self.ip_range).iter_hosts():
self.assertIn(str(ip), map(lambda x: x['address'], ips_list))
- body = self.client.delete_floating_ips_bulk(self.ip_range)
- self.assertEqual(self.ip_range, body.data)
+ body = (self.client.delete_floating_ips_bulk(self.ip_range)
+ ['floating_ips_bulk_delete'])
+ self.assertEqual(self.ip_range, body)
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index 0dadea5..6d8788f 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -30,15 +30,15 @@
@test.idempotent_id('9bfaf98d-e2cb-44b0-a07e-2558b2821e4f')
def test_list_hosts(self):
- hosts = self.client.list_hosts()
+ hosts = self.client.list_hosts()['hosts']
self.assertTrue(len(hosts) >= 2, str(hosts))
@test.idempotent_id('5dc06f5b-d887-47a2-bb2a-67762ef3c6de')
def test_list_hosts_with_zone(self):
self.useFixture(fixtures.LockFixture('availability_zone'))
- hosts = self.client.list_hosts()
+ hosts = self.client.list_hosts()['hosts']
host = hosts[0]
- hosts = self.client.list_hosts(zone=host['zone'])
+ hosts = self.client.list_hosts(zone=host['zone'])['hosts']
self.assertTrue(len(hosts) >= 1)
self.assertIn(host, hosts)
@@ -46,26 +46,26 @@
def test_list_hosts_with_a_blank_zone(self):
# If send the request with a blank zone, the request will be successful
# and it will return all the hosts list
- hosts = self.client.list_hosts(zone='')
+ hosts = self.client.list_hosts(zone='')['hosts']
self.assertNotEqual(0, len(hosts))
@test.idempotent_id('c6ddbadb-c94e-4500-b12f-8ffc43843ff8')
def test_list_hosts_with_nonexistent_zone(self):
# If send the request with a nonexistent zone, the request will be
# successful and no hosts will be retured
- hosts = self.client.list_hosts(zone='xxx')
+ hosts = self.client.list_hosts(zone='xxx')['hosts']
self.assertEqual(0, len(hosts))
@test.idempotent_id('38adbb12-aee2-4498-8aec-329c72423aa4')
def test_show_host_detail(self):
- hosts = self.client.list_hosts()
+ hosts = self.client.list_hosts()['hosts']
hosts = [host for host in hosts if host['service'] == 'compute']
self.assertTrue(len(hosts) >= 1)
for host in hosts:
hostname = host['host_name']
- resources = self.client.show_host(hostname)
+ resources = self.client.show_host(hostname)['host']
self.assertTrue(len(resources) >= 1)
host_resource = resources[0]['resource']
self.assertIsNotNone(host_resource)
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
index b2d2a04..4c8d8a2 100644
--- a/tempest/api/compute/admin/test_hosts_negative.py
+++ b/tempest/api/compute/admin/test_hosts_negative.py
@@ -32,7 +32,7 @@
cls.non_admin_client = cls.os.hosts_client
def _get_host_name(self):
- hosts = self.client.list_hosts()
+ hosts = self.client.list_hosts()['hosts']
self.assertTrue(len(hosts) >= 1)
hostname = hosts[0]['host_name']
return hostname
@@ -71,19 +71,6 @@
maintenance_mode='enable')
@test.attr(type=['negative'])
- @test.idempotent_id('76e396fe-5418-4dd3-a186-5b301edc0721')
- def test_update_host_with_extra_param(self):
- # only 'status' and 'maintenance_mode' are the valid params.
- hostname = self._get_host_name()
-
- self.assertRaises(lib_exc.BadRequest,
- self.client.update_host,
- hostname,
- status='enable',
- maintenance_mode='enable',
- param='XXX')
-
- @test.attr(type=['negative'])
@test.idempotent_id('fbe2bf3e-3246-4a95-a59f-94e4e298ec77')
def test_update_host_with_invalid_status(self):
# 'status' can only be 'enable' or 'disable'
diff --git a/tempest/api/compute/admin/test_hypervisor.py b/tempest/api/compute/admin/test_hypervisor.py
index 47f66af..186867e 100644
--- a/tempest/api/compute/admin/test_hypervisor.py
+++ b/tempest/api/compute/admin/test_hypervisor.py
@@ -30,7 +30,7 @@
def _list_hypervisors(self):
# List of hypervisors
- hypers = self.client.list_hypervisors()
+ hypers = self.client.list_hypervisors()['hypervisors']
return hypers
def assertHypervisors(self, hypers):
@@ -45,7 +45,7 @@
@test.idempotent_id('1e7fdac2-b672-4ad1-97a4-bad0e3030118')
def test_get_hypervisor_list_details(self):
# Display the details of the all hypervisor
- hypers = self.client.list_hypervisors(detail=True)
+ hypers = self.client.list_hypervisors(detail=True)['hypervisors']
self.assertHypervisors(hypers)
@test.idempotent_id('94ff9eae-a183-428e-9cdb-79fde71211cc')
@@ -54,7 +54,7 @@
hypers = self._list_hypervisors()
self.assertHypervisors(hypers)
- details = self.client.show_hypervisor(hypers[0]['id'])
+ details = self.client.show_hypervisor(hypers[0]['id'])['hypervisor']
self.assertTrue(len(details) > 0)
self.assertEqual(details['hypervisor_hostname'],
hypers[0]['hypervisor_hostname'])
@@ -66,13 +66,15 @@
self.assertHypervisors(hypers)
hostname = hypers[0]['hypervisor_hostname']
- hypervisors = self.client.list_servers_on_hypervisor(hostname)
+ hypervisors = (self.client.list_servers_on_hypervisor(hostname)
+ ['hypervisors'])
self.assertTrue(len(hypervisors) > 0)
@test.idempotent_id('797e4f28-b6e0-454d-a548-80cc77c00816')
def test_get_hypervisor_stats(self):
# Verify the stats of the all hypervisor
- stats = self.client.show_hypervisor_statistics()
+ stats = (self.client.show_hypervisor_statistics()
+ ['hypervisor_statistics'])
self.assertTrue(len(stats) > 0)
@test.idempotent_id('91a50d7d-1c2b-4f24-b55a-a1fe20efca70')
@@ -88,7 +90,8 @@
ironic_only = True
hypers_without_ironic = []
for hyper in hypers:
- details = self.client.show_hypervisor(hypers[0]['id'])
+ details = (self.client.show_hypervisor(hypers[0]['id'])
+ ['hypervisor'])
if details['hypervisor_type'] != 'ironic':
hypers_without_ironic.append(hyper)
ironic_only = False
@@ -102,7 +105,8 @@
# because hypervisors might be disabled, this loops looking
# for any good hit.
try:
- uptime = self.client.show_hypervisor_uptime(hyper['id'])
+ uptime = (self.client.show_hypervisor_uptime(hyper['id'])
+ ['hypervisor'])
if len(uptime) > 0:
has_valid_uptime = True
break
@@ -117,5 +121,5 @@
hypers = self._list_hypervisors()
self.assertHypervisors(hypers)
hypers = self.client.search_hypervisor(
- hypers[0]['hypervisor_hostname'])
+ hypers[0]['hypervisor_hostname'])['hypervisors']
self.assertHypervisors(hypers)
diff --git a/tempest/api/compute/admin/test_hypervisor_negative.py b/tempest/api/compute/admin/test_hypervisor_negative.py
index 701b4bb..ca4a691 100644
--- a/tempest/api/compute/admin/test_hypervisor_negative.py
+++ b/tempest/api/compute/admin/test_hypervisor_negative.py
@@ -36,7 +36,7 @@
def _list_hypervisors(self):
# List of hypervisors
- hypers = self.client.list_hypervisors()
+ hypers = self.client.list_hypervisors()['hypervisors']
return hypers
@test.attr(type=['negative'])
diff --git a/tempest/api/compute/admin/test_instance_usage_audit_log.py b/tempest/api/compute/admin/test_instance_usage_audit_log.py
index 189c316..6976783 100644
--- a/tempest/api/compute/admin/test_instance_usage_audit_log.py
+++ b/tempest/api/compute/admin/test_instance_usage_audit_log.py
@@ -31,7 +31,8 @@
@test.idempotent_id('25319919-33d9-424f-9f99-2c203ee48b9d')
def test_list_instance_usage_audit_logs(self):
# list instance usage audit logs
- body = self.adm_client.list_instance_usage_audit_logs()
+ body = (self.adm_client.list_instance_usage_audit_logs()
+ ["instance_usage_audit_logs"])
expected_items = ['total_errors', 'total_instances', 'log',
'num_hosts_running', 'num_hosts_done',
'num_hosts', 'hosts_not_run', 'overall_status',
@@ -44,8 +45,9 @@
def test_get_instance_usage_audit_log(self):
# Get instance usage audit log before specified time
now = datetime.datetime.now()
- body = self.adm_client.show_instance_usage_audit_log(
+ body = (self.adm_client.show_instance_usage_audit_log(
urllib.quote(now.strftime("%Y-%m-%d %H:%M:%S")))
+ ["instance_usage_audit_log"])
expected_items = ['total_errors', 'total_instances', 'log',
'num_hosts_running', 'num_hosts_done', 'num_hosts',
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index 6ffa4e9..410f7b7 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -32,6 +32,7 @@
super(LiveBlockMigrationTestJSON, cls).setup_clients()
cls.admin_hosts_client = cls.os_adm.hosts_client
cls.admin_servers_client = cls.os_adm.servers_client
+ cls.admin_migration_client = cls.os_adm.migrations_client
@classmethod
def resource_setup(cls):
@@ -40,7 +41,7 @@
cls.created_server_ids = []
def _get_compute_hostnames(self):
- body = self.admin_hosts_client.list_hosts()
+ body = self.admin_hosts_client.list_hosts()['hosts']
return [
host_record['host_name']
for host_record in body
@@ -55,9 +56,10 @@
return self._get_server_details(server_id)[self._host_key]
def _migrate_server_to(self, server_id, dest_host):
+ bmflm = CONF.compute_feature_enabled.block_migration_for_live_migration
body = self.admin_servers_client.live_migrate_server(
- server_id, dest_host,
- CONF.compute_feature_enabled.block_migration_for_live_migration)
+ server_id, host=dest_host, block_migration=bmflm,
+ disk_over_commit=False)
return body
def _get_host_other_than(self, host):
@@ -79,7 +81,7 @@
return server_id
def _volume_clean_up(self, server_id, volume_id):
- body = self.volumes_client.show_volume(volume_id)
+ body = self.volumes_client.show_volume(volume_id)['volume']
if body['status'] == 'in-use':
self.servers_client.detach_volume(server_id, volume_id)
self.volumes_client.wait_for_volume_status(volume_id, 'available')
@@ -109,7 +111,17 @@
self._migrate_server_to(server_id, target_host)
waiters.wait_for_server_status(self.servers_client, server_id, state)
- self.assertEqual(target_host, self._get_host_for_server(server_id))
+ migration_list = (self.admin_migration_client.list_migrations()
+ ['migrations'])
+
+ msg = ("Live Migration failed. Migrations list for Instance "
+ "%s: [" % server_id)
+ for live_migration in migration_list:
+ if (live_migration['instance_uuid'] == server_id):
+ msg += "\n%s" % live_migration
+ msg += "]"
+ self.assertEqual(target_host, self._get_host_for_server(server_id),
+ msg)
@test.idempotent_id('1dce86b8-eb04-4c03-a9d8-9c1dc3ee0c7b')
@testtools.skipUnless(CONF.compute_feature_enabled.live_migration,
@@ -146,14 +158,15 @@
actual_host = self._get_host_for_server(server_id)
target_host = self._get_host_other_than(actual_host)
- volume = self.volumes_client.create_volume(display_name='test')
+ volume = self.volumes_client.create_volume(
+ display_name='test')['volume']
self.volumes_client.wait_for_volume_status(volume['id'],
'available')
self.addCleanup(self._volume_clean_up, server_id, volume['id'])
# Attach the volume to the server
- self.servers_client.attach_volume(server_id, volume['id'],
+ self.servers_client.attach_volume(server_id, volumeId=volume['id'],
device='/dev/xvdb')
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
diff --git a/tempest/api/compute/admin/test_migrations.py b/tempest/api/compute/admin/test_migrations.py
index 5af7406..f81d665 100644
--- a/tempest/api/compute/admin/test_migrations.py
+++ b/tempest/api/compute/admin/test_migrations.py
@@ -42,14 +42,14 @@
server = self.create_test_server(wait_until="ACTIVE")
server_id = server['id']
- self.servers_client.resize(server_id, self.flavor_ref_alt)
+ self.servers_client.resize_server(server_id, self.flavor_ref_alt)
waiters.wait_for_server_status(self.servers_client,
server_id, 'VERIFY_RESIZE')
- self.servers_client.confirm_resize(server_id)
+ self.servers_client.confirm_resize_server(server_id)
waiters.wait_for_server_status(self.servers_client,
server_id, 'ACTIVE')
- body = self.client.list_migrations()
+ body = self.client.list_migrations()['migrations']
instance_uuids = [x['instance_uuid'] for x in body]
self.assertIn(server_id, instance_uuids)
diff --git a/tempest/api/compute/admin/test_networks.py b/tempest/api/compute/admin/test_networks.py
index 981a5c9..deb81a9 100644
--- a/tempest/api/compute/admin/test_networks.py
+++ b/tempest/api/compute/admin/test_networks.py
@@ -36,7 +36,7 @@
@test.idempotent_id('d206d211-8912-486f-86e2-a9d090d1f416')
def test_get_network(self):
- networks = self.client.list_networks()
+ networks = self.client.list_networks()['networks']
if CONF.compute.fixed_network_name:
configured_network = [x for x in networks if x['label'] ==
CONF.compute.fixed_network_name]
@@ -47,12 +47,13 @@
else:
configured_network = networks
configured_network = configured_network[0]
- network = self.client.show_network(configured_network['id'])
+ network = (self.client.show_network(configured_network['id'])
+ ['network'])
self.assertEqual(configured_network['label'], network['label'])
@test.idempotent_id('df3d1046-6fa5-4b2c-ad0c-cfa46a351cb9')
def test_list_all_networks(self):
- networks = self.client.list_networks()
+ networks = self.client.list_networks()['networks']
# Check the configured network is in the list
if CONF.compute.fixed_network_name:
configured_network = CONF.compute.fixed_network_name
diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py
index 47bdfa6..ef96f9b 100644
--- a/tempest/api/compute/admin/test_quotas.py
+++ b/tempest/api/compute/admin/test_quotas.py
@@ -59,7 +59,7 @@
# Admin can get the default resource quota set for a tenant
expected_quota_set = self.default_quota_set | set(['id'])
quota_set = self.adm_client.show_default_quota_set(
- self.demo_tenant_id)
+ self.demo_tenant_id)['quota_set']
self.assertEqual(quota_set['id'], self.demo_tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
@@ -68,7 +68,7 @@
def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant
default_quota_set = self.adm_client.show_default_quota_set(
- self.demo_tenant_id)
+ self.demo_tenant_id)['quota_set']
new_quota_set = {'injected_file_content_bytes': 20480,
'metadata_items': 256, 'injected_files': 10,
'ram': 10240, 'floating_ips': 20, 'fixed_ips': 10,
@@ -79,7 +79,7 @@
quota_set = self.adm_client.update_quota_set(
self.demo_tenant_id,
force=True,
- **new_quota_set)
+ **new_quota_set)['quota_set']
default_quota_set.pop('id')
# NOTE(PhilDay) The following is safe as we're not updating these
@@ -107,7 +107,7 @@
self.addCleanup(identity_client.delete_tenant, tenant_id)
self.adm_client.update_quota_set(tenant_id, ram='5120')
- quota_set = self.adm_client.show_quota_set(tenant_id)
+ quota_set = self.adm_client.show_quota_set(tenant_id)['quota_set']
self.assertEqual(5120, quota_set['ram'])
# Verify that GET shows the updated quota set of user
@@ -118,14 +118,16 @@
password=password,
tenant_id=tenant_id,
email=email)
+ if 'user' in user:
+ user = user['user']
user_id = user['id']
self.addCleanup(identity_client.delete_user, user_id)
self.adm_client.update_quota_set(tenant_id,
user_id=user_id,
ram='2048')
- quota_set = self.adm_client.show_quota_set(tenant_id,
- user_id=user_id)
+ quota_set = self.adm_client.show_quota_set(
+ tenant_id, user_id=user_id)['quota_set']
self.assertEqual(2048, quota_set['ram'])
@test.idempotent_id('389d04f0-3a41-405f-9317-e5f86e3c44f0')
@@ -138,14 +140,15 @@
description=tenant_desc)
tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id)
- quota_set_default = self.adm_client.show_quota_set(tenant_id)
+ quota_set_default = (self.adm_client.show_quota_set(tenant_id)
+ ['quota_set'])
ram_default = quota_set_default['ram']
self.adm_client.update_quota_set(tenant_id, ram='5120')
self.adm_client.delete_quota_set(tenant_id)
- quota_set_new = self.adm_client.show_quota_set(tenant_id)
+ quota_set_new = self.adm_client.show_quota_set(tenant_id)['quota_set']
self.assertEqual(ram_default, quota_set_new['ram'])
@@ -167,7 +170,7 @@
def _restore_default_quotas(self, original_defaults):
LOG.debug("restoring quota class defaults")
self.adm_client.update_quota_class_set(
- 'default', **original_defaults)
+ 'default', **original_defaults)['quota_class_set']
# NOTE(sdague): this test is problematic as it changes
# global state, and possibly needs to be part of a set of
@@ -176,7 +179,8 @@
@test.idempotent_id('7932ab0f-5136-4075-b201-c0e2338df51a')
def test_update_default_quotas(self):
LOG.debug("get the current 'default' quota class values")
- body = self.adm_client.show_quota_class_set('default')
+ body = (self.adm_client.show_quota_class_set('default')
+ ['quota_class_set'])
self.assertIn('id', body)
self.assertEqual('default', body.pop('id'))
# restore the defaults when the test is done
@@ -188,8 +192,8 @@
# to a very small number which causes issues.
body[quota] = default + 100
LOG.debug("update limits for the default quota class set")
- update_body = self.adm_client.update_quota_class_set('default',
- **body)
+ update_body = self.adm_client.update_quota_class_set(
+ 'default', **body)['quota_class_set']
LOG.debug("assert that the response has all of the changed values")
self.assertThat(update_body.items(),
matchers.ContainsAll(body.items()))
diff --git a/tempest/api/compute/admin/test_quotas_negative.py b/tempest/api/compute/admin/test_quotas_negative.py
index 8dcd0b2..758cd43 100644
--- a/tempest/api/compute/admin/test_quotas_negative.py
+++ b/tempest/api/compute/admin/test_quotas_negative.py
@@ -55,13 +55,14 @@
@test.idempotent_id('91058876-9947-4807-9f22-f6eb17140d9b')
def test_create_server_when_cpu_quota_is_full(self):
# Disallow server creation when tenant's vcpu quota is full
- quota_set = self.adm_client.show_quota_set(self.demo_tenant_id)
+ quota_set = (self.adm_client.show_quota_set(self.demo_tenant_id)
+ ['quota_set'])
default_vcpu_quota = quota_set['cores']
vcpu_quota = 0 # Set the quota to zero to conserve resources
- quota_set = self.adm_client.update_quota_set(self.demo_tenant_id,
- force=True,
- cores=vcpu_quota)
+ self.adm_client.update_quota_set(self.demo_tenant_id,
+ force=True,
+ cores=vcpu_quota)
self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
cores=default_vcpu_quota)
@@ -72,7 +73,8 @@
@test.idempotent_id('6fdd7012-584d-4327-a61c-49122e0d5864')
def test_create_server_when_memory_quota_is_full(self):
# Disallow server creation when tenant's memory quota is full
- quota_set = self.adm_client.show_quota_set(self.demo_tenant_id)
+ quota_set = (self.adm_client.show_quota_set(self.demo_tenant_id)
+ ['quota_set'])
default_mem_quota = quota_set['ram']
mem_quota = 0 # Set the quota to zero to conserve resources
@@ -89,7 +91,8 @@
@test.idempotent_id('7c6be468-0274-449a-81c3-ac1c32ee0161')
def test_create_server_when_instances_quota_is_full(self):
# Once instances quota limit is reached, disallow server creation
- quota_set = self.adm_client.show_quota_set(self.demo_tenant_id)
+ quota_set = (self.adm_client.show_quota_set(self.demo_tenant_id)
+ ['quota_set'])
default_instances_quota = quota_set['instances']
instances_quota = 0 # Set quota to zero to disallow server creation
@@ -108,17 +111,17 @@
def test_security_groups_exceed_limit(self):
# Negative test: Creation Security Groups over limit should FAIL
- quota_set = self.adm_client.show_quota_set(self.demo_tenant_id)
+ quota_set = (self.adm_client.show_quota_set(self.demo_tenant_id)
+ ['quota_set'])
default_sg_quota = quota_set['security_groups']
# Set the quota to number of used security groups
- sg_quota = self.limits_client.show_limits()['absolute'][
+ sg_quota = self.limits_client.show_limits()['limits']['absolute'][
'totalSecurityGroupsUsed']
- quota_set =\
- self.adm_client.update_quota_set(self.demo_tenant_id,
- force=True,
- security_groups=sg_quota)
+ self.adm_client.update_quota_set(self.demo_tenant_id,
+ force=True,
+ security_groups=sg_quota)
self.addCleanup(self.adm_client.update_quota_set,
self.demo_tenant_id,
@@ -140,15 +143,14 @@
# Negative test: Creation of Security Group Rules should FAIL
# when we reach limit maxSecurityGroupRules
- quota_set = self.adm_client.show_quota_set(self.demo_tenant_id)
+ quota_set = (self.adm_client.show_quota_set(self.demo_tenant_id)
+ ['quota_set'])
default_sg_rules_quota = quota_set['security_group_rules']
sg_rules_quota = 0 # Set the quota to zero to conserve resources
- quota_set =\
- self.adm_client.update_quota_set(
- self.demo_tenant_id,
- force=True,
- security_group_rules=sg_rules_quota)
+ self.adm_client.update_quota_set(self.demo_tenant_id,
+ force=True,
+ security_group_rules=sg_rules_quota)
self.addCleanup(self.adm_client.update_quota_set,
self.demo_tenant_id,
@@ -156,9 +158,8 @@
s_name = data_utils.rand_name('securitygroup')
s_description = data_utils.rand_name('description')
- securitygroup =\
- self.sg_client.create_security_group(name=s_name,
- description=s_description)
+ securitygroup = self.sg_client.create_security_group(
+ name=s_name, description=s_description)['security_group']
self.addCleanup(self.sg_client.delete_security_group,
securitygroup['id'])
diff --git a/tempest/api/compute/admin/test_security_group_default_rules.py b/tempest/api/compute/admin/test_security_group_default_rules.py
index 5ae6553..74f3caa 100644
--- a/tempest/api/compute/admin/test_security_group_default_rules.py
+++ b/tempest/api/compute/admin/test_security_group_default_rules.py
@@ -48,7 +48,7 @@
ip_protocol=ip_protocol,
from_port=from_port,
to_port=to_port,
- cidr=cidr)
+ cidr=cidr)['security_group_default_rule']
self.assertEqual(ip_protocol, rule['ip_protocol'])
self.assertEqual(from_port, rule['from_port'])
self.assertEqual(to_port, rule['to_port'])
@@ -75,7 +75,7 @@
rule = self.adm_client.create_security_default_group_rule(
ip_protocol=ip_protocol,
from_port=from_port,
- to_port=to_port)
+ to_port=to_port)['security_group_default_rule']
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
self.assertNotEqual(0, rule['id'])
@@ -91,7 +91,7 @@
ip_protocol=ip_protocol,
from_port=from_port,
to_port=to_port,
- cidr=cidr)
+ cidr=cidr)['security_group_default_rule']
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
self.assertNotEqual(0, rule['id'])
@@ -109,7 +109,8 @@
cidr)
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
- rules = self.adm_client.list_security_group_default_rules()
+ rules = (self.adm_client.list_security_group_default_rules()
+ ['security_group_default_rules'])
self.assertNotEqual(0, len(rules))
self.assertIn(rule, rules)
@@ -126,5 +127,5 @@
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
fetched_rule = self.adm_client.show_security_group_default_rule(
- rule['id'])
+ rule['id'])['security_group_default_rule']
self.assertEqual(rule, fetched_rule)
diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py
index b2a1b98..b0a3086 100644
--- a/tempest/api/compute/admin/test_security_groups.py
+++ b/tempest/api/compute/admin/test_security_groups.py
@@ -50,9 +50,8 @@
for i in range(2):
name = data_utils.rand_name('securitygroup')
description = data_utils.rand_name('description')
- securitygroup = (self.client
- .create_security_group(name=name,
- description=description))
+ securitygroup = self.client.create_security_group(
+ name=name, description=description)['security_group']
self.addCleanup(self._delete_security_group,
securitygroup['id'], admin=False)
security_group_list.append(securitygroup)
@@ -63,13 +62,14 @@
name = data_utils.rand_name('securitygroup')
description = data_utils.rand_name('description')
adm_securitygroup = self.adm_client.create_security_group(
- name=name, description=description)
+ name=name, description=description)['security_group']
self.addCleanup(self._delete_security_group,
adm_securitygroup['id'])
security_group_list.append(adm_securitygroup)
# Fetch all security groups based on 'all_tenants' search filter
- fetched_list = self.adm_client.list_security_groups(all_tenants='true')
+ fetched_list = self.adm_client.list_security_groups(
+ all_tenants='true')['security_groups']
sec_group_id_list = map(lambda sg: sg['id'], fetched_list)
# Now check if all created Security Groups are present in fetched list
for sec_group in security_group_list:
@@ -77,7 +77,8 @@
# Fetch all security groups for non-admin user with 'all_tenants'
# search filter
- fetched_list = self.client.list_security_groups(all_tenants='true')
+ fetched_list = (self.client.list_security_groups(all_tenants='true')
+ ['security_groups'])
# Now check if all created Security Groups are present in fetched list
for sec_group in fetched_list:
self.assertEqual(sec_group['tenant_id'], client_tenant_id,
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index 1982eda..0528fa5 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -163,11 +163,11 @@
# resetting vm state require admin privilege
self.client.reset_state(self.s1_id, state='error')
- rebuilt_server = self.non_admin_client.rebuild(
+ rebuilt_server = self.non_admin_client.rebuild_server(
self.s1_id, self.image_ref_alt)
self.addCleanup(waiters.wait_for_server_status, self.non_admin_client,
self.s1_id, 'ACTIVE')
- self.addCleanup(self.non_admin_client.rebuild, self.s1_id,
+ self.addCleanup(self.non_admin_client.rebuild_server, self.s1_id,
self.image_ref)
# Verify the properties in the initial response are correct
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index 0241e70..c2dc94c 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -69,16 +69,18 @@
self.useFixture(fixtures.LockFixture('compute_quotas'))
flavor_name = data_utils.rand_name("flavor")
flavor_id = self._get_unused_flavor_id()
- quota_set = self.quotas_client.show_default_quota_set(self.tenant_id)
+ quota_set = (self.quotas_client.show_default_quota_set(self.tenant_id)
+ ['quota_set'])
ram = int(quota_set['ram']) + 1
vcpus = 8
disk = 10
flavor_ref = self.flavors_client.create_flavor(name=flavor_name,
ram=ram, vcpus=vcpus,
- disk=disk, id=flavor_id)
+ disk=disk,
+ id=flavor_id)['flavor']
self.addCleanup(self.flavors_client.delete_flavor, flavor_id)
self.assertRaises((lib_exc.Forbidden, lib_exc.OverLimit),
- self.client.resize,
+ self.client.resize_server,
self.servers[0]['id'],
flavor_ref['id'])
@@ -92,15 +94,17 @@
flavor_name = data_utils.rand_name("flavor")
flavor_id = self._get_unused_flavor_id()
ram = 512
- quota_set = self.quotas_client.show_default_quota_set(self.tenant_id)
+ quota_set = (self.quotas_client.show_default_quota_set(self.tenant_id)
+ ['quota_set'])
vcpus = int(quota_set['cores']) + 1
disk = 10
flavor_ref = self.flavors_client.create_flavor(name=flavor_name,
ram=ram, vcpus=vcpus,
- disk=disk, id=flavor_id)
+ disk=disk,
+ id=flavor_id)['flavor']
self.addCleanup(self.flavors_client.delete_flavor, flavor_id)
self.assertRaises((lib_exc.Forbidden, lib_exc.OverLimit),
- self.client.resize,
+ self.client.resize_server,
self.servers[0]['id'],
flavor_ref['id'])
diff --git a/tempest/api/compute/admin/test_services.py b/tempest/api/compute/admin/test_services.py
index db22925..4d7dea5 100644
--- a/tempest/api/compute/admin/test_services.py
+++ b/tempest/api/compute/admin/test_services.py
@@ -31,25 +31,25 @@
@test.idempotent_id('5be41ef4-53d1-41cc-8839-5c2a48a1b283')
def test_list_services(self):
- services = self.client.list_services()
+ services = self.client.list_services()['services']
self.assertNotEqual(0, len(services))
@test.idempotent_id('f345b1ec-bc6e-4c38-a527-3ca2bc00bef5')
def test_get_service_by_service_binary_name(self):
binary_name = 'nova-compute'
- services = self.client.list_services(binary=binary_name)
+ services = self.client.list_services(binary=binary_name)['services']
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(binary_name, service['binary'])
@test.idempotent_id('affb42d5-5b4b-43c8-8b0b-6dca054abcca')
def test_get_service_by_host_name(self):
- services = self.client.list_services()
+ services = self.client.list_services()['services']
host_name = services[0]['host']
services_on_host = [service for service in services if
service['host'] == host_name]
- services = self.client.list_services(host=host_name)
+ services = self.client.list_services(host=host_name)['services']
# we could have a periodic job checkin between the 2 service
# lookups, so only compare binary lists.
@@ -62,12 +62,12 @@
@test.idempotent_id('39397f6f-37b8-4234-8671-281e44c74025')
def test_get_service_by_service_and_host_name(self):
- services = self.client.list_services()
+ services = self.client.list_services()['services']
host_name = services[0]['host']
binary_name = services[0]['binary']
services = self.client.list_services(host=host_name,
- binary=binary_name)
+ binary=binary_name)['services']
self.assertEqual(1, len(services))
self.assertEqual(host_name, services[0]['host'])
self.assertEqual(binary_name, services[0]['binary'])
diff --git a/tempest/api/compute/admin/test_services_negative.py b/tempest/api/compute/admin/test_services_negative.py
index b9335c9..0c81ccb 100644
--- a/tempest/api/compute/admin/test_services_negative.py
+++ b/tempest/api/compute/admin/test_services_negative.py
@@ -40,22 +40,25 @@
@test.idempotent_id('d0884a69-f693-4e79-a9af-232d15643bf7')
def test_get_service_by_invalid_params(self):
# return all services if send the request with invalid parameter
- services = self.client.list_services()
- services_xxx = self.client.list_services(xxx='nova-compute')
+ services = self.client.list_services()['services']
+ services_xxx = (self.client.list_services(xxx='nova-compute')
+ ['services'])
self.assertEqual(len(services), len(services_xxx))
@test.attr(type=['negative'])
@test.idempotent_id('1e966d4a-226e-47c7-b601-0b18a27add54')
def test_get_service_by_invalid_service_and_valid_host(self):
- services = self.client.list_services()
+ services = self.client.list_services()['services']
host_name = services[0]['host']
- services = self.client.list_services(host=host_name, binary='xxx')
+ services = self.client.list_services(host=host_name,
+ binary='xxx')['services']
self.assertEqual(0, len(services))
@test.attr(type=['negative'])
@test.idempotent_id('64e7e7fb-69e8-4cb6-a71d-8d5eb0c98655')
def test_get_service_with_valid_service_and_invalid_host(self):
- services = self.client.list_services()
+ services = self.client.list_services()['services']
binary_name = services[0]['binary']
- services = self.client.list_services(host='xxx', binary=binary_name)
+ services = self.client.list_services(host='xxx',
+ binary=binary_name)['services']
self.assertEqual(0, len(services))
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage.py b/tempest/api/compute/admin/test_simple_tenant_usage.py
index 204281c..7333acb 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage.py
@@ -50,14 +50,14 @@
def test_list_usage_all_tenants(self):
# Get usage for all tenants
tenant_usage = self.adm_client.list_tenant_usages(
- start=self.start, end=self.end, detailed="1")
+ start=self.start, end=self.end, detailed="1")['tenant_usages'][0]
self.assertEqual(len(tenant_usage), 8)
@test.idempotent_id('94135049-a4c5-4934-ad39-08fa7da4f22e')
def test_get_usage_tenant(self):
# Get usage for a specific tenant
tenant_usage = self.adm_client.show_tenant_usage(
- self.tenant_id, start=self.start, end=self.end)
+ self.tenant_id, start=self.start, end=self.end)['tenant_usage']
self.assertEqual(len(tenant_usage), 8)
@@ -65,6 +65,6 @@
def test_get_usage_tenant_with_non_admin_user(self):
# Get usage for a specific tenant with non admin user
tenant_usage = self.client.show_tenant_usage(
- self.tenant_id, start=self.start, end=self.end)
+ self.tenant_id, start=self.start, end=self.end)['tenant_usage']
self.assertEqual(len(tenant_usage), 8)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 62dea4d..1f53f9a 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -43,6 +43,8 @@
@classmethod
def skip_checks(cls):
super(BaseComputeTest, cls).skip_checks()
+ if not CONF.service_available.nova:
+ raise cls.skipException("Nova is not available")
if cls._api_version != 2:
msg = ("Unexpected API version is specified (%s)" %
cls._api_version)
@@ -86,6 +88,7 @@
cls.migrations_client = cls.os.migrations_client
cls.security_group_default_rules_client = (
cls.os.security_group_default_rules_client)
+ cls.versions_client = cls.os.compute_versions_client
if CONF.volume_feature_enabled.api_v1:
cls.volumes_client = cls.os.volumes_client
@@ -133,7 +136,8 @@
for server in cls.servers:
try:
- cls.servers_client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(cls.servers_client,
+ server['id'])
except Exception:
LOG.exception('Waiting for deletion of server %s failed'
% server['id'])
@@ -154,7 +158,8 @@
except Exception as exc:
LOG.exception(exc)
cls.servers_client.delete_server(cls.server_id)
- cls.servers_client.wait_for_server_termination(cls.server_id)
+ waiters.wait_for_server_termination(cls.servers_client,
+ cls.server_id)
cls.server_id = None
raise
@@ -225,9 +230,8 @@
name = data_utils.rand_name(cls.__name__ + "-securitygroup")
if description is None:
description = data_utils.rand_name('description')
- body = \
- cls.security_groups_client.create_security_group(
- name=name, description=description)
+ body = cls.security_groups_client.create_security_group(
+ name=name, description=description)['security_group']
cls.security_groups.append(body)
return body
@@ -238,7 +242,8 @@
name = data_utils.rand_name(cls.__name__ + "-Server-Group")
if policy is None:
policy = ['affinity']
- body = cls.server_groups_client.create_server_group(name, policy)
+ body = (cls.server_groups_client.create_server_group(name, policy)
+ ['server_group'])
cls.server_groups.append(body['id'])
return body
@@ -290,7 +295,7 @@
if 'wait_until' in kwargs:
waiters.wait_for_image_status(cls.images_client,
image_id, kwargs['wait_until'])
- image = cls.images_client.show_image(image_id)
+ image = cls.images_client.show_image(image_id)['image']
if kwargs['wait_until'] == 'ACTIVE':
if kwargs.get('wait_for_server', True):
@@ -304,7 +309,8 @@
if server_id:
try:
cls.servers_client.delete_server(server_id)
- cls.servers_client.wait_for_server_termination(server_id)
+ waiters.wait_for_server_termination(cls.servers_client,
+ server_id)
except Exception:
LOG.exception('Failed to delete server %s' % server_id)
@@ -320,7 +326,8 @@
"""Deletes an existing server and waits for it to be gone."""
try:
cls.servers_client.delete_server(server_id)
- cls.servers_client.wait_for_server_termination(server_id)
+ waiters.wait_for_server_termination(cls.servers_client,
+ server_id)
except Exception:
LOG.exception('Failed to delete server %s' % server_id)
diff --git a/tempest/api/compute/certificates/test_certificates.py b/tempest/api/compute/certificates/test_certificates.py
index 5f68786..78a0a93 100644
--- a/tempest/api/compute/certificates/test_certificates.py
+++ b/tempest/api/compute/certificates/test_certificates.py
@@ -24,13 +24,14 @@
@test.idempotent_id('c070a441-b08e-447e-a733-905909535b1b')
def test_create_root_certificate(self):
# create certificates
- body = self.certificates_client.create_certificate()
+ body = self.certificates_client.create_certificate()['certificate']
self.assertIn('data', body)
self.assertIn('private_key', body)
@test.idempotent_id('3ac273d0-92d2-4632-bdfc-afbc21d4606c')
def test_get_root_certificate(self):
# get the root certificate
- body = self.certificates_client.show_certificate('root')
+ body = (self.certificates_client.show_certificate('root')
+ ['certificate'])
self.assertIn('data', body)
self.assertIn('private_key', body)
diff --git a/tempest/api/compute/flavors/test_flavors.py b/tempest/api/compute/flavors/test_flavors.py
index 728fefb..e114c80 100644
--- a/tempest/api/compute/flavors/test_flavors.py
+++ b/tempest/api/compute/flavors/test_flavors.py
@@ -32,8 +32,8 @@
@test.idempotent_id('e36c0eaa-dff5-4082-ad1f-3f9a80aa3f59')
def test_list_flavors(self):
# List of all flavors should contain the expected flavor
- flavors = self.client.list_flavors()
- flavor = self.client.show_flavor(self.flavor_ref)
+ flavors = self.client.list_flavors()['flavors']
+ flavor = self.client.show_flavor(self.flavor_ref)['flavor']
flavor_min_detail = {'id': flavor['id'], 'links': flavor['links'],
'name': flavor['name']}
self.assertIn(flavor_min_detail, flavors)
@@ -41,89 +41,89 @@
@test.idempotent_id('6e85fde4-b3cd-4137-ab72-ed5f418e8c24')
def test_list_flavors_with_detail(self):
# Detailed list of all flavors should contain the expected flavor
- flavors = self.client.list_flavors(detail=True)
- flavor = self.client.show_flavor(self.flavor_ref)
+ flavors = self.client.list_flavors(detail=True)['flavors']
+ flavor = self.client.show_flavor(self.flavor_ref)['flavor']
self.assertIn(flavor, flavors)
@test.attr(type='smoke')
@test.idempotent_id('1f12046b-753d-40d2-abb6-d8eb8b30cb2f')
def test_get_flavor(self):
# The expected flavor details should be returned
- flavor = self.client.show_flavor(self.flavor_ref)
+ flavor = self.client.show_flavor(self.flavor_ref)['flavor']
self.assertEqual(self.flavor_ref, flavor['id'])
@test.idempotent_id('8d7691b3-6ed4-411a-abc9-2839a765adab')
def test_list_flavors_limit_results(self):
# Only the expected number of flavors should be returned
params = {'limit': 1}
- flavors = self.client.list_flavors(**params)
+ flavors = self.client.list_flavors(**params)['flavors']
self.assertEqual(1, len(flavors))
@test.idempotent_id('b26f6327-2886-467a-82be-cef7a27709cb')
def test_list_flavors_detailed_limit_results(self):
# Only the expected number of flavors (detailed) should be returned
params = {'limit': 1}
- flavors = self.client.list_flavors(detail=True, **params)
+ flavors = self.client.list_flavors(detail=True, **params)['flavors']
self.assertEqual(1, len(flavors))
@test.idempotent_id('e800f879-9828-4bd0-8eae-4f17189951fb')
def test_list_flavors_using_marker(self):
# The list of flavors should start from the provided marker
- flavor = self.client.show_flavor(self.flavor_ref)
+ flavor = self.client.show_flavor(self.flavor_ref)['flavor']
flavor_id = flavor['id']
params = {'marker': flavor_id}
- flavors = self.client.list_flavors(**params)
+ flavors = self.client.list_flavors(**params)['flavors']
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]),
'The list of flavors did not start after the marker.')
@test.idempotent_id('6db2f0c0-ddee-4162-9c84-0703d3dd1107')
def test_list_flavors_detailed_using_marker(self):
# The list of flavors should start from the provided marker
- flavor = self.client.show_flavor(self.flavor_ref)
+ flavor = self.client.show_flavor(self.flavor_ref)['flavor']
flavor_id = flavor['id']
params = {'marker': flavor_id}
- flavors = self.client.list_flavors(detail=True, **params)
+ flavors = self.client.list_flavors(detail=True, **params)['flavors']
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]),
'The list of flavors did not start after the marker.')
@test.idempotent_id('3df2743e-3034-4e57-a4cb-b6527f6eac79')
def test_list_flavors_detailed_filter_by_min_disk(self):
# The detailed list of flavors should be filtered by disk space
- flavor = self.client.show_flavor(self.flavor_ref)
+ flavor = self.client.show_flavor(self.flavor_ref)['flavor']
flavor_id = flavor['id']
params = {self._min_disk: flavor['disk'] + 1}
- flavors = self.client.list_flavors(detail=True, **params)
+ flavors = self.client.list_flavors(detail=True, **params)['flavors']
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
@test.idempotent_id('09fe7509-b4ee-4b34-bf8b-39532dc47292')
def test_list_flavors_detailed_filter_by_min_ram(self):
# The detailed list of flavors should be filtered by RAM
- flavor = self.client.show_flavor(self.flavor_ref)
+ flavor = self.client.show_flavor(self.flavor_ref)['flavor']
flavor_id = flavor['id']
params = {self._min_ram: flavor['ram'] + 1}
- flavors = self.client.list_flavors(detail=True, **params)
+ flavors = self.client.list_flavors(detail=True, **params)['flavors']
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
@test.idempotent_id('10645a4d-96f5-443f-831b-730711e11dd4')
def test_list_flavors_filter_by_min_disk(self):
# The list of flavors should be filtered by disk space
- flavor = self.client.show_flavor(self.flavor_ref)
+ flavor = self.client.show_flavor(self.flavor_ref)['flavor']
flavor_id = flavor['id']
params = {self._min_disk: flavor['disk'] + 1}
- flavors = self.client.list_flavors(**params)
+ flavors = self.client.list_flavors(**params)['flavors']
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
@test.idempotent_id('935cf550-e7c8-4da6-8002-00f92d5edfaa')
def test_list_flavors_filter_by_min_ram(self):
# The list of flavors should be filtered by RAM
- flavor = self.client.show_flavor(self.flavor_ref)
+ flavor = self.client.show_flavor(self.flavor_ref)['flavor']
flavor_id = flavor['id']
params = {self._min_ram: flavor['ram'] + 1}
- flavors = self.client.list_flavors(**params)
+ flavors = self.client.list_flavors(**params)['flavors']
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index 8bb4fac..5b90641 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -39,7 +39,7 @@
server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
# Floating IP creation
- body = cls.client.create_floating_ip()
+ body = cls.client.create_floating_ip()['floating_ip']
cls.floating_ip_id = body['id']
cls.floating_ip = body['ip']
@@ -63,14 +63,14 @@
def test_allocate_floating_ip(self):
# Positive test:Allocation of a new floating IP to a project
# should be successful
- body = self.client.create_floating_ip()
+ body = self.client.create_floating_ip()['floating_ip']
floating_ip_id_allocated = body['id']
self.addCleanup(self.client.delete_floating_ip,
floating_ip_id_allocated)
- floating_ip_details = \
- self.client.show_floating_ip(floating_ip_id_allocated)
+ floating_ip_details = self.client.show_floating_ip(
+ floating_ip_id_allocated)['floating_ip']
# Checking if the details of allocated IP is in list of floating IP
- body = self.client.list_floating_ips()
+ body = self.client.list_floating_ips()['floating_ips']
self.assertIn(floating_ip_details, body)
@test.idempotent_id('de45e989-b5ca-4a9b-916b-04a52e7bbb8b')
@@ -79,7 +79,7 @@
# Positive test:Deletion of valid floating IP from project
# should be successful
# Creating the floating IP that is to be deleted in this method
- floating_ip_body = self.client.create_floating_ip()
+ floating_ip_body = self.client.create_floating_ip()['floating_ip']
self.addCleanup(self._try_delete_floating_ip, floating_ip_body['id'])
# Deleting the floating IP from the project
self.client.delete_floating_ip(floating_ip_body['id'])
@@ -98,7 +98,8 @@
self.server_id)
# Check instance_id in the floating_ip body
- body = self.client.show_floating_ip(self.floating_ip_id)
+ body = (self.client.show_floating_ip(self.floating_ip_id)
+ ['floating_ip'])
self.assertEqual(self.server_id, body['instance_id'])
# Disassociation of floating IP that was associated in this method
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
index c07af72..64aac80 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
@@ -42,7 +42,7 @@
cls.server_id = server['id']
# Generating a nonexistent floatingIP id
cls.floating_ip_ids = []
- body = cls.client.list_floating_ips()
+ body = cls.client.list_floating_ips()['floating_ips']
for i in range(len(body)):
cls.floating_ip_ids.append(body[i]['id'])
while True:
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index d26a5e5..d003967 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -31,7 +31,7 @@
cls.floating_ip = []
cls.floating_ip_id = []
for i in range(3):
- body = cls.client.create_floating_ip()
+ body = cls.client.create_floating_ip()['floating_ip']
cls.floating_ip.append(body)
cls.floating_ip_id.append(body['id'])
@@ -45,7 +45,7 @@
@test.services('network')
def test_list_floating_ips(self):
# Positive test:Should return the list of floating IPs
- body = self.client.list_floating_ips()
+ body = self.client.list_floating_ips()['floating_ips']
floating_ips = body
self.assertNotEqual(0, len(floating_ips),
"Expected floating IPs. Got zero.")
@@ -57,14 +57,14 @@
def test_get_floating_ip_details(self):
# Positive test:Should be able to GET the details of floatingIP
# Creating a floating IP for which details are to be checked
- body = self.client.create_floating_ip()
+ body = self.client.create_floating_ip()['floating_ip']
floating_ip_id = body['id']
self.addCleanup(self.client.delete_floating_ip,
floating_ip_id)
floating_ip_instance_id = body['instance_id']
floating_ip_ip = body['ip']
floating_ip_fixed_ip = body['fixed_ip']
- body = self.client.show_floating_ip(floating_ip_id)
+ body = self.client.show_floating_ip(floating_ip_id)['floating_ip']
# Comparing the details of floating IP
self.assertEqual(floating_ip_instance_id,
body['instance_id'])
@@ -78,5 +78,5 @@
def test_list_floating_ip_pools(self):
# Positive test:Should return the list of floating IP Pools
floating_ip_pools = self.pools_client.list_floating_ip_pools()
- self.assertNotEqual(0, len(floating_ip_pools),
+ self.assertNotEqual(0, len(floating_ip_pools['floating_ip_pools']),
"Expected floating IP Pools. Got zero.")
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index ab82d91..975b850 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -48,7 +48,7 @@
body = cls.glance_client.create_image(name=name,
container_format='bare',
disk_format='raw',
- is_public=False)
+ is_public=False)['image']
cls.image_id = body['id']
cls.images.append(cls.image_id)
image_file = six.StringIO(('*' * 1024))
@@ -64,7 +64,8 @@
def test_list_image_metadata(self):
# All metadata key/value pairs for an image should be returned
resp_metadata = self.client.list_image_metadata(self.image_id)
- expected = {'os_version': 'value1', 'os_distro': 'value2'}
+ expected = {'metadata': {
+ 'os_version': 'value1', 'os_distro': 'value2'}}
self.assertEqual(expected, resp_metadata)
@test.idempotent_id('ece7befc-d3ce-42a4-b4be-c3067a418c29')
@@ -74,7 +75,8 @@
self.client.set_image_metadata(self.image_id,
req_metadata)
- resp_metadata = self.client.list_image_metadata(self.image_id)
+ resp_metadata = (self.client.list_image_metadata(self.image_id)
+ ['metadata'])
self.assertEqual(req_metadata, resp_metadata)
@test.idempotent_id('7b491c11-a9d5-40fe-a696-7f7e03d3fea2')
@@ -85,16 +87,17 @@
req_metadata)
resp_metadata = self.client.list_image_metadata(self.image_id)
- expected = {'os_version': 'alt1',
- 'os_distro': 'value2',
- 'architecture': 'value3'}
+ expected = {'metadata': {
+ 'os_version': 'alt1',
+ 'os_distro': 'value2',
+ 'architecture': 'value3'}}
self.assertEqual(expected, resp_metadata)
@test.idempotent_id('4f5db52f-6685-4c75-b848-f4bb363f9aa6')
def test_get_image_metadata_item(self):
# The value for a specific metadata key should be returned
meta = self.client.show_image_metadata_item(self.image_id,
- 'os_distro')
+ 'os_distro')['meta']
self.assertEqual('value2', meta['os_distro'])
@test.idempotent_id('f2de776a-4778-4d90-a5da-aae63aee64ae')
@@ -105,7 +108,7 @@
self.client.set_image_metadata_item(self.image_id,
'os_version', meta)
resp_metadata = self.client.list_image_metadata(self.image_id)
- expected = {'os_version': 'alt', 'os_distro': 'value2'}
+ expected = {'metadata': {'os_version': 'alt', 'os_distro': 'value2'}}
self.assertEqual(expected, resp_metadata)
@test.idempotent_id('a013796c-ba37-4bb5-8602-d944511def14')
@@ -114,5 +117,5 @@
self.client.delete_image_metadata_item(self.image_id,
'os_version')
resp_metadata = self.client.list_image_metadata(self.image_id)
- expected = {'os_distro': 'value2'}
+ expected = {'metadata': {'os_distro': 'value2'}}
self.assertEqual(expected, resp_metadata)
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index 84a8258..126d092 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -50,7 +50,7 @@
# Delete server before trying to create server
self.servers_client.delete_server(server['id'])
- self.servers_client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.servers_client, server['id'])
# Create a new image after server is deleted
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
@@ -74,7 +74,7 @@
@test.idempotent_id('aaacd1d0-55a2-4ce8-818a-b5439df8adc9')
def test_create_image_from_stopped_server(self):
server = self.create_test_server(wait_until='ACTIVE')
- self.servers_client.stop(server['id'])
+ self.servers_client.stop_server(server['id'])
waiters.wait_for_server_status(self.servers_client,
server['id'], 'SHUTOFF')
self.addCleanup(self.servers_client.delete_server, server['id'])
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 06b7cac..37c2bb6 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -71,7 +71,7 @@
cls.server_id = server['id']
def _get_default_flavor_disk_size(self, flavor_id):
- flavor = self.flavors_client.show_flavor(flavor_id)
+ flavor = self.flavors_client.show_flavor(flavor_id)['flavor']
return flavor['disk']
@test.idempotent_id('3731d080-d4c5-4872-b41a-64d0d0021314')
@@ -86,11 +86,11 @@
waiters.wait_for_image_status(self.client, image_id, 'ACTIVE')
# Verify the image was created correctly
- image = self.client.show_image(image_id)
+ image = self.client.show_image(image_id)['image']
self.assertEqual(name, image['name'])
self.assertEqual('test', image['metadata']['image_type'])
- original_image = self.client.show_image(self.image_ref)
+ original_image = self.client.show_image(self.image_ref)['image']
# Verify minRAM is the same as the original image
self.assertEqual(image['minRam'], original_image['minRam'])
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index 2c0ce59..9f3ba71 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -54,7 +54,7 @@
body = cls.glance_client.create_image(name=name,
container_format='bare',
disk_format='raw',
- is_public=False)
+ is_public=False)['image']
image_id = body['id']
cls.images.append(image_id)
# Wait 1 second between creation and upload to ensure a delta
@@ -63,7 +63,7 @@
image_file = six.StringIO(('*' * 1024))
cls.glance_client.update_image(image_id, data=image_file)
waiters.wait_for_image_status(cls.client, image_id, 'ACTIVE')
- body = cls.client.show_image(image_id)
+ body = cls.client.show_image(image_id)['image']
return body
# Create non-snapshot images via glance
@@ -106,7 +106,7 @@
# The list of images should contain only images with the
# provided status
params = {'status': 'ACTIVE'}
- images = self.client.list_images(**params)
+ images = self.client.list_images(**params)['images']
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertTrue(any([i for i in images if i['id'] == self.image2_id]))
@@ -117,7 +117,7 @@
# List of all images should contain the expected images filtered
# by name
params = {'name': self.image1['name']}
- images = self.client.list_images(**params)
+ images = self.client.list_images(**params)['images']
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertFalse(any([i for i in images if i['id'] == self.image2_id]))
@@ -129,7 +129,7 @@
def test_list_images_filter_by_server_id(self):
# The images should contain images filtered by server id
params = {'server': self.server1['id']}
- images = self.client.list_images(**params)
+ images = self.client.list_images(**params)['images']
self.assertTrue(any([i for i in images
if i['id'] == self.snapshot1_id]),
@@ -150,7 +150,7 @@
# Try all server link types
for link in server_links:
params = {'server': link['href']}
- images = self.client.list_images(**params)
+ images = self.client.list_images(**params)['images']
self.assertFalse(any([i for i in images
if i['id'] == self.snapshot1_id]))
@@ -165,7 +165,7 @@
def test_list_images_filter_by_type(self):
# The list of servers should be filtered by image type
params = {'type': 'snapshot'}
- images = self.client.list_images(**params)
+ images = self.client.list_images(**params)['images']
self.assertTrue(any([i for i in images
if i['id'] == self.snapshot1_id]))
@@ -180,7 +180,7 @@
def test_list_images_limit_results(self):
# Verify only the expected number of results are returned
params = {'limit': '1'}
- images = self.client.list_images(**params)
+ images = self.client.list_images(**params)['images']
self.assertEqual(1, len([x for x in images if 'id' in x]))
@test.idempotent_id('18bac3ae-da27-436c-92a9-b22474d13aab')
@@ -190,7 +190,7 @@
# Becoming ACTIVE will modify the updated time
# Filter by the image's created time
params = {'changes-since': self.image3['created']}
- images = self.client.list_images(**params)
+ images = self.client.list_images(**params)['images']
found = any([i for i in images if i['id'] == self.image3_id])
self.assertTrue(found)
@@ -199,7 +199,7 @@
# Detailed list of all images should only contain images
# with the provided status
params = {'status': 'ACTIVE'}
- images = self.client.list_images(detail=True, **params)
+ images = self.client.list_images(detail=True, **params)['images']
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertTrue(any([i for i in images if i['id'] == self.image2_id]))
@@ -210,7 +210,7 @@
# Detailed list of all images should contain the expected
# images filtered by name
params = {'name': self.image1['name']}
- images = self.client.list_images(detail=True, **params)
+ images = self.client.list_images(detail=True, **params)['images']
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertFalse(any([i for i in images if i['id'] == self.image2_id]))
@@ -221,7 +221,7 @@
# Verify only the expected number of results (with full details)
# are returned
params = {'limit': '1'}
- images = self.client.list_images(detail=True, **params)
+ images = self.client.list_images(detail=True, **params)['images']
self.assertEqual(1, len(images))
@test.idempotent_id('8c78f822-203b-4bf6-8bba-56ebd551cf84')
@@ -234,7 +234,7 @@
# Try all server link types
for link in server_links:
params = {'server': link['href']}
- images = self.client.list_images(detail=True, **params)
+ images = self.client.list_images(detail=True, **params)['images']
self.assertFalse(any([i for i in images
if i['id'] == self.snapshot1_id]))
@@ -249,7 +249,7 @@
def test_list_images_with_detail_filter_by_type(self):
# The detailed list of servers should be filtered by image type
params = {'type': 'snapshot'}
- images = self.client.list_images(detail=True, **params)
+ images = self.client.list_images(detail=True, **params)['images']
self.client.show_image(self.image_ref)
self.assertTrue(any([i for i in images
@@ -268,5 +268,5 @@
# Becoming ACTIVE will modify the updated time
# Filter by the image's created time
params = {'changes-since': self.image1['created']}
- images = self.client.list_images(detail=True, **params)
+ images = self.client.list_images(detail=True, **params)['images']
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
diff --git a/tempest/api/compute/images/test_list_images.py b/tempest/api/compute/images/test_list_images.py
index b67378c..6ca15d6 100644
--- a/tempest/api/compute/images/test_list_images.py
+++ b/tempest/api/compute/images/test_list_images.py
@@ -37,19 +37,19 @@
@test.idempotent_id('490d0898-e12a-463f-aef0-c50156b9f789')
def test_get_image(self):
# Returns the correct details for a single image
- image = self.client.show_image(self.image_ref)
+ image = self.client.show_image(self.image_ref)['image']
self.assertEqual(self.image_ref, image['id'])
@test.idempotent_id('fd51b7f4-d4a3-4331-9885-866658112a6f')
def test_list_images(self):
# The list of all images should contain the image
- images = self.client.list_images()
+ images = self.client.list_images()['images']
found = any([i for i in images if i['id'] == self.image_ref])
self.assertTrue(found)
@test.idempotent_id('9f94cb6b-7f10-48c5-b911-a0b84d7d4cd6')
def test_list_images_with_detail(self):
# Detailed list of all images should contain the expected images
- images = self.client.list_images(detail=True)
+ images = self.client.list_images(detail=True)['images']
found = any([i for i in images if i['id'] == self.image_ref])
self.assertTrue(found)
diff --git a/tempest/api/compute/keypairs/base.py b/tempest/api/compute/keypairs/base.py
index b742c8c..76e5573 100644
--- a/tempest/api/compute/keypairs/base.py
+++ b/tempest/api/compute/keypairs/base.py
@@ -33,6 +33,6 @@
kwargs = {'name': keypair_name}
if pub_key:
kwargs.update({'public_key': pub_key})
- body = self.client.create_keypair(**kwargs)
+ body = self.client.create_keypair(**kwargs)['keypair']
self.addCleanup(self._delete_keypair, keypair_name)
return body
diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 225af12..d10bf14 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -34,9 +34,7 @@
key_list.append(keypair)
# Fetch all keypairs and verify the list
# has all created keypairs
- fetched_list = self.client.list_keypairs()
- # We need to remove the extra 'keypair' element in the
- # returned dict. See comment in keypairs_client.list_keypairs()
+ fetched_list = self.client.list_keypairs()['keypairs']
new_list = list()
for keypair in fetched_list:
new_list.append(keypair['keypair'])
@@ -65,7 +63,7 @@
# Keypair should be created, Got details by name and deleted
k_name = data_utils.rand_name('keypair')
self._create_keypair(k_name)
- keypair_detail = self.client.show_keypair(k_name)
+ keypair_detail = self.client.show_keypair(k_name)['keypair']
self.assertIn('name', keypair_detail)
self.assertIn('public_key', keypair_detail)
self.assertEqual(keypair_detail['name'], k_name,
diff --git a/tempest/api/compute/limits/test_absolute_limits.py b/tempest/api/compute/limits/test_absolute_limits.py
index 0029bb9..69811f4 100644
--- a/tempest/api/compute/limits/test_absolute_limits.py
+++ b/tempest/api/compute/limits/test_absolute_limits.py
@@ -27,7 +27,7 @@
@test.idempotent_id('b54c66af-6ab6-4cf0-a9e5-a0cb58d75e0b')
def test_absLimits_get(self):
# To check if all limits are present in the response
- limits = self.client.show_limits()
+ limits = self.client.show_limits()['limits']
absolute_limits = limits['absolute']
expected_elements = ['maxImageMeta', 'maxPersonality',
'maxPersonalitySize',
diff --git a/tempest/api/compute/limits/test_absolute_limits_negative.py b/tempest/api/compute/limits/test_absolute_limits_negative.py
index cbd2004..5755f5b 100644
--- a/tempest/api/compute/limits/test_absolute_limits_negative.py
+++ b/tempest/api/compute/limits/test_absolute_limits_negative.py
@@ -38,7 +38,7 @@
def test_max_image_meta_exceed_limit(self):
# We should not create vm with image meta over maxImageMeta limit
# Get max limit value
- limits = self.client.show_limits()
+ limits = self.client.show_limits()['limits']
max_meta = limits['absolute']['maxImageMeta']
# No point in running this test if there is no limit.
diff --git a/tempest/api/compute/security_groups/test_security_group_rules.py b/tempest/api/compute/security_groups/test_security_group_rules.py
index b5eff70..3c22d28 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -73,7 +73,7 @@
parent_group_id=securitygroup_id,
ip_protocol=self.ip_protocol,
from_port=self.from_port,
- to_port=self.to_port)
+ to_port=self.to_port)['security_group_rule']
self.expected['parent_group_id'] = securitygroup_id
self.expected['ip_range'] = {'cidr': '0.0.0.0/0'}
self._check_expected_response(rule)
@@ -96,7 +96,7 @@
ip_protocol=self.ip_protocol,
from_port=self.from_port,
to_port=self.to_port,
- cidr=cidr)
+ cidr=cidr)['security_group_rule']
self.expected['parent_group_id'] = parent_group_id
self.expected['ip_range'] = {'cidr': cidr}
self._check_expected_response(rule)
@@ -123,7 +123,7 @@
ip_protocol=self.ip_protocol,
from_port=self.from_port,
to_port=self.to_port,
- group_id=group_id)
+ group_id=group_id)['security_group_rule']
self.expected['parent_group_id'] = parent_group_id
self.expected['group'] = {'tenant_id': self.client.tenant_id,
'name': group_name}
@@ -144,7 +144,7 @@
parent_group_id=securitygroup_id,
ip_protocol=self.ip_protocol,
from_port=self.from_port,
- to_port=self.to_port)
+ to_port=self.to_port)['security_group_rule']
rule1_id = rule['id']
# Add a second rule to the created Security Group
@@ -155,14 +155,14 @@
parent_group_id=securitygroup_id,
ip_protocol=ip_protocol2,
from_port=from_port2,
- to_port=to_port2)
+ to_port=to_port2)['security_group_rule']
rule2_id = rule['id']
# Delete the Security Group rule2 at the end of this method
self.addCleanup(self.client.delete_security_group_rule, rule2_id)
# Get rules of the created Security Group
- rules = \
- self.client.list_security_group_rules(securitygroup_id)
+ rules = (self.client.list_security_group_rules(securitygroup_id)
+ ['rules'])
self.assertTrue(any([i for i in rules if i['id'] == rule1_id]))
self.assertTrue(any([i for i in rules if i['id'] == rule2_id]))
@@ -182,12 +182,11 @@
ip_protocol=self.ip_protocol,
from_port=self.from_port,
to_port=self.to_port,
- group_id=sg2_id)
+ group_id=sg2_id)['security_group_rule']
# Delete group2
self.security_groups_client.delete_security_group(sg2_id)
# Get rules of the Group1
- rules = \
- self.client.list_security_group_rules(sg1_id)
+ rules = self.client.list_security_group_rules(sg1_id)['rules']
# The group1 has no rules because group2 has deleted
self.assertEqual(0, len(rules))
diff --git a/tempest/api/compute/security_groups/test_security_group_rules_negative.py b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
index d12306a..816038a 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules_negative.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
@@ -87,7 +87,7 @@
rule = self.rules_client.create_security_group_rule(
parent_group_id=parent_group_id, ip_protocol=ip_protocol,
- from_port=from_port, to_port=to_port)
+ from_port=from_port, to_port=to_port)['security_group_rule']
self.addCleanup(self.rules_client.delete_security_group_rule,
rule['id'])
# Add the same rule to the group should fail
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index bd252b0..dbbeb70 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -40,7 +40,7 @@
security_group_list.append(body)
# Fetch all Security Groups and verify the list
# has all created Security Groups
- fetched_list = self.client.list_security_groups()
+ fetched_list = self.client.list_security_groups()['security_groups']
# Now check if all the created Security Groups are in fetched list
missing_sgs = \
[sg for sg in security_group_list if sg not in fetched_list]
@@ -53,7 +53,7 @@
self.client.delete_security_group(sg['id'])
self.client.wait_for_resource_deletion(sg['id'])
# Now check if all the created Security Groups are deleted
- fetched_list = self.client.list_security_groups()
+ fetched_list = self.client.list_security_groups()['security_groups']
deleted_sgs = \
[sg for sg in security_group_list if sg in fetched_list]
self.assertFalse(deleted_sgs,
@@ -75,8 +75,8 @@
"The created Security Group name is "
"not equal to the requested name")
# Now fetch the created Security Group by its 'id'
- fetched_group = \
- self.client.show_security_group(securitygroup['id'])
+ fetched_group = (self.client.show_security_group(securitygroup['id'])
+ ['security_group'])
self.assertEqual(securitygroup, fetched_group,
"The fetched Security Group is different "
"from the created Group")
@@ -109,7 +109,7 @@
sg['id'])
# Reboot and add the other security group
- self.servers_client.reboot(server_id, 'HARD')
+ self.servers_client.reboot_server(server_id, 'HARD')
waiters.wait_for_server_status(self.servers_client, server_id,
'ACTIVE')
self.servers_client.add_security_group(server_id, sg2['name'])
@@ -123,7 +123,7 @@
# Shutdown the server and then verify we can destroy the
# security groups, since no active server instance is using them
self.servers_client.delete_server(server_id)
- self.servers_client.wait_for_server_termination(server_id)
+ waiters.wait_for_server_termination(self.servers_client, server_id)
self.client.delete_security_group(sg['id'])
self.client.delete_security_group(sg2['id'])
@@ -143,7 +143,7 @@
name=s_new_name,
description=s_new_des)
# get the security group
- fetched_group = \
- self.client.show_security_group(securitygroup_id)
+ fetched_group = (self.client.show_security_group(securitygroup_id)
+ ['security_group'])
self.assertEqual(s_new_name, fetched_group['name'])
self.assertEqual(s_new_des, fetched_group['description'])
diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py
index 642aca1..120d327 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -39,7 +39,7 @@
def _generate_a_non_existent_security_group_id(self):
security_group_id = []
- body = self.client.list_security_groups()
+ body = self.client.list_security_groups()['security_groups']
for i in range(len(body)):
security_group_id.append(body[i]['id'])
# Generate a non-existent security group id
@@ -122,7 +122,7 @@
def test_delete_the_default_security_group(self):
# Negative test:Deletion of the "default" Security Group should Fail
default_security_group_id = None
- body = self.client.list_security_groups()
+ body = self.client.list_security_groups()['security_groups']
for i in range(len(body)):
if body[i]['name'] == 'default':
default_security_group_id = body[i]['id']
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index 9e27f33..dcdb562 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -48,13 +48,15 @@
def wait_for_interface_status(self, server, port_id, status):
"""Waits for a interface to reach a given status."""
- body = self.client.show_interface(server, port_id)
+ body = (self.client.show_interface(server, port_id)
+ ['interfaceAttachment'])
interface_status = body['port_state']
start = int(time.time())
while(interface_status != status):
time.sleep(self.build_interval)
- body = self.client.show_interface(server, port_id)
+ body = (self.client.show_interface(server, port_id)
+ ['interfaceAttachment'])
interface_status = body['port_state']
timed_out = int(time.time()) - start >= self.build_timeout
@@ -82,14 +84,16 @@
def _create_server_get_interfaces(self):
server = self.create_test_server(wait_until='ACTIVE')
- ifs = self.client.list_interfaces(server['id'])
+ ifs = (self.client.list_interfaces(server['id'])
+ ['interfaceAttachments'])
body = self.wait_for_interface_status(
server['id'], ifs[0]['port_id'], 'ACTIVE')
ifs[0]['port_state'] = body['port_state']
return server, ifs
def _test_create_interface(self, server):
- iface = self.client.create_interface(server['id'])
+ iface = (self.client.create_interface(server['id'])
+ ['interfaceAttachment'])
iface = self.wait_for_interface_status(
server['id'], iface['port_id'], 'ACTIVE')
self._check_interface(iface)
@@ -97,8 +101,8 @@
def _test_create_interface_by_network_id(self, server, ifs):
network_id = ifs[0]['net_id']
- iface = self.client.create_interface(server['id'],
- net_id=network_id)
+ iface = self.client.create_interface(
+ server['id'], net_id=network_id)['interfaceAttachment']
iface = self.wait_for_interface_status(
server['id'], iface['port_id'], 'ACTIVE')
self._check_interface(iface, network_id=network_id)
@@ -106,8 +110,8 @@
def _test_show_interface(self, server, ifs):
iface = ifs[0]
- _iface = self.client.show_interface(server['id'],
- iface['port_id'])
+ _iface = self.client.show_interface(
+ server['id'], iface['port_id'])['interfaceAttachment']
self._check_interface(iface, port_id=_iface['port_id'],
network_id=_iface['net_id'],
fixed_ip=_iface['fixed_ips'][0]['ip_address'],
@@ -117,12 +121,14 @@
# NOTE(danms): delete not the first or last, but one in the middle
iface = ifs[1]
self.client.delete_interface(server['id'], iface['port_id'])
- _ifs = self.client.list_interfaces(server['id'])
+ _ifs = (self.client.list_interfaces(server['id'])
+ ['interfaceAttachments'])
start = int(time.time())
while len(ifs) == len(_ifs):
time.sleep(self.build_interval)
- _ifs = self.client.list_interfaces(server['id'])
+ _ifs = (self.client.list_interfaces(server['id'])
+ ['interfaceAttachments'])
timed_out = int(time.time()) - start >= self.build_timeout
if len(ifs) == len(_ifs) and timed_out:
message = ('Failed to delete interface within '
@@ -161,7 +167,8 @@
iface = self._test_create_interface_by_network_id(server, ifs)
ifs.append(iface)
- _ifs = self.client.list_interfaces(server['id'])
+ _ifs = (self.client.list_interfaces(server['id'])
+ ['interfaceAttachments'])
self._compare_iface_list(ifs, _ifs)
self._test_show_interface(server, ifs)
diff --git a/tempest/api/compute/servers/test_availability_zone.py b/tempest/api/compute/servers/test_availability_zone.py
index d1fbcec..080441a 100644
--- a/tempest/api/compute/servers/test_availability_zone.py
+++ b/tempest/api/compute/servers/test_availability_zone.py
@@ -32,4 +32,4 @@
def test_get_availability_zone_list_with_non_admin_user(self):
# List of availability zone with non-administrator user
availability_zone = self.client.list_availability_zones()
- self.assertTrue(len(availability_zone) > 0)
+ self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index e62a52b..529b596 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -21,6 +21,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -116,7 +117,7 @@
def test_verify_created_server_vcpus(self):
# Verify that the number of vcpus reported by the instance matches
# the amount stated by the flavor
- flavor = self.flavors_client.show_flavor(self.flavor_ref)
+ flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor']
linux_client = remote_client.RemoteClient(
self.get_server_ip(self.server),
self.ssh_user,
@@ -142,7 +143,7 @@
name = data_utils.rand_name('server_group')
policies = ['affinity']
body = self.server_groups_client.create_server_group(
- name=name, policies=policies)
+ name=name, policies=policies)['server_group']
group_id = body['id']
self.addCleanup(self.server_groups_client.delete_server_group,
group_id)
@@ -152,7 +153,8 @@
wait_until='ACTIVE')
# Check a server is in the group
- server_group = self.server_groups_client.get_server_group(group_id)
+ server_group = (self.server_groups_client.get_server_group(group_id)
+ ['server_group'])
self.assertIn(server['id'], server_group['members'])
@test.idempotent_id('0578d144-ed74-43f8-8e57-ab10dbf9b3c2')
@@ -178,7 +180,8 @@
# we're OK.
def cleanup_server():
self.client.delete_server(server_multi_nics['id'])
- self.client.wait_for_server_termination(server_multi_nics['id'])
+ waiters.wait_for_server_termination(self.client,
+ server_multi_nics['id'])
self.addCleanup(cleanup_server)
@@ -218,7 +221,8 @@
def cleanup_server():
self.client.delete_server(server_multi_nics['id'])
- self.client.wait_for_server_termination(server_multi_nics['id'])
+ waiters.wait_for_server_termination(self.client,
+ server_multi_nics['id'])
self.addCleanup(cleanup_server)
@@ -272,7 +276,7 @@
create_flavor(name=flavor_with_eph_disk_name,
ram=ram, vcpus=vcpus, disk=disk,
id=flavor_with_eph_disk_id,
- ephemeral=1))
+ ephemeral=1))['flavor']
self.addCleanup(flavor_clean_up, flavor['id'])
return flavor['id']
@@ -289,7 +293,7 @@
flavor = (self.flavor_client.
create_flavor(name=flavor_no_eph_disk_name,
ram=ram, vcpus=vcpus, disk=disk,
- id=flavor_no_eph_disk_id))
+ id=flavor_no_eph_disk_id))['flavor']
self.addCleanup(flavor_clean_up, flavor['id'])
return flavor['id']
@@ -303,11 +307,11 @@
admin_pass = self.image_ssh_password
- server_no_eph_disk = (self.create_test_server(
- validatable=True,
- wait_until='ACTIVE',
- adminPass=admin_pass,
- flavor=flavor_no_eph_disk_id))
+ server_no_eph_disk = self.create_test_server(
+ validatable=True,
+ wait_until='ACTIVE',
+ adminPass=admin_pass,
+ flavor=flavor_no_eph_disk_id)
# Get partition number of server without extra specs.
server_no_eph_disk = self.client.show_server(
@@ -322,11 +326,11 @@
# Explicit server deletion necessary for Juno compatibility
self.client.delete_server(server_no_eph_disk['id'])
- server_with_eph_disk = (self.create_test_server(
- validatable=True,
- wait_until='ACTIVE',
- adminPass=admin_pass,
- flavor=flavor_with_eph_disk_id))
+ server_with_eph_disk = self.create_test_server(
+ validatable=True,
+ wait_until='ACTIVE',
+ adminPass=admin_pass,
+ flavor=flavor_with_eph_disk_id)
server_with_eph_disk = self.client.show_server(
server_with_eph_disk['id'])
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index b2acd34..d7b4470 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -38,23 +38,23 @@
# Delete a server while it's VM state is Building
server = self.create_test_server(wait_until='BUILD')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('925fdfb4-5b13-47ea-ac8a-c36ae6fddb05')
def test_delete_active_server(self):
# Delete a server while it's VM state is Active
server = self.create_test_server(wait_until='ACTIVE')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('546d368c-bb6c-4645-979a-83ed16f3a6be')
def test_delete_server_while_in_shutoff_state(self):
# Delete a server while it's VM state is Shutoff
server = self.create_test_server(wait_until='ACTIVE')
- self.client.stop(server['id'])
+ self.client.stop_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('943bd6e8-4d7a-4904-be83-7a6cc2d4213b')
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -65,7 +65,7 @@
self.client.pause_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'PAUSED')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('1f82ebd3-8253-4f4e-b93f-de9b7df56d8b')
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
@@ -76,7 +76,7 @@
self.client.suspend_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SUSPENDED')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('bb0cb402-09dd-4947-b6e5-5e7e1cfa61ad')
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
@@ -95,7 +95,7 @@
waiters.wait_for_server_status(self.client, server['id'],
'SHELVED')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('ab0c38b4-cdd8-49d3-9b92-0cb898723c01')
@testtools.skipIf(not CONF.compute_feature_enabled.resize,
@@ -103,11 +103,11 @@
def test_delete_server_while_in_verify_resize_state(self):
# Delete a server while it's VM state is VERIFY_RESIZE
server = self.create_test_server(wait_until='ACTIVE')
- self.client.resize(server['id'], self.flavor_ref_alt)
+ self.client.resize_server(server['id'], self.flavor_ref_alt)
waiters.wait_for_server_status(self.client, server['id'],
'VERIFY_RESIZE')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('d0f3f0d6-d9b6-4a32-8da4-23015dcab23c')
@test.services('volume')
@@ -117,18 +117,18 @@
device = '/dev/%s' % CONF.compute.volume_device_name
server = self.create_test_server(wait_until='ACTIVE')
- volume = volumes_client.create_volume()
+ volume = volumes_client.create_volume(size=CONF.volume.volume_size)
self.addCleanup(volumes_client.delete_volume, volume['id'])
waiters.wait_for_volume_status(volumes_client,
volume['id'], 'available')
self.client.attach_volume(server['id'],
- volume['id'],
+ volumeId=volume['id'],
device=device)
waiters.wait_for_volume_status(volumes_client,
volume['id'], 'in-use')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
waiters.wait_for_volume_status(volumes_client,
volume['id'], 'available')
@@ -152,12 +152,13 @@
server = self.non_admin_client.show_server(server['id'])
self.assertEqual(server['status'], 'ERROR')
self.non_admin_client.delete_server(server['id'])
- self.servers_client.wait_for_server_termination(server['id'],
- ignore_error=True)
+ waiters.wait_for_server_termination(self.servers_client,
+ server['id'],
+ ignore_error=True)
@test.idempotent_id('73177903-6737-4f27-a60c-379e8ae8cf48')
def test_admin_delete_servers_of_others(self):
# Administrator can delete servers of others
server = self.create_test_server(wait_until='ACTIVE')
self.admin_client.delete_server(server['id'])
- self.servers_client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.servers_client, server['id'])
diff --git a/tempest/api/compute/servers/test_disk_config.py b/tempest/api/compute/servers/test_disk_config.py
index 3e8a0d2..929b300 100644
--- a/tempest/api/compute/servers/test_disk_config.py
+++ b/tempest/api/compute/servers/test_disk_config.py
@@ -57,9 +57,9 @@
# A server should be rebuilt using the manual disk config option
self._update_server_with_disk_config(disk_config='AUTO')
- server = self.client.rebuild(self.server_id,
- self.image_ref_alt,
- disk_config='MANUAL')
+ server = self.client.rebuild_server(self.server_id,
+ self.image_ref_alt,
+ disk_config='MANUAL')
# Wait for the server to become active
waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
@@ -73,9 +73,9 @@
# A server should be rebuilt using the auto disk config option
self._update_server_with_disk_config(disk_config='MANUAL')
- server = self.client.rebuild(self.server_id,
- self.image_ref_alt,
- disk_config='AUTO')
+ server = self.client.rebuild_server(self.server_id,
+ self.image_ref_alt,
+ disk_config='AUTO')
# Wait for the server to become active
waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
@@ -101,10 +101,11 @@
# Resize with auto option
flavor_id = self._get_alternative_flavor()
- self.client.resize(self.server_id, flavor_id, disk_config='AUTO')
+ self.client.resize_server(self.server_id, flavor_id,
+ disk_config='AUTO')
waiters.wait_for_server_status(self.client, self.server_id,
'VERIFY_RESIZE')
- self.client.confirm_resize(self.server_id)
+ self.client.confirm_resize_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
server = self.client.show_server(self.server_id)
@@ -119,10 +120,11 @@
# Resize with manual option
flavor_id = self._get_alternative_flavor()
- self.client.resize(self.server_id, flavor_id, disk_config='MANUAL')
+ self.client.resize_server(self.server_id, flavor_id,
+ disk_config='MANUAL')
waiters.wait_for_server_status(self.client, self.server_id,
'VERIFY_RESIZE')
- self.client.confirm_resize(self.server_id)
+ self.client.confirm_resize_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
server = self.client.show_server(self.server_id)
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index dc126a5..4ac1a49 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -35,7 +35,7 @@
@test.idempotent_id('77ca5cc5-9990-45e0-ab98-1de8fead201a')
def test_list_instance_actions(self):
# List actions of the provided server
- self.client.reboot(self.server_id, 'HARD')
+ self.client.reboot_server(self.server_id, 'HARD')
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
body = self.client.list_instance_actions(self.server_id)
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index a75cb3e..16e4392 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -44,7 +44,7 @@
# Check to see if the alternate image ref actually exists...
images_client = cls.images_client
- images = images_client.list_images()
+ images = images_client.list_images()['images']
if cls.image_ref != cls.image_ref_alt and \
any([image for image in images
@@ -137,11 +137,11 @@
def test_list_servers_filter_by_shutoff_status(self):
# Filter the list of servers by server shutoff status
params = {'status': 'shutoff'}
- self.client.stop(self.s1['id'])
+ self.client.stop_server(self.s1['id'])
waiters.wait_for_server_status(self.client, self.s1['id'],
'SHUTOFF')
body = self.client.list_servers(**params)
- self.client.start(self.s1['id'])
+ self.client.start_server(self.s1['id'])
waiters.wait_for_server_status(self.client, self.s1['id'],
'ACTIVE')
servers = body['servers']
@@ -305,12 +305,20 @@
params = {'ip': ip}
else:
params = {'ip6': ip}
+ # capture all servers in case something goes wrong
+ all_servers = self.client.list_servers(detail=True)
body = self.client.list_servers(**params)
servers = body['servers']
- self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
- self.assertIn(self.s2_name, map(lambda x: x['name'], servers))
- self.assertIn(self.s3_name, map(lambda x: x['name'], servers))
+ self.assertIn(self.s1_name, map(lambda x: x['name'], servers),
+ "%s not found in %s, all servers %s" %
+ (self.s1_name, servers, all_servers))
+ self.assertIn(self.s2_name, map(lambda x: x['name'], servers),
+ "%s not found in %s, all servers %s" %
+ (self.s2_name, servers, all_servers))
+ self.assertIn(self.s3_name, map(lambda x: x['name'], servers),
+ "%s not found in %s, all servers %s" %
+ (self.s3_name, servers, all_servers))
@test.idempotent_id('67aec2d0-35fe-4503-9f92-f13272b867ed')
def test_list_servers_detailed_limit_results(self):
diff --git a/tempest/api/compute/servers/test_list_servers_negative.py b/tempest/api/compute/servers/test_list_servers_negative.py
index def6cf5..f205ddf 100644
--- a/tempest/api/compute/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/servers/test_list_servers_negative.py
@@ -17,6 +17,7 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
+from tempest.common import waiters
from tempest import test
@@ -47,8 +48,8 @@
# be put into ERROR status on a quick spawn, then delete,
# as the compute node expects the instance local status
# to be spawning, not deleted. See LP Bug#1061167
- cls.client.wait_for_server_termination(srv['id'],
- ignore_error=True)
+ waiters.wait_for_server_termination(cls.client, srv['id'],
+ ignore_error=True)
cls.deleted_fixtures.append(srv)
@test.attr(type=['negative'])
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index f0f6b8c..47629c0 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -105,7 +105,7 @@
self.validation_resources['keypair']['private_key'])
boot_time = linux_client.get_boot_time()
- self.client.reboot(self.server_id, reboot_type)
+ self.client.reboot_server(self.server_id, reboot_type)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
if CONF.validation.run_validation:
@@ -132,7 +132,7 @@
self._test_reboot_server('SOFT')
def _rebuild_server_and_check(self, image_ref):
- rebuilt_server = self.client.rebuild(self.server_id, image_ref)
+ rebuilt_server = self.client.rebuild_server(self.server_id, image_ref)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
msg = ('Server was not rebuilt to the original image. '
'The original image: {0}. The current image: {1}'
@@ -148,12 +148,12 @@
personality = [{'path': 'rebuild.txt',
'contents': base64.b64encode(file_contents)}]
password = 'rebuildPassw0rd'
- rebuilt_server = self.client.rebuild(self.server_id,
- self.image_ref_alt,
- name=new_name,
- metadata=meta,
- personality=personality,
- adminPass=password)
+ rebuilt_server = self.client.rebuild_server(self.server_id,
+ self.image_ref_alt,
+ name=new_name,
+ metadata=meta,
+ personality=personality,
+ adminPass=password)
# If the server was rebuilt on a different image, restore it to the
# original image once the test ends
@@ -191,9 +191,9 @@
old_image = server['image']['id']
new_image = (self.image_ref_alt
if old_image == self.image_ref else self.image_ref)
- self.client.stop(self.server_id)
+ self.client.stop_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'SHUTOFF')
- rebuilt_server = self.client.rebuild(self.server_id, new_image)
+ rebuilt_server = self.client.rebuild_server(self.server_id, new_image)
# If the server was rebuilt on a different image, restore it to the
# original image once the test ends
if self.image_ref_alt != self.image_ref:
@@ -212,22 +212,22 @@
rebuilt_image_id = server['image']['id']
self.assertEqual(new_image, rebuilt_image_id)
- self.client.start(self.server_id)
+ self.client.start_server(self.server_id)
def _test_resize_server_confirm(self, stop=False):
# The server's RAM and disk space should be modified to that of
# the provided flavor
if stop:
- self.client.stop(self.server_id)
+ self.client.stop_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id,
'SHUTOFF')
- self.client.resize(self.server_id, self.flavor_ref_alt)
+ self.client.resize_server(self.server_id, self.flavor_ref_alt)
waiters.wait_for_server_status(self.client, self.server_id,
'VERIFY_RESIZE')
- self.client.confirm_resize(self.server_id)
+ self.client.confirm_resize_server(self.server_id)
expected_status = 'SHUTOFF' if stop else 'ACTIVE'
waiters.wait_for_server_status(self.client, self.server_id,
expected_status)
@@ -237,7 +237,7 @@
if stop:
# NOTE(mriedem): tearDown requires the server to be started.
- self.client.start(self.server_id)
+ self.client.start_server(self.server_id)
# NOTE(jlk): Explicitly delete the server to get a new one for later
# tests. Avoids resize down race issues.
@@ -262,11 +262,11 @@
# The server's RAM and disk space should return to its original
# values after a resize is reverted
- self.client.resize(self.server_id, self.flavor_ref_alt)
+ self.client.resize_server(self.server_id, self.flavor_ref_alt)
waiters.wait_for_server_status(self.client, self.server_id,
'VERIFY_RESIZE')
- self.client.revert_resize(self.server_id)
+ self.client.revert_resize_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
server = self.client.show_server(self.server_id)
@@ -323,7 +323,7 @@
properties=properties,
status='active',
sort_key='created_at',
- sort_dir='asc')
+ sort_dir='asc')['images']
self.assertEqual(2, len(image_list))
self.assertEqual((backup1, backup2),
(image_list[0]['name'], image_list[1]['name']))
@@ -347,7 +347,7 @@
properties=properties,
status='active',
sort_key='created_at',
- sort_dir='asc')
+ sort_dir='asc')['images']
self.assertEqual(2, len(image_list),
'Unexpected number of images for '
'v2:test_create_backup; was the oldest backup not '
@@ -375,7 +375,7 @@
# log file is truncated and we cannot get any console log through
# "console-log" API.
# The detail is https://bugs.launchpad.net/nova/+bug/1251920
- self.client.reboot(self.server_id, 'HARD')
+ self.client.reboot_server(self.server_id, 'HARD')
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
self.wait_for(self._get_output)
@@ -411,7 +411,7 @@
server = self.create_test_server(wait_until='ACTIVE')
temp_server_id = server['id']
- self.client.stop(temp_server_id)
+ self.client.stop_server(temp_server_id)
waiters.wait_for_server_status(self.client, temp_server_id, 'SHUTOFF')
self.wait_for(self._get_output)
@@ -456,7 +456,7 @@
server = self.client.show_server(self.server_id)
image_name = server['name'] + '-shelved'
params = {'name': image_name}
- images = self.images_client.list_images(**params)
+ images = self.images_client.list_images(**params)['images']
self.assertEqual(1, len(images))
self.assertEqual(image_name, images[0]['name'])
@@ -465,24 +465,25 @@
@test.idempotent_id('af8eafd4-38a7-4a4b-bdbc-75145a580560')
def test_stop_start_server(self):
- self.client.stop(self.server_id)
+ self.client.stop_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'SHUTOFF')
- self.client.start(self.server_id)
+ self.client.start_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
@test.idempotent_id('80a8094c-211e-440a-ab88-9e59d556c7ee')
def test_lock_unlock_server(self):
# Lock the server,try server stop(exceptions throw),unlock it and retry
self.client.lock_server(self.server_id)
+ self.addCleanup(self.client.unlock_server, self.server_id)
server = self.client.show_server(self.server_id)
self.assertEqual(server['status'], 'ACTIVE')
# Locked server is not allowed to be stopped by non-admin user
self.assertRaises(lib_exc.Conflict,
- self.client.stop, self.server_id)
+ self.client.stop_server, self.server_id)
self.client.unlock_server(self.server_id)
- self.client.stop(self.server_id)
+ self.client.stop_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'SHUTOFF')
- self.client.start(self.server_id)
+ self.client.start_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
def _validate_url(self, url):
diff --git a/tempest/api/compute/servers/test_server_group.py b/tempest/api/compute/servers/test_server_group.py
index 0e7c1eb..0da7912 100644
--- a/tempest/api/compute/servers/test_server_group.py
+++ b/tempest/api/compute/servers/test_server_group.py
@@ -61,7 +61,7 @@
# delete the test server-group
self.client.delete_server_group(server_group['id'])
# validation of server-group deletion
- server_group_list = self.client.list_server_groups()
+ server_group_list = self.client.list_server_groups()['server_groups']
self.assertNotIn(server_group, server_group_list)
def _create_delete_server_group(self, policy):
@@ -107,11 +107,11 @@
def test_get_server_group(self):
# Get the server-group
body = self.client.get_server_group(
- self.created_server_group['id'])
+ self.created_server_group['id'])['server_group']
self.assertEqual(self.created_server_group, body)
@test.idempotent_id('d4874179-27b4-4d7d-80e4-6c560cdfe321')
def test_list_server_groups(self):
# List the server-group
- body = self.client.list_server_groups()
+ body = self.client.list_server_groups()['server_groups']
self.assertIn(self.created_server_group, body)
diff --git a/tempest/api/compute/servers/test_server_metadata_negative.py b/tempest/api/compute/servers/test_server_metadata_negative.py
index c42ec3d..5804dbe 100644
--- a/tempest/api/compute/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/servers/test_server_metadata_negative.py
@@ -137,7 +137,7 @@
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised while exceeding metadata items limit for
# tenant.
- quota_set = self.quotas.show_quota_set(self.tenant_id)
+ quota_set = self.quotas.show_quota_set(self.tenant_id)['quota_set']
quota_metadata = quota_set['metadata_items']
if quota_metadata == -1:
raise self.skipException("No limit for metadata_items")
diff --git a/tempest/api/compute/servers/test_server_personality.py b/tempest/api/compute/servers/test_server_personality.py
index b3cc072..a7fc235 100644
--- a/tempest/api/compute/servers/test_server_personality.py
+++ b/tempest/api/compute/servers/test_server_personality.py
@@ -34,7 +34,7 @@
# number of files are injected into the server.
file_contents = 'This is a test file.'
personality = []
- limits = self.user_client.show_limits()
+ limits = self.user_client.show_limits()['limits']
max_file_limit = limits['absolute']['maxPersonality']
if max_file_limit == -1:
raise self.skipException("No limit for personality files")
@@ -52,7 +52,7 @@
# Server should be created successfully if maximum allowed number of
# files is injected into the server during creation.
file_contents = 'This is a test file.'
- limits = self.user_client.show_limits()
+ limits = self.user_client.show_limits()['limits']
max_file_limit = limits['absolute']['maxPersonality']
if max_file_limit == -1:
raise self.skipException("No limit for personality files")
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 7e09096..96ce45e 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -41,7 +41,7 @@
super(ServerRescueTestJSON, cls).resource_setup()
# Floating IP creation
- body = cls.floating_ips_client.create_floating_ip()
+ body = cls.floating_ips_client.create_floating_ip()['floating_ip']
cls.floating_ip_id = str(body['id']).strip()
cls.floating_ip = str(body['ip']).strip()
@@ -49,7 +49,7 @@
cls.sg_name = data_utils.rand_name('sg')
cls.sg_desc = data_utils.rand_name('sg-desc')
cls.sg = cls.security_groups_client.create_security_group(
- name=cls.sg_name, description=cls.sg_desc)
+ name=cls.sg_name, description=cls.sg_desc)['security_group']
cls.sg_id = cls.sg['id']
# Server for positive tests
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index 2fe63ed..9d06188 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -61,7 +61,7 @@
def _create_volume(self):
volume = self.volumes_extensions_client.create_volume(
- CONF.volume.volume_size, display_name=data_utils.rand_name(
+ size=CONF.volume.volume_size, display_name=data_utils.rand_name(
self.__class__.__name__ + '_volume'))
self.addCleanup(self.delete_volume, volume['id'])
waiters.wait_for_volume_status(self.volumes_extensions_client,
@@ -100,7 +100,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('db22b618-f157-4566-a317-1b6d467a8094')
def test_rescued_vm_reboot(self):
- self.assertRaises(lib_exc.Conflict, self.servers_client.reboot,
+ self.assertRaises(lib_exc.Conflict, self.servers_client.reboot_server,
self.rescue_id, 'HARD')
@test.attr(type=['negative'])
@@ -116,7 +116,7 @@
@test.idempotent_id('70cdb8a1-89f8-437d-9448-8844fd82bf46')
def test_rescued_vm_rebuild(self):
self.assertRaises(lib_exc.Conflict,
- self.servers_client.rebuild,
+ self.servers_client.rebuild_server,
self.rescue_id,
self.image_ref_alt)
@@ -137,7 +137,7 @@
self.assertRaises(lib_exc.Conflict,
self.servers_client.attach_volume,
self.server_id,
- volume['id'],
+ volumeId=volume['id'],
device='/dev/%s' % self.device)
@test.idempotent_id('f56e465b-fe10-48bf-b75d-646cda3a8bc9')
@@ -148,7 +148,7 @@
# Attach the volume to the server
self.servers_client.attach_volume(self.server_id,
- volume['id'],
+ volumeId=volume['id'],
device='/dev/%s' % self.device)
waiters.wait_for_volume_status(self.volumes_extensions_client,
volume['id'], 'in-use')
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index c243adf..8cfb670 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -95,7 +95,7 @@
def test_update_server_name_in_stop_state(self):
# The server name should be changed to the the provided value
server = self.create_test_server(wait_until='ACTIVE')
- self.client.stop(server['id'])
+ self.client.stop_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
updated_server = self._update_server_name(server['id'], 'SHUTOFF')
self.assertNotIn('progress', updated_server)
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index fe05456..d5b60da 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -122,7 +122,7 @@
# Resize a non-existent server
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
- self.client.resize,
+ self.client.resize_server,
nonexistent_server, self.flavor_ref)
@test.idempotent_id('ced1a1d7-2ab6-45c9-b90f-b27d87b30efd')
@@ -132,7 +132,7 @@
def test_resize_server_with_non_existent_flavor(self):
# Resize a server with non-existent flavor
nonexistent_flavor = data_utils.rand_uuid()
- self.assertRaises(lib_exc.BadRequest, self.client.resize,
+ self.assertRaises(lib_exc.BadRequest, self.client.resize_server,
self.server_id, flavor_ref=nonexistent_flavor)
@test.idempotent_id('45436a7d-a388-4a35-a9d8-3adc5d0d940b')
@@ -141,7 +141,7 @@
@test.attr(type=['negative'])
def test_resize_server_with_null_flavor(self):
# Resize a server with null flavor
- self.assertRaises(lib_exc.BadRequest, self.client.resize,
+ self.assertRaises(lib_exc.BadRequest, self.client.resize_server,
self.server_id, flavor_ref="")
@test.attr(type=['negative'])
@@ -149,7 +149,7 @@
def test_reboot_non_existent_server(self):
# Reboot a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(lib_exc.NotFound, self.client.reboot,
+ self.assertRaises(lib_exc.NotFound, self.client.reboot_server,
nonexistent_server, 'SOFT')
@test.idempotent_id('d1417e7f-a509-41b5-a102-d5eed8613369')
@@ -171,12 +171,12 @@
# Rebuild and Reboot a deleted server
server = self.create_test_server()
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
self.assertRaises(lib_exc.NotFound,
- self.client.rebuild,
+ self.client.rebuild_server,
server['id'], self.image_ref_alt)
- self.assertRaises(lib_exc.NotFound, self.client.reboot,
+ self.assertRaises(lib_exc.NotFound, self.client.reboot_server,
server['id'], 'SOFT')
@test.attr(type=['negative'])
@@ -185,7 +185,7 @@
# Rebuild a non existent server
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
- self.client.rebuild,
+ self.client.rebuild_server,
nonexistent_server,
self.image_ref_alt)
@@ -243,22 +243,21 @@
def test_update_name_of_non_existent_server(self):
# Update name of a non-existent server
- server_name = data_utils.rand_name('server')
+ nonexistent_server = data_utils.rand_uuid()
new_name = data_utils.rand_name('server') + '_updated'
self.assertRaises(lib_exc.NotFound, self.client.update_server,
- server_name, name=new_name)
+ nonexistent_server, name=new_name)
@test.attr(type=['negative'])
@test.idempotent_id('38204696-17c6-44da-9590-40f87fb5a899')
def test_update_server_set_empty_name(self):
# Update name of the server to an empty string
- server_name = data_utils.rand_name('server')
new_name = ''
self.assertRaises(lib_exc.BadRequest, self.client.update_server,
- server_name, name=new_name)
+ self.server_id, name=new_name)
@test.attr(type=['negative'])
@test.idempotent_id('543d84c1-dd2e-4c6d-8cb2-b9da0efaa384')
@@ -336,7 +335,7 @@
def test_stop_non_existent_server(self):
# Stop a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(lib_exc.NotFound, self.servers_client.stop,
+ self.assertRaises(lib_exc.NotFound, self.servers_client.stop_server,
nonexistent_server)
@test.idempotent_id('6a8dc0c6-6cd4-4c0a-9f32-413881828091')
@@ -480,7 +479,7 @@
server = self.client.show_server(self.server_id)
image_name = server['name'] + '-shelved'
params = {'name': image_name}
- images = self.images_client.list_images(**params)
+ images = self.images_client.list_images(**params)['images']
self.assertEqual(1, len(images))
self.assertEqual(image_name, images[0]['name'])
diff --git a/tempest/api/compute/servers/test_virtual_interfaces.py b/tempest/api/compute/servers/test_virtual_interfaces.py
index 85f0041..7aa6d34 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces.py
@@ -57,4 +57,5 @@
for virt_iface in virt_ifaces['virtual_interfaces']:
mac_address = virt_iface['mac_address']
self.assertTrue(netaddr.valid_mac(mac_address),
- "Invalid mac address detected.")
+ "Invalid mac address detected. mac address: %s"
+ % mac_address)
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index e7111b0..b5a24c7 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -70,12 +70,13 @@
body = cls.glance_client.create_image(name=name,
container_format='bare',
disk_format='raw',
- is_public=False)
+ is_public=False)['image']
image_id = body['id']
image_file = six.StringIO(('*' * 1024))
- body = cls.glance_client.update_image(image_id, data=image_file)
+ body = cls.glance_client.update_image(image_id,
+ data=image_file)['image']
cls.glance_client.wait_for_image_status(image_id, 'active')
- cls.image = cls.images_client.show_image(image_id)
+ cls.image = cls.images_client.show_image(image_id)['image']
cls.keypairname = data_utils.rand_name('keypair')
cls.keypairs_client.create_keypair(name=cls.keypairname)
@@ -83,7 +84,7 @@
name = data_utils.rand_name('security')
description = data_utils.rand_name('description')
cls.security_group = cls.security_client.create_security_group(
- name=name, description=description)
+ name=name, description=description)['security_group']
parent_group_id = cls.security_group['id']
ip_protocol = 'tcp'
@@ -91,7 +92,7 @@
to_port = 22
cls.rule = cls.rule_client.create_security_group_rule(
parent_group_id=parent_group_id, ip_protocol=ip_protocol,
- from_port=from_port, to_port=to_port)
+ from_port=from_port, to_port=to_port)['security_group_rule']
@classmethod
def resource_cleanup(cls):
@@ -154,19 +155,19 @@
@test.idempotent_id('14cb5ff5-f646-45ca-8f51-09081d6c0c24')
def test_reboot_server_for_alt_account_fails(self):
# A reboot request for another user's server should fail
- self.assertRaises(lib_exc.NotFound, self.alt_client.reboot,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.reboot_server,
self.server['id'], 'HARD')
@test.idempotent_id('8a0bce51-cd00-480b-88ba-dbc7d8408a37')
def test_rebuild_server_for_alt_account_fails(self):
# A rebuild request for another user's server should fail
- self.assertRaises(lib_exc.NotFound, self.alt_client.rebuild,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.rebuild_server,
self.server['id'], self.image_ref_alt)
@test.idempotent_id('e4da647e-f982-4e61-9dad-1d1abebfb933')
def test_resize_server_for_alt_account_fails(self):
# A resize request for another user's server should fail
- self.assertRaises(lib_exc.NotFound, self.alt_client.resize,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.resize_server,
self.server['id'], self.flavor_ref_alt)
@test.idempotent_id('a9fe8112-0ffa-4902-b061-f892bd5fe0d3')
diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py
index 4cc4328..6e57aff 100644
--- a/tempest/api/compute/test_extensions.py
+++ b/tempest/api/compute/test_extensions.py
@@ -32,7 +32,7 @@
# List of all extensions
if len(CONF.compute_feature_enabled.api_extensions) == 0:
raise self.skipException('There are not any extensions configured')
- extensions = self.extensions_client.list_extensions()
+ extensions = self.extensions_client.list_extensions()['extensions']
ext = CONF.compute_feature_enabled.api_extensions[0]
if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
@@ -49,4 +49,4 @@
def test_get_extension(self):
# get the specified extensions
extension = self.extensions_client.show_extension('os-consoles')
- self.assertEqual('os-consoles', extension['alias'])
+ self.assertEqual('os-consoles', extension['extension']['alias'])
diff --git a/tempest/api/compute/test_live_block_migration_negative.py b/tempest/api/compute/test_live_block_migration_negative.py
index fabe55d..2cd85f2 100644
--- a/tempest/api/compute/test_live_block_migration_negative.py
+++ b/tempest/api/compute/test_live_block_migration_negative.py
@@ -40,10 +40,10 @@
cls.admin_servers_client = cls.os_adm.servers_client
def _migrate_server_to(self, server_id, dest_host):
+ bmflm = CONF.compute_feature_enabled.block_migration_for_live_migration
body = self.admin_servers_client.live_migrate_server(
- server_id, dest_host,
- CONF.compute_feature_enabled.
- block_migration_for_live_migration)
+ server_id, host=dest_host, block_migration=bmflm,
+ disk_over_commit=False)
return body
@test.attr(type=['negative'])
diff --git a/tempest/api/compute/test_networks.py b/tempest/api/compute/test_networks.py
index deb9ee2..b53db3d 100644
--- a/tempest/api/compute/test_networks.py
+++ b/tempest/api/compute/test_networks.py
@@ -19,19 +19,19 @@
CONF = config.CONF
-class NetworksTestJSON(base.BaseV2ComputeTest):
+class ComputeNetworksTest(base.BaseV2ComputeTest):
@classmethod
def skip_checks(cls):
- super(NetworksTestJSON, cls).skip_checks()
+ super(ComputeNetworksTest, cls).skip_checks()
if CONF.service_available.neutron:
raise cls.skipException('nova-network is not available.')
@classmethod
def setup_clients(cls):
- super(NetworksTestJSON, cls).setup_clients()
+ super(ComputeNetworksTest, cls).setup_clients()
cls.client = cls.os.networks_client
@test.idempotent_id('3fe07175-312e-49a5-a623-5f52eeada4c2')
def test_list_networks(self):
- networks = self.client.list_networks()
+ networks = self.client.list_networks()['networks']
self.assertNotEmpty(networks, "No networks found.")
diff --git a/tempest/api/compute/test_quotas.py b/tempest/api/compute/test_quotas.py
index 9f37143..43f4c97 100644
--- a/tempest/api/compute/test_quotas.py
+++ b/tempest/api/compute/test_quotas.py
@@ -54,14 +54,14 @@
def test_get_quotas(self):
# User can get the quota set for it's tenant
expected_quota_set = self.default_quota_set | set(['id'])
- quota_set = self.client.show_quota_set(self.tenant_id)
+ quota_set = self.client.show_quota_set(self.tenant_id)['quota_set']
self.assertEqual(quota_set['id'], self.tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
# get the quota set using user id
quota_set = self.client.show_quota_set(self.tenant_id,
- self.user_id)
+ self.user_id)['quota_set']
self.assertEqual(quota_set['id'], self.tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
@@ -70,7 +70,8 @@
def test_get_default_quotas(self):
# User can get the default quota set for it's tenant
expected_quota_set = self.default_quota_set | set(['id'])
- quota_set = self.client.show_default_quota_set(self.tenant_id)
+ quota_set = (self.client.show_default_quota_set(self.tenant_id)
+ ['quota_set'])
self.assertEqual(quota_set['id'], self.tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
@@ -79,6 +80,7 @@
def test_compare_tenant_quotas_with_default_quotas(self):
# Tenants are created with the default quota values
defualt_quota_set = \
- self.client.show_default_quota_set(self.tenant_id)
- tenant_quota_set = self.client.show_quota_set(self.tenant_id)
+ self.client.show_default_quota_set(self.tenant_id)['quota_set']
+ tenant_quota_set = (self.client.show_quota_set(self.tenant_id)
+ ['quota_set'])
self.assertEqual(defualt_quota_set, tenant_quota_set)
diff --git a/tempest/api/compute/test_tenant_networks.py b/tempest/api/compute/test_tenant_networks.py
index ad5adaa..96b7ef6 100644
--- a/tempest/api/compute/test_tenant_networks.py
+++ b/tempest/api/compute/test_tenant_networks.py
@@ -16,18 +16,29 @@
from tempest import test
-class NetworksTestJSON(base.BaseV2ComputeTest):
+class ComputeTenantNetworksTest(base.BaseV2ComputeTest):
@classmethod
def resource_setup(cls):
- super(NetworksTestJSON, cls).resource_setup()
+ super(ComputeTenantNetworksTest, cls).resource_setup()
cls.client = cls.os.tenant_networks_client
+ cls.network = cls.get_tenant_network()
+
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources(network=True)
+ super(ComputeTenantNetworksTest, cls).setup_credentials()
@test.idempotent_id('edfea98e-bbe3-4c7a-9739-87b986baff26')
+ @test.services('network')
def test_list_show_tenant_networks(self):
- tenant_networks = self.client.list_tenant_networks()
- self.assertNotEmpty(tenant_networks, "No tenant networks found.")
+ # Fetch all networks that are visible to the tenant: this may include
+ # shared and external networks
+ tenant_networks = [
+ n['id'] for n in self.client.list_tenant_networks()['networks']
+ ]
+ self.assertIn(self.network['id'], tenant_networks,
+ "No tenant networks found.")
- for net in tenant_networks:
- tenant_network = self.client.show_tenant_network(net['id'])
- self.assertEqual(net['id'], tenant_network['id'])
+ net = self.client.show_tenant_network(self.network['id'])
+ self.assertEqual(self.network['id'], net['network']['id'])
diff --git a/tempest/api/compute/test_versions.py b/tempest/api/compute/test_versions.py
new file mode 100644
index 0000000..369cf31
--- /dev/null
+++ b/tempest/api/compute/test_versions.py
@@ -0,0 +1,24 @@
+# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.compute import base
+from tempest import test
+
+
+class TestVersions(base.BaseComputeTest):
+
+ @test.idempotent_id('6c0a0990-43b6-4529-9b61-5fd8daf7c55c')
+ def test_list_api_versions(self):
+ result = self.versions_client.list_versions()
+ self.assertIsNotNone(result)
diff --git a/tempest/api/compute/v2/__init__.py b/tempest/api/compute/v2/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/api/compute/v2/__init__.py
+++ /dev/null
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 8e4278a..ba34039 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -75,7 +75,7 @@
# Create a volume and wait for it to become ready
self.volume = self.volumes_client.create_volume(
- CONF.volume.volume_size, display_name='test')
+ CONF.volume.volume_size, display_name='test')['volume']
self.addCleanup(self._delete_volume)
self.volumes_client.wait_for_volume_status(self.volume['id'],
'available')
@@ -83,7 +83,7 @@
# Attach the volume to the server
self.attachment = self.servers_client.attach_volume(
self.server['id'],
- self.volume['id'],
+ volumeId=self.volume['id'],
device='/dev/%s' % self.device)
self.volumes_client.wait_for_volume_status(self.volume['id'], 'in-use')
@@ -97,11 +97,11 @@
# the volume remains attached.
self._create_and_attach()
- self.servers_client.stop(self.server['id'])
+ self.servers_client.stop_server(self.server['id'])
waiters.wait_for_server_status(self.servers_client, self.server['id'],
'SHUTOFF')
- self.servers_client.start(self.server['id'])
+ self.servers_client.start_server(self.server['id'])
waiters.wait_for_server_status(self.servers_client, self.server['id'],
'ACTIVE')
@@ -116,11 +116,11 @@
self._detach(self.server['id'], self.volume['id'])
self.attachment = None
- self.servers_client.stop(self.server['id'])
+ self.servers_client.stop_server(self.server['id'])
waiters.wait_for_server_status(self.servers_client, self.server['id'],
'SHUTOFF')
- self.servers_client.start(self.server['id'])
+ self.servers_client.start_server(self.server['id'])
waiters.wait_for_server_status(self.servers_client, self.server['id'],
'ACTIVE')
diff --git a/tempest/api/compute/volumes/test_volumes_get.py b/tempest/api/compute/volumes/test_volumes_get.py
index 44339a3..f05a5a3 100644
--- a/tempest/api/compute/volumes/test_volumes_get.py
+++ b/tempest/api/compute/volumes/test_volumes_get.py
@@ -46,7 +46,8 @@
v_name = data_utils.rand_name('Volume')
metadata = {'Type': 'work'}
# Create volume
- volume = self.client.create_volume(display_name=v_name,
+ volume = self.client.create_volume(size=CONF.volume.volume_size,
+ display_name=v_name,
metadata=metadata)
self.addCleanup(self.delete_volume, volume['id'])
self.assertIn('id', volume)
diff --git a/tempest/api/compute/volumes/test_volumes_list.py b/tempest/api/compute/volumes/test_volumes_list.py
index 22b3d13..421d96f 100644
--- a/tempest/api/compute/volumes/test_volumes_list.py
+++ b/tempest/api/compute/volumes/test_volumes_list.py
@@ -54,7 +54,8 @@
v_name = data_utils.rand_name('volume')
metadata = {'Type': 'work'}
try:
- volume = cls.client.create_volume(display_name=v_name,
+ volume = cls.client.create_volume(size=CONF.volume.volume_size,
+ display_name=v_name,
metadata=metadata)
waiters.wait_for_volume_status(cls.client,
volume['id'], 'available')
diff --git a/tempest/api/data_processing/base.py b/tempest/api/data_processing/base.py
index 904cbb6..5d78539 100644
--- a/tempest/api/data_processing/base.py
+++ b/tempest/api/data_processing/base.py
@@ -297,6 +297,7 @@
flavor_id,
node_configs,
**kwargs)
+ resp_body = resp_body['node_group_template']
# store id of created node group template
cls._node_group_templates.append(resp_body['id'])
@@ -316,6 +317,7 @@
node_groups,
cluster_configs,
**kwargs)
+ resp_body = resp_body['cluster_template']
# store id of created cluster template
cls._cluster_templates.append(resp_body['id'])
@@ -330,6 +332,7 @@
removed in tearDownClass method.
"""
resp_body = cls.client.create_data_source(name, type, url, **kwargs)
+ resp_body = resp_body['data_source']
# store id of created data source
cls._data_sources.append(resp_body['id'])
@@ -343,6 +346,7 @@
be automatically removed in tearDownClass method.
"""
resp_body = cls.client.create_job_binary_internal(name, data)
+ resp_body = resp_body['job_binary_internal']
# store id of created job binary internal
cls._job_binary_internals.append(resp_body['id'])
@@ -357,6 +361,7 @@
removed in tearDownClass method.
"""
resp_body = cls.client.create_job_binary(name, url, extra, **kwargs)
+ resp_body = resp_body['job_binary']
# store id of created job binary
cls._job_binaries.append(resp_body['id'])
@@ -372,6 +377,7 @@
"""
resp_body = cls.client.create_job(name,
job_type, mains, libs, **kwargs)
+ resp_body = resp_body['job']
# store id of created job
cls._jobs.append(resp_body['id'])
@@ -400,7 +406,7 @@
"""
if not cls.default_plugin:
return None
- plugin = cls.client.get_plugin(cls.default_plugin)
+ plugin = cls.client.get_plugin(cls.default_plugin)['plugin']
for version in DEFAULT_TEMPLATES[cls.default_plugin].keys():
if version in plugin['versions']:
diff --git a/tempest/api/data_processing/test_cluster_templates.py b/tempest/api/data_processing/test_cluster_templates.py
index e357a85..42cbd14 100644
--- a/tempest/api/data_processing/test_cluster_templates.py
+++ b/tempest/api/data_processing/test_cluster_templates.py
@@ -98,7 +98,7 @@
template_info = self._create_cluster_template()
# check for cluster template in list
- templates = self.client.list_cluster_templates()
+ templates = self.client.list_cluster_templates()['cluster_templates']
templates_info = [(template['id'], template['name'])
for template in templates]
self.assertIn(template_info, templates_info)
@@ -110,6 +110,7 @@
# check cluster template fetch by id
template = self.client.get_cluster_template(template_id)
+ template = template['cluster_template']
self.assertEqual(template_name, template['name'])
self.assertDictContainsSubset(self.cluster_template, template)
diff --git a/tempest/api/data_processing/test_data_sources.py b/tempest/api/data_processing/test_data_sources.py
index dd16b2f..67d09a0 100644
--- a/tempest/api/data_processing/test_data_sources.py
+++ b/tempest/api/data_processing/test_data_sources.py
@@ -68,13 +68,13 @@
def _list_data_sources(self, source_info):
# check for data source in list
- sources = self.client.list_data_sources()
+ sources = self.client.list_data_sources()['data_sources']
sources_info = [(source['id'], source['name']) for source in sources]
self.assertIn(source_info, sources_info)
def _get_data_source(self, source_id, source_name, source_body):
# check data source fetch by id
- source = self.client.get_data_source(source_id)
+ source = self.client.get_data_source(source_id)['data_source']
self.assertEqual(source_name, source['name'])
self.assertDictContainsSubset(source_body, source)
diff --git a/tempest/api/data_processing/test_job_binaries.py b/tempest/api/data_processing/test_job_binaries.py
index fb21270..98b7e24 100644
--- a/tempest/api/data_processing/test_job_binaries.py
+++ b/tempest/api/data_processing/test_job_binaries.py
@@ -80,7 +80,7 @@
binary_info = self._create_job_binary(self.swift_job_binary_with_extra)
# check for job binary in list
- binaries = self.client.list_job_binaries()
+ binaries = self.client.list_job_binaries()['binaries']
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@@ -91,7 +91,7 @@
self._create_job_binary(self.swift_job_binary_with_extra))
# check job binary fetch by id
- binary = self.client.get_job_binary(binary_id)
+ binary = self.client.get_job_binary(binary_id)['job_binary']
self.assertEqual(binary_name, binary['name'])
self.assertDictContainsSubset(self.swift_job_binary, binary)
@@ -115,7 +115,7 @@
binary_info = self._create_job_binary(self.internal_db_job_binary)
# check for job binary in list
- binaries = self.client.list_job_binaries()
+ binaries = self.client.list_job_binaries()['binaries']
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@@ -126,7 +126,7 @@
self._create_job_binary(self.internal_db_job_binary))
# check job binary fetch by id
- binary = self.client.get_job_binary(binary_id)
+ binary = self.client.get_job_binary(binary_id)['job_binary']
self.assertEqual(binary_name, binary['name'])
self.assertDictContainsSubset(self.internal_db_job_binary, binary)
diff --git a/tempest/api/data_processing/test_job_binary_internals.py b/tempest/api/data_processing/test_job_binary_internals.py
index 3d76ebe..6919fa5 100644
--- a/tempest/api/data_processing/test_job_binary_internals.py
+++ b/tempest/api/data_processing/test_job_binary_internals.py
@@ -57,7 +57,7 @@
binary_info = self._create_job_binary_internal()
# check for job binary internal in list
- binaries = self.client.list_job_binary_internals()
+ binaries = self.client.list_job_binary_internals()['binaries']
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@@ -68,7 +68,7 @@
# check job binary internal fetch by id
binary = self.client.get_job_binary_internal(binary_id)
- self.assertEqual(binary_name, binary['name'])
+ self.assertEqual(binary_name, binary['job_binary_internal']['name'])
@test.attr(type='smoke')
@test.idempotent_id('b3568c33-4eed-40d5-aae4-6ff3b2ac58f5')
diff --git a/tempest/api/data_processing/test_jobs.py b/tempest/api/data_processing/test_jobs.py
index 83eb54d..7798056 100644
--- a/tempest/api/data_processing/test_jobs.py
+++ b/tempest/api/data_processing/test_jobs.py
@@ -71,7 +71,7 @@
job_info = self._create_job()
# check for job in list
- jobs = self.client.list_jobs()
+ jobs = self.client.list_jobs()['jobs']
jobs_info = [(job['id'], job['name']) for job in jobs]
self.assertIn(job_info, jobs_info)
@@ -81,7 +81,7 @@
job_id, job_name = self._create_job()
# check job fetch by id
- job = self.client.get_job(job_id)
+ job = self.client.get_job(job_id)['job']
self.assertEqual(job_name, job['name'])
@test.attr(type='smoke')
diff --git a/tempest/api/data_processing/test_node_group_templates.py b/tempest/api/data_processing/test_node_group_templates.py
index 102799d..388bb58 100644
--- a/tempest/api/data_processing/test_node_group_templates.py
+++ b/tempest/api/data_processing/test_node_group_templates.py
@@ -65,6 +65,7 @@
# check for node group template in list
templates = self.client.list_node_group_templates()
+ templates = templates['node_group_templates']
templates_info = [(template['id'], template['name'])
for template in templates]
self.assertIn(template_info, templates_info)
@@ -76,6 +77,7 @@
# check node group template fetch by id
template = self.client.get_node_group_template(template_id)
+ template = template['node_group_template']
self.assertEqual(template_name, template['name'])
self.assertDictContainsSubset(self.node_group_template, template)
diff --git a/tempest/api/data_processing/test_plugins.py b/tempest/api/data_processing/test_plugins.py
index 92a5bd0..14594e4 100644
--- a/tempest/api/data_processing/test_plugins.py
+++ b/tempest/api/data_processing/test_plugins.py
@@ -25,7 +25,7 @@
It ensures main plugins availability.
"""
- plugins = self.client.list_plugins()
+ plugins = self.client.list_plugins()['plugins']
plugins_names = [plugin['name'] for plugin in plugins]
for enabled_plugin in CONF.data_processing_feature_enabled.plugins:
self.assertIn(enabled_plugin, plugins_names)
@@ -41,12 +41,13 @@
@test.idempotent_id('53cf6487-2cfb-4a6f-8671-97c542c6e901')
def test_plugin_get(self):
for plugin_name in self._list_all_plugin_names():
- plugin = self.client.get_plugin(plugin_name)
+ plugin = self.client.get_plugin(plugin_name)['plugin']
self.assertEqual(plugin_name, plugin['name'])
for plugin_version in plugin['versions']:
detailed_plugin = self.client.get_plugin(plugin_name,
plugin_version)
+ detailed_plugin = detailed_plugin['plugin']
self.assertEqual(plugin_name, detailed_plugin['name'])
# check that required image tags contains name and version
diff --git a/tempest/api/database/flavors/test_flavors.py b/tempest/api/database/flavors/test_flavors.py
index e698baa..c97ddd7 100644
--- a/tempest/api/database/flavors/test_flavors.py
+++ b/tempest/api/database/flavors/test_flavors.py
@@ -58,7 +58,8 @@
@test.services('compute')
def test_compare_db_flavors_with_os(self):
db_flavors = self.client.list_db_flavors()
- os_flavors = self.os_flavors_client.list_flavors(detail=True)
+ os_flavors = (self.os_flavors_client.list_flavors(detail=True)
+ ['flavors'])
self.assertEqual(len(os_flavors), len(db_flavors),
"OS flavors %s do not match DB flavors %s" %
(os_flavors, db_flavors))
diff --git a/tempest/api/database/limits/test_limits.py b/tempest/api/database/limits/test_limits.py
index 7d2fbac..4b7f2d6 100644
--- a/tempest/api/database/limits/test_limits.py
+++ b/tempest/api/database/limits/test_limits.py
@@ -29,7 +29,7 @@
def test_absolute_limits(self):
# Test to verify if all absolute limit paramaters are
# present when verb is ABSOLUTE
- limits = self.client.list_db_limits()
+ limits = self.client.list_db_limits()['limits']
expected_abs_limits = ['max_backups', 'max_volumes',
'max_instances', 'verb']
absolute_limit = [l for l in limits
diff --git a/tempest/api/database/versions/test_versions.py b/tempest/api/database/versions/test_versions.py
index 55d8246..ae568b1 100644
--- a/tempest/api/database/versions/test_versions.py
+++ b/tempest/api/database/versions/test_versions.py
@@ -27,7 +27,7 @@
@test.attr(type='smoke')
@test.idempotent_id('6952cd77-90cd-4dca-bb60-8e2c797940cf')
def test_list_db_versions(self):
- versions = self.client.list_db_versions()
+ versions = self.client.list_db_versions()['versions']
self.assertTrue(len(versions) > 0, "No database versions found")
# List of all versions should contain the current version, and there
# should only be one 'current' version
diff --git a/tempest/api/identity/admin/v2/test_roles.py b/tempest/api/identity/admin/v2/test_roles.py
index 1babc45..0b28a07 100644
--- a/tempest/api/identity/admin/v2/test_roles.py
+++ b/tempest/api/identity/admin/v2/test_roles.py
@@ -76,7 +76,7 @@
self.data.setup_test_role()
role_id = self.data.role['id']
role_name = self.data.role['name']
- body = self.client.get_role(role_id)
+ body = self.client.get_role(role_id)['role']
self.assertEqual(role_id, body['id'])
self.assertEqual(role_name, body['name'])
diff --git a/tempest/api/identity/admin/v2/test_tenants.py b/tempest/api/identity/admin/v2/test_tenants.py
index f828f66..9fff5f3 100644
--- a/tempest/api/identity/admin/v2/test_tenants.py
+++ b/tempest/api/identity/admin/v2/test_tenants.py
@@ -32,7 +32,7 @@
self.data.tenants.append(tenant)
tenants.append(tenant)
tenant_ids = map(lambda x: x['id'], tenants)
- body = self.client.list_tenants()
+ body = self.client.list_tenants()['tenants']
found = [t for t in body if t['id'] in tenant_ids]
self.assertEqual(len(found), len(tenants), 'Tenants not created')
@@ -40,7 +40,7 @@
self.client.delete_tenant(tenant['id'])
self.data.tenants.remove(tenant)
- body = self.client.list_tenants()
+ body = self.client.list_tenants()['tenants']
found = [tenant for tenant in body if tenant['id'] in tenant_ids]
self.assertFalse(any(found), 'Tenants failed to delete')
diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
index 662d06c..d22b27f 100644
--- a/tempest/api/identity/admin/v3/test_credentials.py
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -33,12 +33,12 @@
for i in range(2):
cls.project = cls.client.create_project(
data_utils.rand_name('project'),
- description=data_utils.rand_name('project-desc'))
+ description=data_utils.rand_name('project-desc'))['project']
cls.projects.append(cls.project['id'])
cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=u_password,
- email=u_email, project_id=cls.projects[0])
+ email=u_email, project_id=cls.projects[0])['user']
@classmethod
def resource_cleanup(cls):
@@ -57,7 +57,7 @@
data_utils.rand_name('Secret')]
cred = self.creds_client.create_credential(
keys[0], keys[1], self.user_body['id'],
- self.projects[0])
+ self.projects[0])['credential']
self.addCleanup(self._delete_credential, cred['id'])
for value1 in self.creds_list[0]:
self.assertIn(value1, cred)
@@ -68,14 +68,14 @@
data_utils.rand_name('NewSecret')]
update_body = self.creds_client.update_credential(
cred['id'], access_key=new_keys[0], secret_key=new_keys[1],
- project_id=self.projects[1])
+ project_id=self.projects[1])['credential']
self.assertEqual(cred['id'], update_body['id'])
self.assertEqual(self.projects[1], update_body['project_id'])
self.assertEqual(self.user_body['id'], update_body['user_id'])
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'])
+ get_body = self.creds_client.get_credential(cred['id'])['credential']
for value1 in self.creds_list[0]:
self.assertEqual(update_body[value1],
get_body[value1])
@@ -92,11 +92,11 @@
cred = self.creds_client.create_credential(
data_utils.rand_name('Access'),
data_utils.rand_name('Secret'),
- self.user_body['id'], self.projects[0])
+ self.user_body['id'], self.projects[0])['credential']
created_cred_ids.append(cred['id'])
self.addCleanup(self._delete_credential, cred['id'])
- creds = self.creds_client.list_credentials()
+ creds = self.creds_client.list_credentials()['credentials']
for i in creds:
fetched_cred_ids.append(i['id'])
diff --git a/tempest/api/identity/admin/v3/test_default_project_id.py b/tempest/api/identity/admin/v3/test_default_project_id.py
index 98fff09..4c69758 100644
--- a/tempest/api/identity/admin/v3/test_default_project_id.py
+++ b/tempest/api/identity/admin/v3/test_default_project_id.py
@@ -39,13 +39,14 @@
def test_default_project_id(self):
# create a domain
dom_name = data_utils.rand_name('dom')
- domain_body = self.client.create_domain(dom_name)
+ domain_body = self.client.create_domain(dom_name)['domain']
dom_id = domain_body['id']
self.addCleanup(self._delete_domain, dom_id)
# create a project in the domain
proj_name = data_utils.rand_name('proj')
- proj_body = self.client.create_project(proj_name, domain_id=dom_id)
+ proj_body = self.client.create_project(proj_name,
+ domain_id=dom_id)['project']
proj_id = proj_body['id']
self.addCleanup(self.client.delete_project, proj_id)
self.assertEqual(proj_body['domain_id'], dom_id,
@@ -57,7 +58,7 @@
user_name = data_utils.rand_name('user')
user_body = self.client.create_user(user_name, password=user_name,
domain_id=dom_id,
- default_project_id=proj_id)
+ default_project_id=proj_id)['user']
user_id = user_body['id']
self.addCleanup(self.client.delete_user, user_id)
self.assertEqual(user_body['domain_id'], dom_id,
@@ -82,6 +83,6 @@
# verify the user's token and see that it is scoped to the project
token, auth_data = admin_client.auth_provider.get_auth()
- result = admin_client.identity_v3_client.get_token(token)
+ result = admin_client.identity_v3_client.get_token(token)['token']
self.assertEqual(result['project']['domain']['id'], dom_id)
self.assertEqual(result['project']['id'], proj_id)
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index 5bfb981..742d737 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -37,12 +37,12 @@
for _ in range(3):
domain = self.client.create_domain(
data_utils.rand_name('domain'),
- description=data_utils.rand_name('domain-desc'))
+ description=data_utils.rand_name('domain-desc'))['domain']
# Delete the domain at the end of this method
self.addCleanup(self._delete_domain, domain['id'])
domain_ids.append(domain['id'])
# List and Verify Domains
- body = self.client.list_domains()
+ body = self.client.list_domains()['domains']
for d in body:
fetched_ids.append(d['id'])
missing_doms = [d for d in domain_ids if d not in fetched_ids]
@@ -54,7 +54,7 @@
d_name = data_utils.rand_name('domain')
d_desc = data_utils.rand_name('domain-desc')
domain = self.client.create_domain(
- d_name, description=d_desc)
+ d_name, description=d_desc)['domain']
self.addCleanup(self._delete_domain, domain['id'])
self.assertIn('id', domain)
self.assertIn('description', domain)
@@ -69,7 +69,7 @@
new_name = data_utils.rand_name('new-name')
updated_domain = self.client.update_domain(
- domain['id'], name=new_name, description=new_desc)
+ domain['id'], name=new_name, description=new_desc)['domain']
self.assertIn('id', updated_domain)
self.assertIn('description', updated_domain)
self.assertIn('name', updated_domain)
@@ -80,7 +80,7 @@
self.assertEqual(new_desc, updated_domain['description'])
self.assertEqual(True, updated_domain['enabled'])
- fetched_domain = self.client.get_domain(domain['id'])
+ fetched_domain = self.client.get_domain(domain['id'])['domain']
self.assertEqual(new_name, fetched_domain['name'])
self.assertEqual(new_desc, fetched_domain['description'])
self.assertEqual(True, fetched_domain['enabled'])
@@ -91,7 +91,7 @@
d_name = data_utils.rand_name('domain')
d_desc = data_utils.rand_name('domain-desc')
domain = self.client.create_domain(
- d_name, description=d_desc, enabled=False)
+ d_name, description=d_desc, enabled=False)['domain']
self.addCleanup(self.client.delete_domain, domain['id'])
self.assertEqual(d_name, domain['name'])
self.assertFalse(domain['enabled'])
@@ -101,7 +101,7 @@
def test_create_domain_without_description(self):
# Create domain only with name
d_name = data_utils.rand_name('domain')
- domain = self.client.create_domain(d_name)
+ domain = self.client.create_domain(d_name)['domain']
self.addCleanup(self._delete_domain, domain['id'])
self.assertIn('id', domain)
expected_data = {'name': d_name, 'enabled': True}
@@ -119,6 +119,6 @@
@test.attr(type='smoke')
@test.idempotent_id('17a5de24-e6a0-4e4a-a9ee-d85b6e5612b5')
def test_default_domain_exists(self):
- domain = self.client.get_domain(self.domain_id)
+ domain = self.client.get_domain(self.domain_id)['domain']
self.assertTrue(domain['enabled'])
diff --git a/tempest/api/identity/admin/v3/test_domains_negative.py b/tempest/api/identity/admin/v3/test_domains_negative.py
index e2f3ef5..156179c 100644
--- a/tempest/api/identity/admin/v3/test_domains_negative.py
+++ b/tempest/api/identity/admin/v3/test_domains_negative.py
@@ -28,7 +28,8 @@
def test_delete_active_domain(self):
d_name = data_utils.rand_name('domain')
d_desc = data_utils.rand_name('domain-desc')
- domain = self.client.create_domain(d_name, description=d_desc)
+ domain = self.client.create_domain(d_name,
+ description=d_desc)['domain']
domain_id = domain['id']
self.addCleanup(self.delete_domain, domain_id)
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 9a8104f..e44a96b 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -36,6 +36,7 @@
cls.service_data =\
cls.service_client.create_service(s_name, s_type,
description=s_description)
+ cls.service_data = cls.service_data['service']
cls.service_id = cls.service_data['id']
cls.service_ids.append(cls.service_id)
# Create endpoints so as to use for LIST and GET test cases
@@ -44,8 +45,8 @@
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
- endpoint = cls.client.create_endpoint(
- cls.service_id, interface, url, region=region, enabled=True)
+ endpoint = (cls.client.create_endpoint(cls.service_id, interface,
+ url, region=region, enabled=True))['endpoint']
cls.setup_endpoints.append(endpoint)
@classmethod
@@ -59,7 +60,7 @@
@test.idempotent_id('c19ecf90-240e-4e23-9966-21cee3f6a618')
def test_list_endpoints(self):
# Get a list of endpoints
- fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()['endpoints']
# Asserting LIST endpoints
missing_endpoints =\
[e for e in self.setup_endpoints if e not in fetched_endpoints]
@@ -72,21 +73,20 @@
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
- endpoint =\
- self.client.create_endpoint(self.service_id, interface, url,
- region=region, enabled=True)
+ endpoint = (self.client.create_endpoint(self.service_id, interface,
+ url, region=region, enabled=True)['endpoint'])
# Asserting Create Endpoint response body
self.assertIn('id', endpoint)
self.assertEqual(region, endpoint['region'])
self.assertEqual(url, endpoint['url'])
# Checking if created endpoint is present in the list of endpoints
- fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()['endpoints']
fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
self.assertIn(endpoint['id'], fetched_endpoints_id)
# Deleting the endpoint created in this method
self.client.delete_endpoint(endpoint['id'])
# Checking whether endpoint is deleted successfully
- fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()['endpoints']
fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
self.assertNotIn(endpoint['id'], fetched_endpoints_id)
@@ -101,7 +101,7 @@
endpoint_for_update =\
self.client.create_endpoint(self.service_id, interface1,
url1, region=region1,
- enabled=True)
+ enabled=True)['endpoint']
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
# Creating service so as update endpoint with new service ID
s_name = data_utils.rand_name('service')
@@ -110,6 +110,7 @@
service2 =\
self.service_client.create_service(s_name, s_type,
description=s_description)
+ service2 = service2['service']
self.service_ids.append(service2['id'])
# Updating endpoint with new values
region2 = data_utils.rand_name('region')
@@ -119,7 +120,8 @@
self.client.update_endpoint(endpoint_for_update['id'],
service_id=service2['id'],
interface=interface2, url=url2,
- region=region2, enabled=False)
+ region=region2,
+ enabled=False)['endpoint']
# Asserting if the attributes of endpoint are updated
self.assertEqual(service2['id'], endpoint['service_id'])
self.assertEqual(interface2, endpoint['interface'])
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index b043415..8cf853b 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -38,7 +38,8 @@
s_description = data_utils.rand_name('description')
cls.service_data = (
cls.service_client.create_service(s_name, s_type,
- description=s_description))
+ description=s_description)
+ ['service'])
cls.service_id = cls.service_data['id']
cls.service_ids.append(cls.service_id)
@@ -78,7 +79,8 @@
interface1 = 'public'
endpoint_for_update = (
self.client.create_endpoint(self.service_id, interface1,
- url1, region=region1, enabled=True))
+ url1, region=region1,
+ enabled=True))['endpoint']
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
self.assertRaises(lib_exc.BadRequest, self.client.update_endpoint,
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index 88e2959..5ce6354 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -25,7 +25,7 @@
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
group = self.client.create_group(name,
- description=description)
+ description=description)['group']
self.addCleanup(self.client.delete_group, group['id'])
self.assertEqual(group['name'], name)
self.assertEqual(group['description'], description)
@@ -34,11 +34,11 @@
new_desc = data_utils.rand_name('UpdateDescription')
updated_group = self.client.update_group(group['id'],
name=new_name,
- description=new_desc)
+ description=new_desc)['group']
self.assertEqual(updated_group['name'], new_name)
self.assertEqual(updated_group['description'], new_desc)
- new_group = self.client.get_group(group['id'])
+ new_group = self.client.get_group(group['id'])['group']
self.assertEqual(group['id'], new_group['id'])
self.assertEqual(new_name, new_group['name'])
self.assertEqual(new_desc, new_group['description'])
@@ -47,25 +47,25 @@
@test.idempotent_id('1598521a-2f36-4606-8df9-30772bd51339')
def test_group_users_add_list_delete(self):
name = data_utils.rand_name('Group')
- group = self.client.create_group(name)
+ group = self.client.create_group(name)['group']
self.addCleanup(self.client.delete_group, group['id'])
# add user into group
users = []
for i in range(3):
name = data_utils.rand_name('User')
- user = self.client.create_user(name)
+ user = self.client.create_user(name)['user']
users.append(user)
self.addCleanup(self.client.delete_user, user['id'])
self.client.add_group_user(group['id'], user['id'])
# list users in group
- group_users = self.client.list_group_users(group['id'])
+ group_users = self.client.list_group_users(group['id'])['users']
self.assertEqual(sorted(users), sorted(group_users))
# delete user in group
for user in users:
self.client.delete_group_user(group['id'],
user['id'])
- group_users = self.client.list_group_users(group['id'])
+ group_users = self.client.list_group_users(group['id'])['users']
self.assertEqual(len(group_users), 0)
@test.idempotent_id('64573281-d26a-4a52-b899-503cb0f4e4ec')
@@ -73,18 +73,18 @@
# create a user
user = self.client.create_user(
data_utils.rand_name('User'),
- password=data_utils.rand_name('Pass'))
+ password=data_utils.rand_name('Pass'))['user']
self.addCleanup(self.client.delete_user, user['id'])
# create two groups, and add user into them
groups = []
for i in range(2):
name = data_utils.rand_name('Group')
- group = self.client.create_group(name)
+ group = self.client.create_group(name)['group']
groups.append(group)
self.addCleanup(self.client.delete_group, group['id'])
self.client.add_group_user(group['id'], user['id'])
# list groups which user belongs to
- user_groups = self.client.list_user_groups(user['id'])
+ user_groups = self.client.list_user_groups(user['id'])['groups']
self.assertEqual(sorted(groups), sorted(user_groups))
self.assertEqual(2, len(user_groups))
@@ -97,11 +97,11 @@
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
group = self.client.create_group(name,
- description=description)
+ description=description)['group']
self.addCleanup(self.client.delete_group, group['id'])
group_ids.append(group['id'])
# List and Verify Groups
- body = self.client.list_groups()
+ body = self.client.list_groups()['groups']
for g in body:
fetched_ids.append(g['id'])
missing_groups = [g for g in group_ids if g not in fetched_ids]
diff --git a/tempest/api/identity/admin/v3/test_list_projects.py b/tempest/api/identity/admin/v3/test_list_projects.py
index 12d80bb..5185fea 100644
--- a/tempest/api/identity/admin/v3/test_list_projects.py
+++ b/tempest/api/identity/admin/v3/test_list_projects.py
@@ -28,22 +28,23 @@
# Create project with domain
cls.p1_name = data_utils.rand_name('project')
cls.p1 = cls.client.create_project(
- cls.p1_name, enabled=False, domain_id=cls.data.domain['id'])
+ cls.p1_name, enabled=False,
+ domain_id=cls.data.domain['id'])['project']
cls.data.projects.append(cls.p1)
cls.project_ids.append(cls.p1['id'])
# Create default project
p2_name = data_utils.rand_name('project')
- cls.p2 = cls.client.create_project(p2_name)
+ cls.p2 = cls.client.create_project(p2_name)['project']
cls.data.projects.append(cls.p2)
cls.project_ids.append(cls.p2['id'])
@test.idempotent_id('1d830662-22ad-427c-8c3e-4ec854b0af44')
def test_projects_list(self):
# List projects
- list_projects = self.client.list_projects()
+ list_projects = self.client.list_projects()['projects']
for p in self.project_ids:
- get_project = self.client.get_project(p)
+ get_project = self.client.get_project(p)['project']
self.assertIn(get_project, list_projects)
@test.idempotent_id('fab13f3c-f6a6-4b9f-829b-d32fd44fdf10')
@@ -63,6 +64,6 @@
self._list_projects_with_params({'name': self.p1_name}, 'name')
def _list_projects_with_params(self, params, key):
- body = self.client.list_projects(params)
+ body = self.client.list_projects(params)['projects']
self.assertIn(self.p1[key], map(lambda x: x[key], body))
self.assertNotIn(self.p2[key], map(lambda x: x[key], body))
diff --git a/tempest/api/identity/admin/v3/test_list_users.py b/tempest/api/identity/admin/v3/test_list_users.py
index d3d51b4..320b479 100644
--- a/tempest/api/identity/admin/v3/test_list_users.py
+++ b/tempest/api/identity/admin/v3/test_list_users.py
@@ -25,7 +25,7 @@
# assert the response based on expected and not_expected
# expected: user expected in the list response
# not_expected: user, which should not be present in list response
- body = self.client.get_users(params)
+ body = self.client.get_users(params)['users']
self.assertIn(expected[key], map(lambda x: x[key], body))
self.assertNotIn(not_expected[key],
map(lambda x: x[key], body))
@@ -41,13 +41,13 @@
u1_name = data_utils.rand_name('test_user')
cls.domain_enabled_user = cls.client.create_user(
u1_name, password=alt_password,
- email=cls.alt_email, domain_id=cls.data.domain['id'])
+ email=cls.alt_email, domain_id=cls.data.domain['id'])['user']
cls.data.v3_users.append(cls.domain_enabled_user)
# Create default not enabled user
u2_name = data_utils.rand_name('test_user')
cls.non_domain_enabled_user = cls.client.create_user(
u2_name, password=alt_password,
- email=cls.alt_email, enabled=False)
+ email=cls.alt_email, enabled=False)['user']
cls.data.v3_users.append(cls.non_domain_enabled_user)
@test.idempotent_id('08f9aabb-dcfe-41d0-8172-82b5fa0bd73d')
@@ -77,7 +77,7 @@
@test.idempotent_id('b30d4651-a2ea-4666-8551-0c0e49692635')
def test_list_users(self):
# List users
- body = self.client.get_users()
+ body = self.client.get_users()['users']
fetched_ids = [u['id'] for u in body]
missing_users = [u['id'] for u in self.data.v3_users
if u['id'] not in fetched_ids]
@@ -88,7 +88,7 @@
@test.idempotent_id('b4baa3ae-ac00-4b4e-9e27-80deaad7771f')
def test_get_user(self):
# Get a user detail
- user = self.client.get_user(self.data.v3_users[0]['id'])
+ user = self.client.get_user(self.data.v3_users[0]['id'])['user']
self.assertEqual(self.data.v3_users[0]['id'], user['id'])
self.assertEqual(self.data.v3_users[0]['name'], user['name'])
self.assertEqual(self.alt_email, user['email'])
diff --git a/tempest/api/identity/admin/v3/test_policies.py b/tempest/api/identity/admin/v3/test_policies.py
index 8b67945..d079fec 100644
--- a/tempest/api/identity/admin/v3/test_policies.py
+++ b/tempest/api/identity/admin/v3/test_policies.py
@@ -32,12 +32,12 @@
blob = data_utils.rand_name('BlobName')
policy_type = data_utils.rand_name('PolicyType')
policy = self.policy_client.create_policy(blob,
- policy_type)
+ policy_type)['policy']
# Delete the Policy at the end of this method
self.addCleanup(self._delete_policy, policy['id'])
policy_ids.append(policy['id'])
# List and Verify Policies
- body = self.policy_client.list_policies()
+ body = self.policy_client.list_policies()['policies']
for p in body:
fetched_ids.append(p['id'])
missing_pols = [p for p in policy_ids if p not in fetched_ids]
@@ -49,7 +49,7 @@
# Test to update policy
blob = data_utils.rand_name('BlobName')
policy_type = data_utils.rand_name('PolicyType')
- policy = self.policy_client.create_policy(blob, policy_type)
+ policy = self.policy_client.create_policy(blob, policy_type)['policy']
self.addCleanup(self._delete_policy, policy['id'])
self.assertIn('id', policy)
self.assertIn('type', policy)
@@ -60,10 +60,10 @@
# Update policy
update_type = data_utils.rand_name('UpdatedPolicyType')
data = self.policy_client.update_policy(
- policy['id'], type=update_type)
+ policy['id'], type=update_type)['policy']
self.assertIn('type', data)
# Assertion for updated value with fetched value
- fetched_policy = self.policy_client.get_policy(policy['id'])
+ fetched_policy = self.policy_client.get_policy(policy['id'])['policy']
self.assertIn('id', fetched_policy)
self.assertIn('blob', fetched_policy)
self.assertIn('type', fetched_policy)
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index 17712f3..f014307 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -26,13 +26,13 @@
project_name = data_utils.rand_name('project')
project_desc = data_utils.rand_name('desc')
project = self.client.create_project(
- project_name, description=project_desc)
+ project_name, description=project_desc)['project']
self.data.projects.append(project)
project_id = project['id']
desc1 = project['description']
self.assertEqual(desc1, project_desc, 'Description should have '
'been sent in response for create')
- body = self.client.get_project(project_id)
+ body = self.client.get_project(project_id)['project']
desc2 = body['description']
self.assertEqual(desc2, project_desc, 'Description does not appear'
'to be set')
@@ -43,12 +43,12 @@
self.data.setup_test_domain()
project_name = data_utils.rand_name('project')
project = self.client.create_project(
- project_name, domain_id=self.data.domain['id'])
+ project_name, domain_id=self.data.domain['id'])['project']
self.data.projects.append(project)
project_id = project['id']
self.assertEqual(project_name, project['name'])
self.assertEqual(self.data.domain['id'], project['domain_id'])
- body = self.client.get_project(project_id)
+ body = self.client.get_project(project_id)['project']
self.assertEqual(project_name, body['name'])
self.assertEqual(self.data.domain['id'], body['domain_id'])
@@ -57,12 +57,12 @@
# Create a project that is enabled
project_name = data_utils.rand_name('project')
project = self.client.create_project(
- project_name, enabled=True)
+ project_name, enabled=True)['project']
self.data.projects.append(project)
project_id = project['id']
en1 = project['enabled']
self.assertTrue(en1, 'Enable should be True in response')
- body = self.client.get_project(project_id)
+ body = self.client.get_project(project_id)['project']
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
@@ -71,12 +71,12 @@
# Create a project that is not enabled
project_name = data_utils.rand_name('project')
project = self.client.create_project(
- project_name, enabled=False)
+ project_name, enabled=False)['project']
self.data.projects.append(project)
en1 = project['enabled']
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
- body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])['project']
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
@@ -85,17 +85,18 @@
def test_project_update_name(self):
# Update name attribute of a project
p_name1 = data_utils.rand_name('project')
- project = self.client.create_project(p_name1)
+ project = self.client.create_project(p_name1)['project']
self.data.projects.append(project)
resp1_name = project['name']
p_name2 = data_utils.rand_name('project2')
- body = self.client.update_project(project['id'], name=p_name2)
+ body = self.client.update_project(project['id'],
+ name=p_name2)['project']
resp2_name = body['name']
self.assertNotEqual(resp1_name, resp2_name)
- body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])['project']
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
@@ -108,17 +109,17 @@
p_name = data_utils.rand_name('project')
p_desc = data_utils.rand_name('desc')
project = self.client.create_project(
- p_name, description=p_desc)
+ p_name, description=p_desc)['project']
self.data.projects.append(project)
resp1_desc = project['description']
p_desc2 = data_utils.rand_name('desc2')
body = self.client.update_project(
- project['id'], description=p_desc2)
+ project['id'], description=p_desc2)['project']
resp2_desc = body['description']
self.assertNotEqual(resp1_desc, resp2_desc)
- body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])['project']
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
@@ -130,18 +131,18 @@
# Update the enabled attribute of a project
p_name = data_utils.rand_name('project')
p_en = False
- project = self.client.create_project(p_name, enabled=p_en)
+ project = self.client.create_project(p_name, enabled=p_en)['project']
self.data.projects.append(project)
resp1_en = project['enabled']
p_en2 = True
body = self.client.update_project(
- project['id'], enabled=p_en2)
+ project['id'], enabled=p_en2)['project']
resp2_en = body['enabled']
self.assertNotEqual(resp1_en, resp2_en)
- body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])['project']
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)
@@ -153,7 +154,7 @@
# Associate a user to a project
# Create a Project
p_name = data_utils.rand_name('project')
- project = self.client.create_project(p_name)
+ project = self.client.create_project(p_name)['project']
self.data.projects.append(project)
# Create a User
@@ -163,12 +164,12 @@
u_password = data_utils.rand_name('pass')
user = self.client.create_user(
u_name, description=u_desc, password=u_password,
- email=u_email, project_id=project['id'])
+ email=u_email, project_id=project['id'])['user']
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Get User To validate the user details
- new_user_get = self.client.get_user(user['id'])
+ new_user_get = self.client.get_user(user['id'])['user']
# Assert response body of GET
self.assertEqual(u_name, new_user_get['name'])
self.assertEqual(u_desc, new_user_get['description'])
diff --git a/tempest/api/identity/admin/v3/test_projects_negative.py b/tempest/api/identity/admin/v3/test_projects_negative.py
index d5ee5a7..9b60d54 100644
--- a/tempest/api/identity/admin/v3/test_projects_negative.py
+++ b/tempest/api/identity/admin/v3/test_projects_negative.py
@@ -34,7 +34,7 @@
def test_project_create_duplicate(self):
# Project names should be unique
project_name = data_utils.rand_name('project-dup')
- project = self.client.create_project(project_name)
+ project = self.client.create_project(project_name)['project']
self.data.projects.append(project)
self.assertRaises(
@@ -69,7 +69,7 @@
def test_project_delete_by_unauthorized_user(self):
# Non-admin user should not be able to delete a project
project_name = data_utils.rand_name('project')
- project = self.client.create_project(project_name)
+ project = self.client.create_project(project_name)['project']
self.data.projects.append(project)
self.assertRaises(
lib_exc.Forbidden, self.non_admin_client.delete_project,
diff --git a/tempest/api/identity/admin/v3/test_regions.py b/tempest/api/identity/admin/v3/test_regions.py
index 7eb92bc..e96e0f5 100644
--- a/tempest/api/identity/admin/v3/test_regions.py
+++ b/tempest/api/identity/admin/v3/test_regions.py
@@ -33,7 +33,7 @@
cls.setup_regions = list()
for i in range(2):
r_description = data_utils.rand_name('description')
- region = cls.client.create_region(r_description)
+ region = cls.client.create_region(r_description)['region']
cls.setup_regions.append(region)
@classmethod
@@ -51,7 +51,8 @@
def test_create_update_get_delete_region(self):
r_description = data_utils.rand_name('description')
region = self.client.create_region(
- r_description, parent_region_id=self.setup_regions[0]['id'])
+ r_description,
+ parent_region_id=self.setup_regions[0]['id'])['region']
self.addCleanup(self._delete_region, region['id'])
self.assertEqual(r_description, region['description'])
self.assertEqual(self.setup_regions[0]['id'],
@@ -61,12 +62,12 @@
region = self.client.update_region(
region['id'],
description=r_alt_description,
- parent_region_id=self.setup_regions[1]['id'])
+ parent_region_id=self.setup_regions[1]['id'])['region']
self.assertEqual(r_alt_description, region['description'])
self.assertEqual(self.setup_regions[1]['id'],
region['parent_region_id'])
# Get the details of region
- region = self.client.get_region(region['id'])
+ region = self.client.get_region(region['id'])['region']
self.assertEqual(r_alt_description, region['description'])
self.assertEqual(self.setup_regions[1]['id'],
region['parent_region_id'])
@@ -78,7 +79,7 @@
r_region_id = data_utils.rand_uuid()
r_description = data_utils.rand_name('description')
region = self.client.create_region(
- r_description, unique_region_id=r_region_id)
+ r_description, unique_region_id=r_region_id)['region']
self.addCleanup(self._delete_region, region['id'])
# Asserting Create Region with specific id response body
self.assertEqual(r_region_id, region['id'])
@@ -87,7 +88,7 @@
@test.idempotent_id('d180bf99-544a-445c-ad0d-0c0d27663796')
def test_list_regions(self):
# Get a list of regions
- fetched_regions = self.client.list_regions()
+ fetched_regions = self.client.list_regions()['regions']
missing_regions =\
[e for e in self.setup_regions if e not in fetched_regions]
# Asserting List Regions response
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index f58a5c5..ffc991a 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -25,7 +25,7 @@
super(RolesV3TestJSON, cls).resource_setup()
for _ in range(3):
role_name = data_utils.rand_name(name='role')
- role = cls.client.create_role(role_name)
+ role = cls.client.create_role(role_name)['role']
cls.data.v3_roles.append(role)
cls.fetched_role_ids = list()
u_name = data_utils.rand_name('user')
@@ -34,20 +34,20 @@
cls.u_password = data_utils.rand_name('pass')
cls.domain = cls.client.create_domain(
data_utils.rand_name('domain'),
- description=data_utils.rand_name('domain-desc'))
+ description=data_utils.rand_name('domain-desc'))['domain']
cls.project = cls.client.create_project(
data_utils.rand_name('project'),
description=data_utils.rand_name('project-desc'),
- domain_id=cls.domain['id'])
+ domain_id=cls.domain['id'])['project']
cls.group_body = cls.client.create_group(
data_utils.rand_name('Group'), project_id=cls.project['id'],
- domain_id=cls.domain['id'])
+ domain_id=cls.domain['id'])['group']
cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=cls.u_password,
email=u_email, project_id=cls.project['id'],
- domain_id=cls.domain['id'])
+ domain_id=cls.domain['id'])['user']
cls.role = cls.client.create_role(
- data_utils.rand_name('Role'))
+ data_utils.rand_name('Role'))['role']
@classmethod
def resource_cleanup(cls):
@@ -69,23 +69,23 @@
@test.idempotent_id('18afc6c0-46cf-4911-824e-9989cc056c3a')
def test_role_create_update_get_list(self):
r_name = data_utils.rand_name('Role')
- role = self.client.create_role(r_name)
+ role = self.client.create_role(r_name)['role']
self.addCleanup(self.client.delete_role, role['id'])
self.assertIn('name', role)
self.assertEqual(role['name'], r_name)
new_name = data_utils.rand_name('NewRole')
- updated_role = self.client.update_role(new_name, role['id'])
+ updated_role = self.client.update_role(new_name, role['id'])['role']
self.assertIn('name', updated_role)
self.assertIn('id', updated_role)
self.assertIn('links', updated_role)
self.assertNotEqual(r_name, updated_role['name'])
- new_role = self.client.get_role(role['id'])
+ new_role = self.client.get_role(role['id'])['role']
self.assertEqual(new_name, new_role['name'])
self.assertEqual(updated_role['id'], new_role['id'])
- roles = self.client.list_roles()
+ roles = self.client.list_roles()['roles']
self.assertIn(role['id'], [r['id'] for r in roles])
@test.idempotent_id('c6b80012-fe4a-498b-9ce8-eb391c05169f')
@@ -94,7 +94,7 @@
self.project['id'], self.user_body['id'], self.role['id'])
roles = self.client.list_user_roles_on_project(
- self.project['id'], self.user_body['id'])
+ self.project['id'], self.user_body['id'])['roles']
for i in roles:
self.fetched_role_ids.append(i['id'])
@@ -111,7 +111,7 @@
self.domain['id'], self.user_body['id'], self.role['id'])
roles = self.client.list_user_roles_on_domain(
- self.domain['id'], self.user_body['id'])
+ self.domain['id'], self.user_body['id'])['roles']
for i in roles:
self.fetched_role_ids.append(i['id'])
@@ -129,7 +129,7 @@
self.project['id'], self.group_body['id'], self.role['id'])
# List group roles on project
roles = self.client.list_group_roles_on_project(
- self.project['id'], self.group_body['id'])
+ self.project['id'], self.group_body['id'])['roles']
for i in roles:
self.fetched_role_ids.append(i['id'])
@@ -158,7 +158,7 @@
self.domain['id'], self.group_body['id'], self.role['id'])
roles = self.client.list_group_roles_on_domain(
- self.domain['id'], self.group_body['id'])
+ self.domain['id'], self.group_body['id'])['roles']
for i in roles:
self.fetched_role_ids.append(i['id'])
@@ -172,6 +172,6 @@
@test.idempotent_id('f5654bcc-08c4-4f71-88fe-05d64e06de94')
def test_list_roles(self):
# Return a list of all roles
- body = self.client.list_roles()
+ body = self.client.list_roles()['roles']
found = [role for role in body if role in self.data.v3_roles]
self.assertEqual(len(found), len(self.data.v3_roles))
diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py
index 95a7dcc..d920f64 100644
--- a/tempest/api/identity/admin/v3/test_services.py
+++ b/tempest/api/identity/admin/v3/test_services.py
@@ -37,7 +37,7 @@
serv_type = data_utils.rand_name('type')
desc = data_utils.rand_name('description')
create_service = self.service_client.create_service(
- serv_type, name=name, description=desc)
+ serv_type, name=name, description=desc)['service']
self.addCleanup(self._del_service, create_service['id'])
self.assertIsNotNone(create_service['id'])
@@ -50,13 +50,13 @@
resp1_desc = create_service['description']
s_desc2 = data_utils.rand_name('desc2')
update_service = self.service_client.update_service(
- s_id, description=s_desc2)
+ s_id, description=s_desc2)['service']
resp2_desc = update_service['description']
self.assertNotEqual(resp1_desc, resp2_desc)
# Get service
- fetched_service = self.service_client.get_service(s_id)
+ fetched_service = self.service_client.get_service(s_id)['service']
resp3_desc = fetched_service['description']
self.assertEqual(resp2_desc, resp3_desc)
@@ -68,7 +68,7 @@
name = data_utils.rand_name('service')
serv_type = data_utils.rand_name('type')
service = self.service_client.create_service(
- serv_type, name=name)
+ serv_type, name=name)['service']
self.addCleanup(self.service_client.delete_service, service['id'])
self.assertIn('id', service)
expected_data = {'name': name, 'type': serv_type}
@@ -82,13 +82,13 @@
name = data_utils.rand_name('service')
serv_type = data_utils.rand_name('type')
create_service = self.service_client.create_service(
- serv_type, name=name)
+ serv_type, name=name)['service']
self.addCleanup(self.service_client.delete_service,
create_service['id'])
service_ids.append(create_service['id'])
# List and Verify Services
- services = self.service_client.list_services()
+ services = self.service_client.list_services()['services']
fetched_ids = [service['id'] for service in services]
found = [s for s in fetched_ids if s in service_ids]
self.assertEqual(len(found), len(service_ids))
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index 951bc78..5681ac6 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -32,14 +32,14 @@
u_password = data_utils.rand_name('pass')
user = self.client.create_user(
u_name, description=u_desc, password=u_password,
- email=u_email)
+ email=u_email)['user']
self.addCleanup(self.client.delete_user, user['id'])
# Perform Authentication
resp = self.token.auth(user_id=user['id'],
password=u_password).response
subject_token = resp['x-subject-token']
# Perform GET Token
- token_details = self.client.get_token(subject_token)
+ token_details = self.client.get_token(subject_token)['token']
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
@@ -61,21 +61,22 @@
# Create a user.
user_name = data_utils.rand_name(name='user')
user_password = data_utils.rand_name(name='pass')
- user = self.client.create_user(user_name, password=user_password)
+ user = self.client.create_user(user_name,
+ password=user_password)['user']
self.addCleanup(self.client.delete_user, user['id'])
# Create a couple projects
project1_name = data_utils.rand_name(name='project')
- project1 = self.client.create_project(project1_name)
+ project1 = self.client.create_project(project1_name)['project']
self.addCleanup(self.client.delete_project, project1['id'])
project2_name = data_utils.rand_name(name='project')
- project2 = self.client.create_project(project2_name)
+ project2 = self.client.create_project(project2_name)['project']
self.addCleanup(self.client.delete_project, project2['id'])
# Create a role
role_name = data_utils.rand_name(name='role')
- role = self.client.create_role(role_name)
+ role = self.client.create_role(role_name)['role']
self.addCleanup(self.client.delete_role, role['id'])
# Grant the user the role on both projects.
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 1ac34eb..fac8826 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -34,7 +34,6 @@
if not CONF.identity_feature_enabled.trust:
raise self.skipException("Trusts aren't enabled")
- self.trustee_username = CONF.identity.alt_username
self.trust_id = None
def tearDown(self):
@@ -48,7 +47,7 @@
# create a project that trusts will be granted on
self.trustor_project_name = data_utils.rand_name(name='project')
project = self.client.create_project(self.trustor_project_name,
- domain_id='default')
+ domain_id='default')['project']
self.trustor_project_id = project['id']
self.assertIsNotNone(self.trustor_project_id)
@@ -63,17 +62,17 @@
password=self.trustor_password,
email=u_email,
project_id=self.trustor_project_id,
- domain_id='default')
+ domain_id='default')['user']
self.trustor_user_id = user['id']
# And two roles, one we'll delegate and one we won't
self.delegated_role = data_utils.rand_name('DelegatedRole')
self.not_delegated_role = data_utils.rand_name('NotDelegatedRole')
- role = self.client.create_role(self.delegated_role)
+ role = self.client.create_role(self.delegated_role)['role']
self.delegated_role_id = role['id']
- role = self.client.create_role(self.not_delegated_role)
+ role = self.client.create_role(self.not_delegated_role)['role']
self.not_delegated_role_id = role['id']
# Assign roles to trustor
@@ -118,7 +117,7 @@
project_id=self.trustor_project_id,
role_names=[self.delegated_role],
impersonation=impersonate,
- expires_at=expires)
+ expires_at=expires)['trust']
self.trust_id = trust_create['id']
return trust_create
@@ -141,7 +140,7 @@
self.assertEqual(1, len(trust['roles']))
def get_trust(self):
- trust_get = self.trustor_client.get_trust(self.trust_id)
+ trust_get = self.trustor_client.get_trust(self.trust_id)['trust']
return trust_get
def validate_role(self, role):
@@ -157,12 +156,12 @@
def check_trust_roles(self):
# Check we find the delegated role
roles_get = self.trustor_client.get_trust_roles(
- self.trust_id)
+ self.trust_id)['roles']
self.assertEqual(1, len(roles_get))
self.validate_role(roles_get[0])
role_get = self.trustor_client.get_trust_role(
- self.trust_id, self.delegated_role_id)
+ self.trust_id, self.delegated_role_id)['role']
self.validate_role(role_get)
role_get = self.trustor_client.check_trust_role(
@@ -245,7 +244,7 @@
@test.idempotent_id('3e48f95d-e660-4fa9-85e0-5a3d85594384')
def test_trust_expire_invalid(self):
- # Test case to check we can check an invlaid expiry time
+ # Test case to check we can check an invalid expiry time
# is rejected with the correct error
# with an expiry specified
expires_str = 'bad.123Z'
@@ -257,7 +256,7 @@
def test_get_trusts_query(self):
self.create_trust()
trusts_get = self.trustor_client.get_trusts(
- trustor_user_id=self.trustor_user_id)
+ trustor_user_id=self.trustor_user_id)['trusts']
self.assertEqual(1, len(trusts_get))
self.validate_trust(trusts_get[0], summary=True)
@@ -265,7 +264,7 @@
@test.idempotent_id('4773ebd5-ecbf-4255-b8d8-b63e6f72b65d')
def test_get_trusts_all(self):
self.create_trust()
- trusts_get = self.client.get_trusts()
+ trusts_get = self.client.get_trusts()['trusts']
trusts = [t for t in trusts_get
if t['id'] == self.trust_id]
self.assertEqual(1, len(trusts))
diff --git a/tempest/api/identity/admin/v3/test_users.py b/tempest/api/identity/admin/v3/test_users.py
index 19cb24e..8fac0b3 100644
--- a/tempest/api/identity/admin/v3/test_users.py
+++ b/tempest/api/identity/admin/v3/test_users.py
@@ -30,13 +30,13 @@
u_password = data_utils.rand_name('pass')
user = self.client.create_user(
u_name, description=u_desc, password=u_password,
- email=u_email, enabled=False)
+ email=u_email, enabled=False)['user']
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Creating second project for updation
project = self.client.create_project(
data_utils.rand_name('project'),
- description=data_utils.rand_name('project-desc'))
+ description=data_utils.rand_name('project-desc'))['project']
# Delete the Project at the end of this method
self.addCleanup(self.client.delete_project, project['id'])
# Updating user details with new values
@@ -46,7 +46,7 @@
update_user = self.client.update_user(
user['id'], name=u_name2, description=u_description2,
project_id=project['id'],
- email=u_email2, enabled=False)
+ email=u_email2, enabled=False)['user']
self.assertEqual(u_name2, update_user['name'])
self.assertEqual(u_description2, update_user['description'])
self.assertEqual(project['id'],
@@ -54,7 +54,7 @@
self.assertEqual(u_email2, update_user['email'])
self.assertEqual(False, update_user['enabled'])
# GET by id after updation
- new_user_get = self.client.get_user(user['id'])
+ new_user_get = self.client.get_user(user['id'])['user']
# Assert response body of GET after updation
self.assertEqual(u_name2, new_user_get['name'])
self.assertEqual(u_description2, new_user_get['description'])
@@ -69,7 +69,7 @@
u_name = data_utils.rand_name('user')
original_password = data_utils.rand_name('pass')
user = self.client.create_user(
- u_name, password=original_password)
+ u_name, password=original_password)['user']
# Delete the User at the end all test methods
self.addCleanup(self.client.delete_user, user['id'])
# Update user with new password
@@ -80,7 +80,7 @@
password=new_password).response
subject_token = resp['x-subject-token']
# Perform GET Token to verify and confirm password is updated
- token_details = self.client.get_token(subject_token)
+ token_details = self.client.get_token(subject_token)['token']
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
@@ -92,7 +92,7 @@
fetched_project_ids = list()
u_project = self.client.create_project(
data_utils.rand_name('project'),
- description=data_utils.rand_name('project-desc'))
+ description=data_utils.rand_name('project-desc'))['project']
# Delete the Project at the end of this method
self.addCleanup(self.client.delete_project, u_project['id'])
# Create a user.
@@ -102,23 +102,23 @@
u_password = data_utils.rand_name('pass')
user_body = self.client.create_user(
u_name, description=u_desc, password=u_password,
- email=u_email, enabled=False, project_id=u_project['id'])
+ email=u_email, enabled=False, project_id=u_project['id'])['user']
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user_body['id'])
# Creating Role
role_body = self.client.create_role(
- data_utils.rand_name('role'))
+ data_utils.rand_name('role'))['role']
# Delete the Role at the end of this method
self.addCleanup(self.client.delete_role, role_body['id'])
- user = self.client.get_user(user_body['id'])
- role = self.client.get_role(role_body['id'])
+ user = self.client.get_user(user_body['id'])['user']
+ role = self.client.get_role(role_body['id'])['role']
for i in range(2):
# Creating project so as to assign role
project_body = self.client.create_project(
data_utils.rand_name('project'),
- description=data_utils.rand_name('project-desc'))
- project = self.client.get_project(project_body['id'])
+ description=data_utils.rand_name('project-desc'))['project']
+ project = self.client.get_project(project_body['id'])['project']
# Delete the Project at the end of this method
self.addCleanup(self.client.delete_project, project_body['id'])
# Assigning roles to user on project
@@ -126,7 +126,7 @@
user['id'],
role['id'])
assigned_project_ids.append(project['id'])
- body = self.client.list_user_projects(user['id'])
+ body = self.client.list_user_projects(user['id'])['projects']
for i in body:
fetched_project_ids.append(i['id'])
# verifying the project ids in list
@@ -142,5 +142,5 @@
def test_get_user(self):
# Get a user detail
self.data.setup_test_v3_user()
- user = self.client.get_user(self.data.v3_user['id'])
+ user = self.client.get_user(self.data.v3_user['id'])['user']
self.assertEqual(self.data.v3_user['id'], user['id'])
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 0654f37..ada292f 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -48,8 +48,12 @@
def get_tenant_by_name(cls, name):
try:
tenants = cls.client.list_tenants()
+ # TODO(jswarren): always retrieve 'tenants' value
+ # once both clients return full response objects
+ if 'tenants' in tenants:
+ tenants = tenants['tenants']
except AttributeError:
- tenants = cls.client.list_projects()
+ tenants = cls.client.list_projects()['projects']
tenant = [t for t in tenants if t['name'] == name]
if len(tenant) > 0:
return tenant[0]
@@ -73,7 +77,7 @@
@classmethod
def setup_clients(cls):
super(BaseIdentityV2Test, cls).setup_clients()
- cls.non_admin_client = cls.os.identity_client
+ cls.non_admin_client = cls.os.identity_public_client
cls.non_admin_token_client = cls.os.token_client
@classmethod
@@ -93,6 +97,7 @@
def setup_clients(cls):
super(BaseIdentityV2AdminTest, cls).setup_clients()
cls.client = cls.os_adm.identity_client
+ cls.non_admin_client = cls.os.identity_client
cls.token_client = cls.os_adm.token_client
@classmethod
@@ -153,21 +158,21 @@
@classmethod
def get_user_by_name(cls, name):
- users = cls.client.get_users()
+ users = cls.client.get_users()['users']
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]
@classmethod
def get_tenant_by_name(cls, name):
- tenants = cls.client.list_projects()
+ tenants = cls.client.list_projects()['projects']
tenant = [t for t in tenants if t['name'] == name]
if len(tenant) > 0:
return tenant[0]
@classmethod
def get_role_by_name(cls, name):
- roles = cls.client.list_roles()
+ roles = cls.client.list_roles()['roles']
role = [r for r in roles if r['name'] == name]
if len(role) > 0:
return role[0]
@@ -237,7 +242,7 @@
self.test_user,
password=self.test_password,
project_id=self.project['id'],
- email=self.test_email)
+ email=self.test_email)['user']
self.v3_users.append(self.v3_user)
def setup_test_project(self):
@@ -246,13 +251,13 @@
self.test_description = data_utils.rand_name('desc')
self.project = self.client.create_project(
name=self.test_project,
- description=self.test_description)
+ description=self.test_description)['project']
self.projects.append(self.project)
def setup_test_v3_role(self):
"""Set up a test v3 role."""
self.test_role = data_utils.rand_name('role')
- self.v3_role = self.client.create_role(self.test_role)
+ self.v3_role = self.client.create_role(self.test_role)['role']
self.v3_roles.append(self.v3_role)
def setup_test_domain(self):
@@ -261,7 +266,7 @@
self.test_description = data_utils.rand_name('desc')
self.domain = self.client.create_domain(
name=self.test_domain,
- description=self.test_description)
+ description=self.test_description)['domain']
self.domains.append(self.domain)
@staticmethod
diff --git a/tempest/api/identity/v2/test_tenants.py b/tempest/api/identity/v2/test_tenants.py
new file mode 100644
index 0000000..1fcff8d
--- /dev/null
+++ b/tempest/api/identity/v2/test_tenants.py
@@ -0,0 +1,50 @@
+# Copyright 2015 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_lib import exceptions as lib_exc
+
+from tempest.api.identity import base
+from tempest import test
+
+
+class IdentityTenantsTest(base.BaseIdentityV2Test):
+
+ credentials = ['primary', 'alt']
+
+ @test.idempotent_id('ecae2459-243d-4ba1-ad02-65f15dc82b78')
+ def test_list_tenants_returns_only_authorized_tenants(self):
+ alt_tenant_name = self.alt_manager.credentials.credentials.tenant_name
+ resp = self.non_admin_client.list_tenants()
+
+ # check that user can see only that tenants that he presents in so user
+ # can successfully authenticate using his credentials and tenant name
+ # from received tenants list
+ for tenant in resp['tenants']:
+ body = self.non_admin_token_client.auth(
+ self.os.credentials.username,
+ self.os.credentials.password,
+ tenant['name'])
+ self.assertNotEmpty(body['token']['id'])
+ self.assertEqual(body['token']['tenant']['id'], tenant['id'])
+ self.assertEqual(body['token']['tenant']['name'], tenant['name'])
+ self.assertEqual(body['user']['id'], self.os.credentials.user_id)
+
+ # check that user cannot log in to alt user's tenant
+ self.assertRaises(
+ lib_exc.Unauthorized,
+ self.non_admin_token_client.auth,
+ self.os.credentials.username,
+ self.os.credentials.password,
+ alt_tenant_name)
diff --git a/tempest/api/identity/v2/test_users.py b/tempest/api/identity/v2/test_users.py
new file mode 100644
index 0000000..4e5b41d
--- /dev/null
+++ b/tempest/api/identity/v2/test_users.py
@@ -0,0 +1,78 @@
+# Copyright 2015 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.
+
+import copy
+
+from tempest_lib.common.utils import data_utils
+from tempest_lib import exceptions
+
+from tempest.api.identity import base
+from tempest import manager
+from tempest import test
+
+
+class IdentityUsersTest(base.BaseIdentityV2Test):
+
+ @classmethod
+ def resource_setup(cls):
+ super(IdentityUsersTest, cls).resource_setup()
+ cls.creds = cls.os.credentials
+ cls.username = cls.creds.username
+ cls.password = cls.creds.password
+ cls.tenant_name = cls.creds.tenant_name
+
+ @test.idempotent_id('165859c9-277f-4124-9479-a7d1627b0ca7')
+ def test_user_update_own_password(self):
+ self.new_creds = copy.copy(self.creds.credentials)
+ self.new_creds.password = data_utils.rand_password()
+ # we need new non-admin Identity Client with new credentials, since
+ # current non_admin_client token will be revoked after updating
+ # password
+ self.non_admin_client_for_cleanup = copy.copy(self.non_admin_client)
+ self.non_admin_client_for_cleanup.auth_provider = (
+ manager.get_auth_provider(self.new_creds))
+ user_id = self.creds.credentials.user_id
+ old_pass = self.creds.credentials.password
+ new_pass = self.new_creds.password
+
+ # to change password back. important for allow_tenant_isolation = false
+ self.addCleanup(
+ self.non_admin_client_for_cleanup.update_user_own_password,
+ user_id=user_id,
+ new_pass=old_pass,
+ old_pass=new_pass)
+
+ # user updates own password
+ resp = self.non_admin_client.update_user_own_password(
+ user_id=user_id, new_pass=new_pass, old_pass=old_pass)
+
+ # check authorization with new token
+ self.non_admin_token_client.auth_token(resp['token']['id'])
+ # check authorization with new password
+ self.non_admin_token_client.auth(self.username,
+ new_pass,
+ self.tenant_name)
+
+ # authorize with old token should lead to Unauthorized
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_admin_token_client.auth_token,
+ self.non_admin_client.token)
+
+ # authorize with old password should lead to Unauthorized
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_admin_token_client.auth,
+ self.username,
+ old_pass,
+ self.tenant_name)
diff --git a/tempest/api/identity/v3/test_api_discovery.py b/tempest/api/identity/v3/test_api_discovery.py
index 2ec8ad8..e0207a9 100644
--- a/tempest/api/identity/v3/test_api_discovery.py
+++ b/tempest/api/identity/v3/test_api_discovery.py
@@ -23,7 +23,7 @@
@test.attr(type='smoke')
@test.idempotent_id('b9232f5e-d9e5-4d97-b96c-28d3db4de1bd')
def test_api_version_resources(self):
- descr = self.non_admin_client.get_api_description()
+ descr = self.non_admin_client.get_api_description()['version']
expected_resources = ('id', 'links', 'media-types', 'status',
'updated')
@@ -34,7 +34,7 @@
@test.attr(type='smoke')
@test.idempotent_id('657c1970-4722-4189-8831-7325f3bc4265')
def test_api_media_types(self):
- descr = self.non_admin_client.get_api_description()
+ descr = self.non_admin_client.get_api_description()['version']
# Get MIME type bases and descriptions
media_types = [(media_type['base'], media_type['type']) for
media_type in descr['media-types']]
@@ -49,7 +49,7 @@
@test.attr(type='smoke')
@test.idempotent_id('8879a470-abfb-47bb-bb8d-5a7fd279ad1e')
def test_api_version_statuses(self):
- descr = self.non_admin_client.get_api_description()
+ descr = self.non_admin_client.get_api_description()['version']
status = descr['status'].lower()
supported_statuses = ['current', 'stable', 'experimental',
'supported', 'deprecated']
diff --git a/tempest/api/identity/v3/test_projects.py b/tempest/api/identity/v3/test_projects.py
new file mode 100644
index 0000000..a547b06
--- /dev/null
+++ b/tempest/api/identity/v3/test_projects.py
@@ -0,0 +1,53 @@
+# Copyright 2015 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_lib import exceptions as lib_exc
+
+from tempest.api.identity import base
+from tempest import test
+
+
+class IdentityV3ProjectsTest(base.BaseIdentityV3Test):
+
+ credentials = ['primary', 'alt']
+
+ @test.idempotent_id('86128d46-e170-4644-866a-cc487f699e1d')
+ def test_list_projects_returns_only_authorized_projects(self):
+ alt_project_name =\
+ self.alt_manager.credentials.credentials.project_name
+ resp = self.non_admin_client.list_user_projects(
+ self.os.credentials.user_id)
+
+ # check that user can see only that projects that he presents in so
+ # user can successfully authenticate using his credentials and
+ # project name from received projects list
+ for project in resp['projects']:
+ token_id, body = self.non_admin_token.get_token(
+ username=self.os.credentials.username,
+ password=self.os.credentials.password,
+ project_name=project['name'],
+ auth_data=True)
+ self.assertNotEmpty(token_id)
+ self.assertEqual(body['project']['id'], project['id'])
+ self.assertEqual(body['project']['name'], project['name'])
+ self.assertEqual(body['user']['id'], self.os.credentials.user_id)
+
+ # check that user cannot log in to alt user's project
+ self.assertRaises(
+ lib_exc.Unauthorized,
+ self.non_admin_token.get_token,
+ username=self.os.credentials.username,
+ password=self.os.credentials.password,
+ project_name=alt_project_name)
diff --git a/tempest/api/identity/v3/test_users.py b/tempest/api/identity/v3/test_users.py
new file mode 100644
index 0000000..a1f664f
--- /dev/null
+++ b/tempest/api/identity/v3/test_users.py
@@ -0,0 +1,72 @@
+# Copyright 2015 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.
+
+import copy
+
+from tempest_lib.common.utils import data_utils
+from tempest_lib import exceptions
+
+from tempest.api.identity import base
+from tempest import manager
+from tempest import test
+
+
+class IdentityV3UsersTest(base.BaseIdentityV3Test):
+
+ @classmethod
+ def resource_setup(cls):
+ super(IdentityV3UsersTest, cls).resource_setup()
+ cls.creds = cls.os.credentials
+ cls.user_id = cls.creds.user_id
+ cls.username = cls.creds.username
+ cls.password = cls.creds.password
+
+ @test.idempotent_id('ad71bd23-12ad-426b-bb8b-195d2b635f27')
+ def test_user_update_own_password(self):
+ self.new_creds = copy.copy(self.creds.credentials)
+ self.new_creds.password = data_utils.rand_password()
+ # we need new non-admin Identity V3 Client with new credentials, since
+ # current non_admin_client token will be revoked after updating
+ # password
+ self.non_admin_client_for_cleanup = copy.copy(self.non_admin_client)
+ self.non_admin_client_for_cleanup.auth_provider = (
+ manager.get_auth_provider(self.new_creds))
+ user_id = self.creds.credentials.user_id
+ old_pass = self.creds.credentials.password
+ new_pass = self.new_creds.password
+ # to change password back. important for allow_tenant_isolation = false
+ self.addCleanup(
+ self.non_admin_client_for_cleanup.update_user_password,
+ user_id=user_id,
+ password=old_pass,
+ original_password=new_pass)
+
+ # user updates own password
+ self.non_admin_client.update_user_password(
+ user_id=user_id, password=new_pass, original_password=old_pass)
+
+ # check authorization with new password
+ self.non_admin_token.auth(user_id=self.user_id, password=new_pass)
+
+ # authorize with old token should lead to IdentityError (404 code)
+ self.assertRaises(exceptions.IdentityError,
+ self.non_admin_token.auth,
+ token=self.non_admin_client.token)
+
+ # authorize with old password should lead to Unauthorized
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_admin_token.auth,
+ user_id=self.user_id,
+ password=old_pass)
diff --git a/tempest/api/image/admin/v2/test_images.py b/tempest/api/image/admin/v2/test_images.py
index 1608b76..09877ba 100644
--- a/tempest/api/image/admin/v2/test_images.py
+++ b/tempest/api/image/admin/v2/test_images.py
@@ -20,7 +20,7 @@
from tempest.api.image import base
from tempest import config
from tempest import test
-
+from tempest_lib import exceptions as lib_exc
CONF = config.CONF
@@ -43,13 +43,20 @@
image_id = body['id']
self.addCleanup(self.client.delete_image, image_id)
# upload an image file
- image_file = moves.cStringIO(data_utils.random_bytes())
+ content = data_utils.random_bytes()
+ image_file = moves.cStringIO(content)
self.client.store_image_file(image_id, image_file)
# deactivate image
self.admin_client.deactivate_image(image_id)
body = self.client.show_image(image_id)
self.assertEqual("deactivated", body['status'])
+ # non-admin user unable to download deactivated image
+ self.assertRaises(lib_exc.Forbidden, self.client.load_image_file,
+ image_id)
# reactivate image
self.admin_client.reactivate_image(image_id)
body = self.client.show_image(image_id)
self.assertEqual("active", body['status'])
+ # non-admin user able to download image after reactivation by admin
+ body = self.client.load_image_file(image_id)
+ self.assertEqual(content, body.data)
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 87013db..da0ce83 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -72,6 +72,10 @@
image = cls.client.create_image(name, container_format,
disk_format, **kwargs)
+ # Image objects returned by the v1 client have the image
+ # data inside a dict that is keyed against 'image'.
+ if 'image' in image:
+ image = image['image']
cls.created_images.append(image['id'])
return image
@@ -146,7 +150,7 @@
cls.alt_tenant_id = cls.alt_img_client.tenant_id
def _list_image_ids_as_alt(self):
- image_list = self.alt_img_client.list_images()
+ image_list = self.alt_img_client.list_images()['images']
image_ids = map(lambda x: x['id'], image_list)
return image_ids
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index 8beed32..d4dbfcd 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -45,7 +45,7 @@
# Now try uploading an image file
image_file = moves.cStringIO(data_utils.random_bytes())
- body = self.client.update_image(image_id, data=image_file)
+ body = self.client.update_image(image_id, data=image_file)['image']
self.assertIn('size', body)
self.assertEqual(1024, body.get('size'))
@@ -119,9 +119,6 @@
img7 = cls._create_standard_image('33', 'bare', 'raw', 142)
img8 = cls._create_standard_image('33', 'bare', 'raw', 142)
cls.created_set = set(cls.created_images)
- # 4x-4x remote image
- cls.remote_set = set((img1, img2, img3, img4))
- cls.standard_set = set((img5, img6, img7, img8))
# 5x bare, 3x ami
cls.bare_set = set((img1, img3, img4, img7, img8))
cls.ami_set = set((img2, img5, img6))
@@ -168,14 +165,14 @@
@test.idempotent_id('246178ab-3b33-4212-9a4b-a7fe8261794d')
def test_index_no_params(self):
# Simple test to see all fixture images returned
- images_list = self.client.list_images()
+ images_list = self.client.list_images()['images']
image_list = map(lambda x: x['id'], images_list)
for image_id in self.created_images:
self.assertIn(image_id, image_list)
@test.idempotent_id('f1755589-63d6-4468-b098-589820eb4031')
def test_index_disk_format(self):
- images_list = self.client.list_images(disk_format='ami')
+ images_list = self.client.list_images(disk_format='ami')['images']
for image in images_list:
self.assertEqual(image['disk_format'], 'ami')
result_set = set(map(lambda x: x['id'], images_list))
@@ -184,7 +181,8 @@
@test.idempotent_id('2143655d-96d9-4bec-9188-8674206b4b3b')
def test_index_container_format(self):
- images_list = self.client.list_images(container_format='bare')
+ images_list = (self.client.list_images(container_format='bare')
+ ['images'])
for image in images_list:
self.assertEqual(image['container_format'], 'bare')
result_set = set(map(lambda x: x['id'], images_list))
@@ -193,7 +191,7 @@
@test.idempotent_id('feb32ac6-22bb-4a16-afd8-9454bb714b14')
def test_index_max_size(self):
- images_list = self.client.list_images(size_max=42)
+ images_list = self.client.list_images(size_max=42)['images']
for image in images_list:
self.assertTrue(image['size'] <= 42)
result_set = set(map(lambda x: x['id'], images_list))
@@ -202,7 +200,7 @@
@test.idempotent_id('6ffc16d0-4cbf-4401-95c8-4ac63eac34d8')
def test_index_min_size(self):
- images_list = self.client.list_images(size_min=142)
+ images_list = self.client.list_images(size_min=142)['images']
for image in images_list:
self.assertTrue(image['size'] >= 142)
result_set = set(map(lambda x: x['id'], images_list))
@@ -214,7 +212,7 @@
images_list = self.client.list_images(detail=True,
status='active',
sort_key='size',
- sort_dir='desc')
+ sort_dir='desc')['images']
top_size = images_list[0]['size'] # We have non-zero sized images
for image in images_list:
size = image['size']
@@ -226,7 +224,7 @@
def test_index_name(self):
images_list = self.client.list_images(
detail=True,
- name='New Remote Image dup')
+ name='New Remote Image dup')['images']
result_set = set(map(lambda x: x['id'], images_list))
for image in images_list:
self.assertEqual(image['name'], 'New Remote Image dup')
@@ -272,7 +270,7 @@
self.assertEqual(metadata['properties'], {'key1': 'value1'})
metadata['properties'].update(req_metadata)
metadata = self.client.update_image(
- self.image_id, properties=metadata['properties'])
+ self.image_id, properties=metadata['properties'])['image']
resp_metadata = self.client.get_image_meta(self.image_id)
expected = {'key1': 'alt1', 'key2': 'value2'}
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 20e9bca..b446ec3 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -88,7 +88,7 @@
self.client.wait_for_resource_deletion(image_id)
# Verifying deletion
- images = self.client.list_images()
+ images = self.client.list_images()['images']
images_id = [item['id'] for item in images]
self.assertNotIn(image_id, images_id)
@@ -164,7 +164,7 @@
"""
Perform list action with given params and validates result.
"""
- images_list = self.client.list_images(params=params)
+ images_list = self.client.list_images(params=params)['images']
# Validating params of fetched images
for image in images_list:
for key in params:
@@ -174,7 +174,7 @@
@test.idempotent_id('1e341d7a-90a9-494c-b143-2cdf2aeb6aee')
def test_index_no_params(self):
# Simple test to see all fixture images returned
- images_list = self.client.list_images()
+ images_list = self.client.list_images()['images']
image_list = map(lambda x: x['id'], images_list)
for image in self.created_images:
@@ -217,7 +217,7 @@
size = image['size']
params = {"size_min": size - 500, "size_max": size + 500}
- images_list = self.client.list_images(params=params)
+ images_list = self.client.list_images(params=params)['images']
image_size_list = map(lambda x: x['size'], images_list)
for image_size in image_size_list:
@@ -235,7 +235,7 @@
def test_list_images_param_limit(self):
# Test to get images by limit
params = {"limit": 2}
- images_list = self.client.list_images(params=params)
+ images_list = self.client.list_images(params=params)['images']
self.assertEqual(len(images_list), params['limit'],
"Failed to get images by limit")
diff --git a/tempest/api/network/admin/test_dhcp_agent_scheduler.py b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
index 4a86aca..86b4973 100644
--- a/tempest/api/network/admin/test_dhcp_agent_scheduler.py
+++ b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
@@ -32,7 +32,6 @@
# dhcp agent: this is done by creating a regular port
cls.network = cls.create_network()
cls.subnet = cls.create_subnet(cls.network)
- cls.cidr = cls.subnet['cidr']
cls.port = cls.create_port(cls.network)
@test.idempotent_id('5032b1fe-eb42-4a64-8f3b-6e189d8b5c7d')
diff --git a/tempest/api/network/admin/test_routers_dvr.py b/tempest/api/network/admin/test_routers_dvr.py
index 9e2d080..365698d 100644
--- a/tempest/api/network/admin/test_routers_dvr.py
+++ b/tempest/api/network/admin/test_routers_dvr.py
@@ -89,7 +89,9 @@
attribute will be set to True
"""
name = data_utils.rand_name('router')
- router = self.admin_client.create_router(name, distributed=False)
+ # router needs to be in admin state down in order to be upgraded to DVR
+ router = self.admin_client.create_router(name, distributed=False,
+ admin_state_up=False)
self.addCleanup(self.admin_client.delete_router,
router['router']['id'])
self.assertFalse(router['router']['distributed'])
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index fda8fc3..fa6fa33 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -77,7 +77,6 @@
@classmethod
def resource_setup(cls):
super(BaseNetworkTest, cls).resource_setup()
- cls.network_cfg = CONF.network
cls.networks = []
cls.subnets = []
cls.ports = []
diff --git a/tempest/api/network/test_extensions.py b/tempest/api/network/test_extensions.py
index be7174b..d6b03eb 100644
--- a/tempest/api/network/test_extensions.py
+++ b/tempest/api/network/test_extensions.py
@@ -39,7 +39,8 @@
'ext-gw-mode', 'binding', 'quotas',
'agent', 'dhcp_agent_scheduler', 'provider',
'router', 'extraroute', 'external-net',
- 'allowed-address-pairs', 'extra_dhcp_opt']
+ 'allowed-address-pairs', 'extra_dhcp_opt',
+ 'metering', 'dvr']
expected_alias = [ext for ext in expected_alias if
test.is_extension_enabled(ext, 'network')]
actual_alias = list()
diff --git a/tempest/api/network/test_floating_ips.py b/tempest/api/network/test_floating_ips.py
index f0923d2..4b4a4e2 100644
--- a/tempest/api/network/test_floating_ips.py
+++ b/tempest/api/network/test_floating_ips.py
@@ -25,7 +25,7 @@
class FloatingIPTestJSON(base.BaseNetworkTest):
"""
- Tests the following operations in the Quantum API using the REST client for
+ Tests the following operations in the Neutron API using the REST client for
Neutron:
Create a Floating IP
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index 842a56d..1116573 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -27,7 +27,7 @@
CONF = config.CONF
-class NetworksTestJSON(base.BaseNetworkTest):
+class NetworksTest(base.BaseNetworkTest):
"""
Tests the following operations in the Neutron API using the REST client for
Neutron:
@@ -61,12 +61,11 @@
@classmethod
def resource_setup(cls):
- super(NetworksTestJSON, cls).resource_setup()
+ super(NetworksTest, cls).resource_setup()
cls.network = cls.create_network()
cls.name = cls.network['name']
cls.subnet = cls._create_subnet_with_last_subnet_block(cls.network,
cls._ip_version)
- cls.cidr = cls.subnet['cidr']
cls._subnet_data = {6: {'gateway':
str(cls._get_gateway_from_tempest_conf(6)),
'allocation_pools':
@@ -534,7 +533,7 @@
_ip_version = 6
-class NetworksIpV6TestJSON(NetworksTestJSON):
+class NetworksIpV6TestJSON(NetworksTest):
_ip_version = 6
@test.idempotent_id('e41a4888-65a6-418c-a095-f7c2ef4ad59a')
diff --git a/tempest/api/network/test_networks_negative.py b/tempest/api/network/test_networks_negative.py
index 5dc1c21..94c3f9a 100644
--- a/tempest/api/network/test_networks_negative.py
+++ b/tempest/api/network/test_networks_negative.py
@@ -26,35 +26,35 @@
@test.attr(type=['negative'])
@test.idempotent_id('9293e937-824d-42d2-8d5b-e985ea67002a')
def test_show_non_existent_network(self):
- non_exist_id = data_utils.rand_name('network')
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.show_network,
non_exist_id)
@test.attr(type=['negative'])
@test.idempotent_id('d746b40c-5e09-4043-99f7-cba1be8b70df')
def test_show_non_existent_subnet(self):
- non_exist_id = data_utils.rand_name('subnet')
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.show_subnet,
non_exist_id)
@test.attr(type=['negative'])
@test.idempotent_id('a954861d-cbfd-44e8-b0a9-7fab111f235d')
def test_show_non_existent_port(self):
- non_exist_id = data_utils.rand_name('port')
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.show_port,
non_exist_id)
@test.attr(type=['negative'])
@test.idempotent_id('98bfe4e3-574e-4012-8b17-b2647063de87')
def test_update_non_existent_network(self):
- non_exist_id = data_utils.rand_name('network')
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.update_network,
non_exist_id, name="new_name")
@test.attr(type=['negative'])
@test.idempotent_id('03795047-4a94-4120-a0a1-bd376e36fd4e')
def test_delete_non_existent_network(self):
- non_exist_id = data_utils.rand_name('network')
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.delete_network,
non_exist_id)
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 78b51c8..aa3d274 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -275,13 +275,13 @@
next_cidr = netaddr.IPNetwork(self.tenant_cidr)
# Prepare to build several routes
test_routes = []
- routes_num = 5
+ routes_num = 4
# Create a router
- self.router = self._create_router(
+ router = self._create_router(
data_utils.rand_name('router-'), True)
self.addCleanup(
self._delete_extra_routes,
- self.router['id'])
+ router['id'])
# Update router extra route, second ip of the range is
# used as next hop
for i in range(routes_num):
@@ -290,7 +290,7 @@
next_cidr = next_cidr.next()
# Add router interface with subnet id
- self.create_router_interface(self.router['id'], subnet['id'])
+ self.create_router_interface(router['id'], subnet['id'])
cidr = netaddr.IPNetwork(subnet['cidr'])
next_hop = str(cidr[2])
@@ -300,9 +300,9 @@
)
test_routes.sort(key=lambda x: x['destination'])
- extra_route = self.client.update_extra_routes(self.router['id'],
+ extra_route = self.client.update_extra_routes(router['id'],
test_routes)
- show_body = self.client.show_router(self.router['id'])
+ show_body = self.client.show_router(router['id'])
# Assert the number of routes
self.assertEqual(routes_num, len(extra_route['router']['routes']))
self.assertEqual(routes_num, len(show_body['router']['routes']))
@@ -327,13 +327,13 @@
@test.idempotent_id('a8902683-c788-4246-95c7-ad9c6d63a4d9')
def test_update_router_admin_state(self):
- self.router = self._create_router(data_utils.rand_name('router-'))
- self.assertFalse(self.router['admin_state_up'])
+ router = self._create_router(data_utils.rand_name('router-'))
+ self.assertFalse(router['admin_state_up'])
# Update router admin state
- update_body = self.client.update_router(self.router['id'],
+ update_body = self.client.update_router(router['id'],
admin_state_up=True)
self.assertTrue(update_body['router']['admin_state_up'])
- show_body = self.client.show_router(self.router['id'])
+ show_body = self.client.show_router(router['id'])
self.assertTrue(show_body['router']['admin_state_up'])
@test.attr(type='smoke')
diff --git a/tempest/api/object_storage/test_container_services.py b/tempest/api/object_storage/test_container_services.py
index 0f107f5..1cc9437 100644
--- a/tempest/api/object_storage/test_container_services.py
+++ b/tempest/api/object_storage/test_container_services.py
@@ -321,7 +321,7 @@
self.assertNotIn('x-container-meta-', str(resp))
@test.idempotent_id('cf19bc0b-7e16-4a5a-aaed-cb0c2fe8deef')
- def test_update_container_metadata_with_create_and_delete_matadata(self):
+ def test_update_container_metadata_with_create_and_delete_metadata(self):
# Send one request of adding and deleting metadata
container_name = data_utils.rand_name(name='TestContainer')
metadata_1 = {'test-container-meta1': 'Meta1'}
@@ -379,8 +379,8 @@
self.assertNotIn('x-container-meta-test-container-meta1', resp)
@test.idempotent_id('31f40a5f-6a52-4314-8794-cd89baed3040')
- def test_update_container_metadata_with_create_matadata_key(self):
- # update container metadata with a blenk value of metadata
+ def test_update_container_metadata_with_create_metadata_key(self):
+ # update container metadata with a blank value of metadata
container_name = self._create_container()
metadata = {'test-container-meta1': ''}
@@ -395,7 +395,7 @@
@test.idempotent_id('a2e36378-6f1f-43f4-840a-ffd9cfd61914')
def test_update_container_metadata_with_delete_metadata_key(self):
- # update container metadata with a blank value of matadata
+ # update container metadata with a blank value of metadata
container_name = data_utils.rand_name(name='TestContainer')
metadata = {'test-container-meta1': 'Meta1'}
self.container_client.create_container(container_name,
diff --git a/tempest/api/object_storage/test_object_services.py b/tempest/api/object_storage/test_object_services.py
index 2198753..d64efee 100644
--- a/tempest/api/object_storage/test_object_services.py
+++ b/tempest/api/object_storage/test_object_services.py
@@ -811,7 +811,7 @@
@test.idempotent_id('aa467252-44f3-472a-b5ae-5b57c3c9c147')
def test_copy_object_across_containers(self):
- # create a container to use as asource container
+ # create a container to use as a source container
src_container_name = data_utils.rand_name(name='TestSourceContainer')
self.container_client.create_container(src_container_name)
self.containers.append(src_container_name)
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 6578680..5b6b0fa 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -96,7 +96,7 @@
@classmethod
def _create_keypair(cls, name_start='keypair-heat-'):
kp_name = data_utils.rand_name(name_start)
- body = cls.keypairs_client.create_keypair(name=kp_name)
+ body = cls.keypairs_client.create_keypair(name=kp_name)['keypair']
cls.keypairs.append(kp_name)
return body
@@ -163,7 +163,7 @@
def list_resources(self, stack_identifier):
"""Get a dict mapping of resource names to types."""
- resources = self.client.list_resources(stack_identifier)
+ resources = self.client.list_resources(stack_identifier)['resources']
self.assertIsInstance(resources, list)
for res in resources:
self.assert_fields_in_dict(res, 'logical_resource_id',
@@ -174,5 +174,5 @@
for r in resources)
def get_stack_output(self, stack_identifier, output_key):
- body = self.client.show_stack(stack_identifier)
+ body = self.client.show_stack(stack_identifier)['stack']
return self.stack_output(body, output_key)
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index b27d6c9..cb6d1db 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -75,7 +75,8 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
try:
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
- resources = cls.client.list_resources(cls.stack_identifier)
+ resources = (cls.client.list_resources(cls.stack_identifier)
+ ['resources'])
except exceptions.TimeoutException as e:
if CONF.compute_feature_enabled.console_output:
# attempt to log the server console to help with debugging
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index 494b6fd..e37587c 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -47,7 +47,7 @@
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
def _list_stacks(self, expected_num=None, **filter_kwargs):
- stacks = self.client.list_stacks(params=filter_kwargs)
+ stacks = self.client.list_stacks(params=filter_kwargs)['stacks']
self.assertIsInstance(stacks, list)
if expected_num is not None:
self.assertEqual(expected_num, len(stacks))
@@ -63,7 +63,7 @@
@test.idempotent_id('992f96e3-41ee-4ff6-91c7-bcfb670c0919')
def test_stack_show(self):
"""Getting details about created stack should be possible."""
- stack = self.client.show_stack(self.stack_name)
+ stack = self.client.show_stack(self.stack_name)['stack']
self.assertIsInstance(stack, dict)
self.assert_fields_in_dict(stack, 'stack_name', 'id', 'links',
'parameters', 'outputs', 'disable_rollback',
@@ -100,7 +100,7 @@
def test_show_resource(self):
"""Getting details about created resource should be possible."""
resource = self.client.show_resource(self.stack_identifier,
- self.resource_name)
+ self.resource_name)['resource']
self.assertIsInstance(resource, dict)
self.assert_fields_in_dict(resource, 'resource_name', 'description',
'links', 'logical_resource_id',
@@ -115,14 +115,14 @@
"""Getting metadata for created resources should be possible."""
metadata = self.client.show_resource_metadata(
self.stack_identifier,
- self.resource_name)
+ self.resource_name)['metadata']
self.assertIsInstance(metadata, dict)
self.assertEqual(['Tom', 'Stinky'], metadata.get('kittens', None))
@test.idempotent_id('46567533-0a7f-483b-8942-fa19e0f17839')
def test_list_events(self):
"""Getting list of created events for the stack should be possible."""
- events = self.client.list_events(self.stack_identifier)
+ events = self.client.list_events(self.stack_identifier)['events']
self.assertIsInstance(events, list)
for event in events:
@@ -138,12 +138,12 @@
def test_show_event(self):
"""Getting details about an event should be possible."""
events = self.client.list_resource_events(self.stack_identifier,
- self.resource_name)
+ self.resource_name)['events']
self.assertNotEqual([], events)
events.sort(key=lambda event: event['event_time'])
event_id = events[0]['id']
event = self.client.show_event(self.stack_identifier,
- self.resource_name, event_id)
+ self.resource_name, event_id)['event']
self.assertIsInstance(event, dict)
self.assert_fields_in_dict(event, 'resource_name', 'event_time',
'links', 'logical_resource_id',
diff --git a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
index 6a04dbd..b4d7fa0 100644
--- a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
+++ b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
@@ -43,7 +43,8 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
- resources = cls.client.list_resources(cls.stack_identifier)
+ resources = (cls.client.list_resources(cls.stack_identifier)
+ ['resources'])
cls.test_resources = {}
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
@@ -70,7 +71,7 @@
@test.idempotent_id('8d77dec7-91fd-45a6-943d-5abd45e338a4')
def test_stack_keypairs_output(self):
- stack = self.client.show_stack(self.stack_name)
+ stack = self.client.show_stack(self.stack_name)['stack']
self.assertIsInstance(stack, dict)
output_map = {}
diff --git a/tempest/api/orchestration/stacks/test_resource_types.py b/tempest/api/orchestration/stacks/test_resource_types.py
index 8f15f9c..8cf40de 100644
--- a/tempest/api/orchestration/stacks/test_resource_types.py
+++ b/tempest/api/orchestration/stacks/test_resource_types.py
@@ -20,7 +20,7 @@
@test.idempotent_id('7123d082-3577-4a30-8f00-f805327c4ffd')
def test_resource_type_list(self):
"""Verify it is possible to list resource types."""
- resource_types = self.client.list_resource_types()
+ resource_types = self.client.list_resource_types()['resource_types']
self.assertIsInstance(resource_types, list)
self.assertIn('OS::Nova::Server', resource_types)
@@ -28,7 +28,7 @@
@test.idempotent_id('0e85a483-828b-4a28-a0e3-f0a21809192b')
def test_resource_type_show(self):
"""Verify it is possible to get schema about resource types."""
- resource_types = self.client.list_resource_types()
+ resource_types = self.client.list_resource_types()['resource_types']
self.assertNotEmpty(resource_types)
for resource_type in resource_types:
diff --git a/tempest/api/orchestration/stacks/test_stacks.py b/tempest/api/orchestration/stacks/test_stacks.py
index abec906..f766b00 100644
--- a/tempest/api/orchestration/stacks/test_stacks.py
+++ b/tempest/api/orchestration/stacks/test_stacks.py
@@ -30,7 +30,7 @@
@test.attr(type='smoke')
@test.idempotent_id('d35d628c-07f6-4674-85a1-74db9919e986')
def test_stack_list_responds(self):
- stacks = self.client.list_stacks()
+ stacks = self.client.list_stacks()['stacks']
self.assertIsInstance(stacks, list)
@test.attr(type='smoke')
@@ -47,20 +47,20 @@
self.client.wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
# check for stack in list
- stacks = self.client.list_stacks()
+ stacks = self.client.list_stacks()['stacks']
list_ids = list([stack['id'] for stack in stacks])
self.assertIn(stack_id, list_ids)
# fetch the stack
- stack = self.client.show_stack(stack_identifier)
+ stack = self.client.show_stack(stack_identifier)['stack']
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# fetch the stack by name
- stack = self.client.show_stack(stack_name)
+ stack = self.client.show_stack(stack_name)['stack']
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# fetch the stack by id
- stack = self.client.show_stack(stack_id)
+ stack = self.client.show_stack(stack_id)['stack']
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# delete the stack
diff --git a/tempest/api/orchestration/stacks/test_swift_resources.py b/tempest/api/orchestration/stacks/test_swift_resources.py
index 30166df..c0f1c4b 100644
--- a/tempest/api/orchestration/stacks/test_swift_resources.py
+++ b/tempest/api/orchestration/stacks/test_swift_resources.py
@@ -55,7 +55,8 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
cls.test_resources = {}
- resources = cls.client.list_resources(cls.stack_identifier)
+ resources = (cls.client.list_resources(cls.stack_identifier)
+ ['resources'])
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
diff --git a/tempest/api/orchestration/stacks/test_volumes.py b/tempest/api/orchestration/stacks/test_volumes.py
index d8f117e..4ba38ad 100644
--- a/tempest/api/orchestration/stacks/test_volumes.py
+++ b/tempest/api/orchestration/stacks/test_volumes.py
@@ -34,7 +34,7 @@
def _cinder_verify(self, volume_id, template):
self.assertIsNotNone(volume_id)
- volume = self.volumes_client.show_volume(volume_id)
+ volume = self.volumes_client.show_volume(volume_id)['volume']
self.assertEqual('available', volume.get('status'))
self.assertEqual(template['resources']['volume']['properties'][
'size'], volume.get('size'))
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 0f9b7dd..8f07614 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -15,6 +15,7 @@
from oslo_utils import timeutils
from tempest_lib import exceptions as lib_exc
+from tempest.common import compute
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
@@ -73,9 +74,11 @@
@classmethod
def create_server(cls):
- body = cls.servers_client.create_server(
- data_utils.rand_name('ceilometer-instance'),
- CONF.compute.image_ref, CONF.compute.flavor_ref,
+ tenant_network = cls.get_tenant_network()
+ body, server = compute.create_test_server(
+ cls.os,
+ tenant_network=tenant_network,
+ name=data_utils.rand_name('ceilometer-instance'),
wait_until='ACTIVE')
cls.server_ids.append(body['id'])
return body
@@ -85,6 +88,11 @@
body = client.create_image(
data_utils.rand_name('image'), container_format='bare',
disk_format='raw', visibility='private')
+ # TODO(jswarren) Move ['image'] up to initial body value assignment
+ # once both v1 and v2 glance clients include the full response
+ # object.
+ if 'image' in body:
+ body = body['image']
cls.image_ids.append(body['id'])
return body
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 71a00c9..31eff9d 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -22,13 +22,6 @@
class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
- @classmethod
- def skip_checks(cls):
- super(TelemetryNotificationAPITestJSON, cls).skip_checks()
- if CONF.telemetry.too_slow_to_test:
- raise cls.skipException("Ceilometer feature for fast work mysql "
- "is disabled")
-
@test.idempotent_id('d7f8c1c8-d470-4731-8604-315d3956caad')
@test.services('compute')
def test_check_nova_notification(self):
@@ -75,13 +68,6 @@
class TelemetryNotificationAdminAPITestJSON(base.BaseTelemetryAdminTest):
- @classmethod
- def skip_checks(cls):
- super(TelemetryNotificationAdminAPITestJSON, cls).skip_checks()
- if CONF.telemetry.too_slow_to_test:
- raise cls.skipException("Ceilometer feature for fast work mysql "
- "is disabled")
-
@test.idempotent_id('29604198-8b45-4fc0-8af8-1cae4f94ebe9')
@test.services('compute')
@decorators.skip_because(bug='1480490')
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index c7e989d..4337922 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -66,12 +66,13 @@
else:
extra_specs = {spec_key_without_prefix: backend_name_key}
self.type = self.volume_types_client.create_volume_type(
- type_name, extra_specs=extra_specs)
+ type_name, extra_specs=extra_specs)['volume_type']
self.volume_type_id_list.append(self.type['id'])
params = {self.name_field: vol_name, 'volume_type': type_name}
- self.volume = self.admin_volume_client.create_volume(**params)
+ self.volume = self.admin_volume_client.create_volume(
+ **params)['volume']
if with_prefix:
self.volume_id_list_with_prefix.append(self.volume['id'])
else:
@@ -135,7 +136,7 @@
# the multi backend feature has been enabled
# if multi-backend is enabled: os-vol-attr:host should be like:
# host@backend_name
- volume = self.admin_volume_client.show_volume(volume_id)
+ volume = self.admin_volume_client.show_volume(volume_id)['volume']
volume1_host = volume['os-vol-host-attr:host']
msg = ("multi-backend reporting incorrect values for volume %s" %
@@ -146,10 +147,10 @@
# this test checks that the two volumes created at setUp don't
# belong to the same backend (if they are, than the
# volume backend distinction is not working properly)
- volume = self.admin_volume_client.show_volume(volume1_id)
+ volume = self.admin_volume_client.show_volume(volume1_id)['volume']
volume1_host = volume['os-vol-host-attr:host']
- volume = self.admin_volume_client.show_volume(volume2_id)
+ volume = self.admin_volume_client.show_volume(volume2_id)['volume']
volume2_host = volume['os-vol-host-attr:host']
msg = ("volumes %s and %s were created in the same backend" %
diff --git a/tempest/api/volume/admin/test_snapshots_actions.py b/tempest/api/volume/admin/test_snapshots_actions.py
index c860b4b..784f1b6 100644
--- a/tempest/api/volume/admin/test_snapshots_actions.py
+++ b/tempest/api/volume/admin/test_snapshots_actions.py
@@ -34,15 +34,15 @@
cls.name_field = cls.special_fields['name_field']
params = {cls.name_field: vol_name}
cls.volume = \
- cls.volumes_client.create_volume(**params)
+ cls.volumes_client.create_volume(**params)['volume']
cls.volumes_client.wait_for_volume_status(cls.volume['id'],
'available')
# Create a test shared snapshot for tests
snap_name = data_utils.rand_name(cls.__name__ + '-Snapshot')
params = {cls.name_field: snap_name}
- cls.snapshot = \
- cls.client.create_snapshot(cls.volume['id'], **params)
+ cls.snapshot = cls.client.create_snapshot(
+ cls.volume['id'], **params)['snapshot']
cls.client.wait_for_snapshot_status(cls.snapshot['id'],
'available')
@@ -86,8 +86,8 @@
status = 'creating'
self.admin_snapshots_client.\
reset_snapshot_status(self.snapshot['id'], status)
- snapshot_get \
- = self.admin_snapshots_client.show_snapshot(self.snapshot['id'])
+ snapshot_get = self.admin_snapshots_client.show_snapshot(
+ self.snapshot['id'])['snapshot']
self.assertEqual(status, snapshot_get['status'])
@test.idempotent_id('41288afd-d463-485e-8f6e-4eea159413eb')
@@ -103,8 +103,8 @@
progress_alias = self._get_progress_alias()
self.client.update_snapshot_status(self.snapshot['id'],
status, progress)
- snapshot_get \
- = self.admin_snapshots_client.show_snapshot(self.snapshot['id'])
+ snapshot_get = self.admin_snapshots_client.show_snapshot(
+ self.snapshot['id'])['snapshot']
self.assertEqual(status, snapshot_get['status'])
self.assertEqual(progress, snapshot_get[progress_alias])
diff --git a/tempest/api/volume/admin/test_volume_hosts.py b/tempest/api/volume/admin/test_volume_hosts.py
index dd14d8c..b28488a 100644
--- a/tempest/api/volume/admin/test_volume_hosts.py
+++ b/tempest/api/volume/admin/test_volume_hosts.py
@@ -21,7 +21,7 @@
@test.idempotent_id('d5f3efa2-6684-4190-9ced-1c2f526352ad')
def test_list_hosts(self):
- hosts = self.hosts_client.list_hosts()
+ hosts = self.hosts_client.list_hosts()['hosts']
self.assertTrue(len(hosts) >= 2, "No. of hosts are < 2,"
"response of list hosts is: % s" % hosts)
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index 1a48204..f9117ed 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -32,14 +32,15 @@
@test.idempotent_id('59eada70-403c-4cef-a2a3-a8ce2f1b07a0')
def test_list_quotas(self):
- quotas = self.quotas_client.show_quota_set(self.demo_tenant_id)
+ quotas = (self.quotas_client.show_quota_set(self.demo_tenant_id)
+ ['quota_set'])
for key in QUOTA_KEYS:
self.assertIn(key, quotas)
@test.idempotent_id('2be020a2-5fdd-423d-8d35-a7ffbc36e9f7')
def test_list_default_quotas(self):
quotas = self.quotas_client.show_default_quota_set(
- self.demo_tenant_id)
+ self.demo_tenant_id)['quota_set']
for key in QUOTA_KEYS:
self.assertIn(key, quotas)
@@ -47,7 +48,7 @@
def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant
default_quota_set = self.quotas_client.show_default_quota_set(
- self.demo_tenant_id)
+ self.demo_tenant_id)['quota_set']
new_quota_set = {'gigabytes': 1009,
'volumes': 11,
'snapshots': 11}
@@ -55,7 +56,7 @@
# Update limits for all quota resources
quota_set = self.quotas_client.update_quota_set(
self.demo_tenant_id,
- **new_quota_set)
+ **new_quota_set)['quota_set']
cleanup_quota_set = dict(
(k, v) for k, v in six.iteritems(default_quota_set)
@@ -70,7 +71,7 @@
@test.idempotent_id('18c51ae9-cb03-48fc-b234-14a19374dbed')
def test_show_quota_usage(self):
quota_usage = self.quotas_client.show_quota_usage(
- self.os_adm.credentials.tenant_id)
+ self.os_adm.credentials.tenant_id)['quota_set']
for key in QUOTA_KEYS:
self.assertIn(key, quota_usage)
for usage_key in QUOTA_USAGE_KEYS:
@@ -79,14 +80,14 @@
@test.idempotent_id('ae8b6091-48ad-4bfa-a188-bbf5cc02115f')
def test_quota_usage(self):
quota_usage = self.quotas_client.show_quota_usage(
- self.demo_tenant_id)
+ self.demo_tenant_id)['quota_set']
volume = self.create_volume()
self.addCleanup(self.admin_volume_client.delete_volume,
volume['id'])
new_quota_usage = self.quotas_client.show_quota_usage(
- self.demo_tenant_id)
+ self.demo_tenant_id)['quota_set']
self.assertEqual(quota_usage['volumes']['in_use'] + 1,
new_quota_usage['volumes']['in_use'])
@@ -104,14 +105,15 @@
tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id)
quota_set_default = self.quotas_client.show_default_quota_set(
- tenant_id)
+ tenant_id)['quota_set']
volume_default = quota_set_default['volumes']
self.quotas_client.update_quota_set(tenant_id,
volumes=(int(volume_default) + 5))
self.quotas_client.delete_quota_set(tenant_id)
- quota_set_new = self.quotas_client.show_quota_set(tenant_id)
+ quota_set_new = (self.quotas_client.show_quota_set(tenant_id)
+ ['quota_set'])
self.assertEqual(volume_default, quota_set_new['volumes'])
diff --git a/tempest/api/volume/admin/test_volume_services.py b/tempest/api/volume/admin/test_volume_services.py
index 4f80a31..74fffb9 100644
--- a/tempest/api/volume/admin/test_volume_services.py
+++ b/tempest/api/volume/admin/test_volume_services.py
@@ -26,19 +26,22 @@
@classmethod
def resource_setup(cls):
super(VolumesServicesV2TestJSON, cls).resource_setup()
- cls.services = cls.admin_volume_services_client.list_services()
+ cls.services = (cls.admin_volume_services_client.list_services()
+ ['services'])
cls.host_name = cls.services[0]['host']
cls.binary_name = cls.services[0]['binary']
@test.idempotent_id('e0218299-0a59-4f43-8b2b-f1c035b3d26d')
def test_list_services(self):
- services = self.admin_volume_services_client.list_services()
+ services = (self.admin_volume_services_client.list_services()
+ ['services'])
self.assertNotEqual(0, len(services))
@test.idempotent_id('63a3e1ca-37ee-4983-826d-83276a370d25')
def test_get_service_by_service_binary_name(self):
params = {'binary': self.binary_name}
- services = self.admin_volume_services_client.list_services(params)
+ services = (self.admin_volume_services_client.list_services(params)
+ ['services'])
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(self.binary_name, service['binary'])
@@ -49,7 +52,8 @@
service['host'] == self.host_name]
params = {'host': self.host_name}
- services = self.admin_volume_services_client.list_services(params)
+ services = (self.admin_volume_services_client.list_services(params)
+ ['services'])
# we could have a periodic job checkin between the 2 service
# lookups, so only compare binary lists.
@@ -63,7 +67,8 @@
def test_get_service_by_service_and_host_name(self):
params = {'host': self.host_name, 'binary': self.binary_name}
- services = self.admin_volume_services_client.list_services(params)
+ services = (self.admin_volume_services_client.list_services(params)
+ ['services'])
self.assertEqual(1, len(services))
self.assertEqual(self.host_name, services[0]['host'])
self.assertEqual(self.binary_name, services[0]['binary'])
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index b79c185..2d9019a 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -33,7 +33,7 @@
@test.idempotent_id('9d9b28e3-1b2e-4483-a2cc-24aa0ea1de54')
def test_volume_type_list(self):
# List Volume types.
- body = self.volume_types_client.list_volume_types()
+ body = self.volume_types_client.list_volume_types()['volume_types']
self.assertIsInstance(body, list)
@test.idempotent_id('c03cc62c-f4e9-4623-91ec-64ce2f9c1260')
@@ -51,14 +51,14 @@
vol_type_name = data_utils.rand_name("volume-type")
vol_type = self.volume_types_client.create_volume_type(
vol_type_name,
- extra_specs=extra_specs)
+ extra_specs=extra_specs)['volume_type']
volume_types.append(vol_type)
self.addCleanup(self._delete_volume_type, vol_type['id'])
params = {self.name_field: vol_name,
'volume_type': volume_types[0]['id']}
# Create volume
- volume = self.volumes_client.create_volume(**params)
+ volume = self.volumes_client.create_volume(**params)['volume']
self.addCleanup(self._delete_volume, volume['id'])
self.assertEqual(volume_types[0]['name'], volume["volume_type"])
self.assertEqual(volume[self.name_field], vol_name,
@@ -74,7 +74,8 @@
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
# Get volume details and Verify
- fetched_volume = self.volumes_client.show_volume(volume['id'])
+ fetched_volume = self.volumes_client.show_volume(
+ volume['id'])['volume']
self.assertEqual(volume_types[1]['name'],
fetched_volume['volume_type'],
'The fetched Volume type is different '
@@ -97,7 +98,7 @@
"vendor_name": vendor}
body = self.volume_types_client.create_volume_type(
name,
- extra_specs=extra_specs)
+ extra_specs=extra_specs)['volume_type']
self.assertIn('id', body)
self.addCleanup(self._delete_volume_type, body['id'])
self.assertIn('name', body)
@@ -107,7 +108,7 @@
self.assertTrue(body['id'] is not None,
"Field volume_type id is empty or not found.")
fetched_volume_type = self.volume_types_client.show_volume_type(
- body['id'])
+ body['id'])['volume_type']
self.assertEqual(name, fetched_volume_type['name'],
'The fetched Volume_type is different '
'from the created Volume_type')
@@ -124,13 +125,13 @@
provider = "LuksEncryptor"
control_location = "front-end"
name = data_utils.rand_name("volume-type")
- body = self.volume_types_client.create_volume_type(name)
+ body = self.volume_types_client.create_volume_type(name)['volume_type']
self.addCleanup(self._delete_volume_type, body['id'])
# Create encryption type
encryption_type = self.volume_types_client.create_encryption_type(
body['id'], provider=provider,
- control_location=control_location)
+ control_location=control_location)['encryption']
self.assertIn('volume_type_id', encryption_type)
self.assertEqual(provider, encryption_type['provider'],
"The created encryption_type provider is not equal "
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs.py b/tempest/api/volume/admin/test_volume_types_extra_specs.py
index c840697..bec803c 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs.py
@@ -25,7 +25,7 @@
super(VolumeTypesExtraSpecsV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type')
cls.volume_type = cls.volume_types_client.create_volume_type(
- vol_type_name)
+ vol_type_name)['volume_type']
@classmethod
def resource_cleanup(cls):
@@ -37,11 +37,11 @@
# List Volume types extra specs.
extra_specs = {"spec1": "val1"}
body = self.volume_types_client.create_volume_type_extra_specs(
- self.volume_type['id'], extra_specs)
+ self.volume_type['id'], extra_specs)['extra_specs']
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
body = self.volume_types_client.list_volume_types_extra_specs(
- self.volume_type['id'])
+ self.volume_type['id'])['extra_specs']
self.assertIsInstance(body, dict)
self.assertIn('spec1', body)
@@ -50,7 +50,7 @@
# Update volume type extra specs
extra_specs = {"spec2": "val1"}
body = self.volume_types_client.create_volume_type_extra_specs(
- self.volume_type['id'], extra_specs)
+ self.volume_type['id'], extra_specs)['extra_specs']
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
@@ -69,7 +69,7 @@
extra_specs = {"spec3": "val1"}
body = self.volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'],
- extra_specs)
+ extra_specs)['extra_specs']
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
index e49e8b2..040ef53 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
@@ -31,7 +31,7 @@
cls.extra_specs = {"spec1": "val1"}
cls.volume_type = cls.volume_types_client.create_volume_type(
vol_type_name,
- extra_specs=cls.extra_specs)
+ extra_specs=cls.extra_specs)['volume_type']
@classmethod
def resource_cleanup(cls):
diff --git a/tempest/api/volume/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py
index 4288d58..6c32321 100644
--- a/tempest/api/volume/admin/test_volumes_actions.py
+++ b/tempest/api/volume/admin/test_volumes_actions.py
@@ -34,7 +34,7 @@
cls.name_field = cls.special_fields['name_field']
params = {cls.name_field: vol_name}
- cls.volume = cls.client.create_volume(**params)
+ cls.volume = cls.client.create_volume(**params)['volume']
cls.client.wait_for_volume_status(cls.volume['id'], 'available')
@classmethod
@@ -60,7 +60,7 @@
# Create a temp volume for force delete tests
vol_name = utils.rand_name('Volume')
params = {self.name_field: vol_name}
- temp_volume = self.client.create_volume(**params)
+ temp_volume = self.client.create_volume(**params)['volume']
self.client.wait_for_volume_status(temp_volume['id'], 'available')
return temp_volume
@@ -78,7 +78,7 @@
# test volume reset status : available->error->available
self._reset_volume_status(self.volume['id'], 'error')
volume_get = self.admin_volume_client.show_volume(
- self.volume['id'])
+ self.volume['id'])['volume']
self.assertEqual('error', volume_get['status'])
@test.idempotent_id('21737d5a-92f2-46d7-b009-a0cc0ee7a570')
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index 8015c35..0399413 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -14,6 +14,7 @@
# under the License.
from oslo_log import log as logging
+from tempest_lib import decorators
from tempest.api.volume import base
from tempest.common.utils import data_utils
@@ -48,7 +49,7 @@
backup_name = data_utils.rand_name('Backup')
create_backup = self.backups_adm_client.create_backup
backup = create_backup(self.volume['id'],
- name=backup_name)
+ name=backup_name)['backup']
self.addCleanup(self.backups_adm_client.delete_backup,
backup['id'])
self.assertEqual(backup_name, backup['name'])
@@ -58,16 +59,17 @@
'available')
# Get a given backup
- backup = self.backups_adm_client.show_backup(backup['id'])
+ backup = self.backups_adm_client.show_backup(backup['id'])['backup']
self.assertEqual(backup_name, backup['name'])
# Get all backups with detail
- backups = self.backups_adm_client.list_backups(detail=True)
+ backups = self.backups_adm_client.list_backups(detail=True)['backups']
self.assertIn((backup['name'], backup['id']),
[(m['name'], m['id']) for m in backups])
# Restore backup
- restore = self.backups_adm_client.restore_backup(backup['id'])
+ restore = self.backups_adm_client.restore_backup(
+ backup['id'])['restore']
# Delete backup
self.addCleanup(self.admin_volume_client.delete_volume,
@@ -78,19 +80,22 @@
self.admin_volume_client.wait_for_volume_status(
restore['volume_id'], 'available')
+ @decorators.skip_because(bug='1455043')
@test.idempotent_id('a99c54a1-dd80-4724-8a13-13bf58d4068d')
def test_volume_backup_export_import(self):
# Create backup
backup_name = data_utils.rand_name('Backup')
- backup = self.backups_adm_client.create_backup(self.volume['id'],
- name=backup_name)
+ backup = (self.backups_adm_client.create_backup(self.volume['id'],
+ name=backup_name)
+ ['backup'])
self.addCleanup(self._delete_backup, backup['id'])
self.assertEqual(backup_name, backup['name'])
self.backups_adm_client.wait_for_backup_status(backup['id'],
'available')
# Export Backup
- export_backup = self.backups_adm_client.export_backup(backup['id'])
+ export_backup = (self.backups_adm_client.export_backup(backup['id'])
+ ['backup-record'])
self.assertIn('backup_service', export_backup)
self.assertIn('backup_url', export_backup)
self.assertTrue(export_backup['backup_service'].startswith(
@@ -100,18 +105,19 @@
# Import Backup
import_backup = self.backups_adm_client.import_backup(
backup_service=export_backup['backup_service'],
- backup_url=export_backup['backup_url'])
+ backup_url=export_backup['backup_url'])['backup']
self.addCleanup(self._delete_backup, import_backup['id'])
self.assertIn("id", import_backup)
self.backups_adm_client.wait_for_backup_status(import_backup['id'],
'available')
# Verify Import Backup
- backups = self.backups_adm_client.list_backups(detail=True)
+ backups = self.backups_adm_client.list_backups(detail=True)['backups']
self.assertIn(import_backup['id'], [b['id'] for b in backups])
# Restore backup
- restore = self.backups_adm_client.restore_backup(import_backup['id'])
+ restore = (self.backups_adm_client.restore_backup(import_backup['id'])
+ ['restore'])
self.addCleanup(self.admin_volume_client.delete_volume,
restore['volume_id'])
self.assertEqual(import_backup['id'], restore['backup_id'])
@@ -119,7 +125,7 @@
'available')
# Verify if restored volume is there in volume list
- volumes = self.admin_volume_client.list_volumes()
+ volumes = self.admin_volume_client.list_volumes()['volumes']
self.assertIn(restore['volume_id'], [v['id'] for v in volumes])
self.backups_adm_client.wait_for_backup_status(import_backup['id'],
'available')
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index b67a6d2..cc020e3 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -16,7 +16,7 @@
from oslo_log import log as logging
from tempest_lib import exceptions as lib_exc
-from tempest.common import fixed_network
+from tempest.common import compute
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
@@ -113,7 +113,7 @@
name_field = cls.special_fields['name_field']
kwargs[name_field] = name
- volume = cls.volumes_client.create_volume(size, **kwargs)
+ volume = cls.volumes_client.create_volume(size, **kwargs)['volume']
cls.volumes.append(volume)
cls.volumes_client.wait_for_volume_status(volume['id'], 'available')
@@ -122,8 +122,8 @@
@classmethod
def create_snapshot(cls, volume_id=1, **kwargs):
"""Wrapper utility that returns a test snapshot."""
- snapshot = cls.snapshots_client.create_snapshot(volume_id,
- **kwargs)
+ snapshot = cls.snapshots_client.create_snapshot(
+ volume_id, **kwargs)['snapshot']
cls.snapshots.append(snapshot)
cls.snapshots_client.wait_for_snapshot_status(snapshot['id'],
'available')
@@ -162,12 +162,13 @@
@classmethod
def create_server(cls, name, **kwargs):
- network = cls.get_tenant_network()
- network_kwargs = fixed_network.set_networks_kwarg(network, kwargs)
- return cls.servers_client.create_server(name,
- cls.image_ref,
- cls.flavor_ref,
- **network_kwargs)
+ tenant_network = cls.get_tenant_network()
+ body, _ = compute.create_test_server(
+ cls.os,
+ tenant_network=tenant_network,
+ name=name,
+ **kwargs)
+ return body
class BaseVolumeAdminTest(BaseVolumeTest):
@@ -217,7 +218,7 @@
name = name or data_utils.rand_name(cls.__name__ + '-QoS')
consumer = consumer or 'front-end'
qos_specs = cls.volume_qos_client.create_qos(name, consumer,
- **kwargs)
+ **kwargs)['qos_specs']
cls.qos_specs.append(qos_specs['id'])
return qos_specs
diff --git a/tempest/api/volume/test_availability_zone.py b/tempest/api/volume/test_availability_zone.py
index f188fa9..366b8d2 100644
--- a/tempest/api/volume/test_availability_zone.py
+++ b/tempest/api/volume/test_availability_zone.py
@@ -31,7 +31,8 @@
@test.idempotent_id('01f1ae88-eba9-4c6b-a011-6f7ace06b725')
def test_get_availability_zone_list(self):
# List of availability zone
- availability_zone = self.client.list_availability_zones()
+ availability_zone = (self.client.list_availability_zones()
+ ['availabilityZoneInfo'])
self.assertTrue(len(availability_zone) > 0)
diff --git a/tempest/api/volume/test_extensions.py b/tempest/api/volume/test_extensions.py
index 17db45f..cce9ace 100644
--- a/tempest/api/volume/test_extensions.py
+++ b/tempest/api/volume/test_extensions.py
@@ -30,7 +30,8 @@
@test.idempotent_id('94607eb0-43a5-47ca-82aa-736b41bd2e2c')
def test_list_extensions(self):
# List of all extensions
- extensions = self.volumes_extension_client.list_extensions()
+ extensions = (self.volumes_extension_client.list_extensions()
+ ['extensions'])
if len(CONF.volume_feature_enabled.api_extensions) == 0:
raise self.skipException('There are not any extensions configured')
extension_list = [extension.get('alias') for extension in extensions]
diff --git a/tempest/api/volume/test_qos.py b/tempest/api/volume/test_qos.py
index 84fd7f6..2f7c3df 100644
--- a/tempest/api/volume/test_qos.py
+++ b/tempest/api/volume/test_qos.py
@@ -47,13 +47,13 @@
self.volume_qos_client.wait_for_resource_deletion(body['id'])
# validate the deletion
- list_qos = self.volume_qos_client.list_qos()
+ list_qos = self.volume_qos_client.list_qos()['qos_specs']
self.assertNotIn(body, list_qos)
def _create_test_volume_type(self):
vol_type_name = utils.rand_name("volume-type")
vol_type = self.volume_types_client.create_volume_type(
- vol_type_name)
+ vol_type_name)['volume_type']
self.addCleanup(self.volume_types_client.delete_volume_type,
vol_type['id'])
return vol_type
@@ -64,7 +64,7 @@
def _test_get_association_qos(self):
body = self.volume_qos_client.show_association_qos(
- self.created_qos['id'])
+ self.created_qos['id'])['qos_associations']
associations = []
for association in body:
@@ -99,24 +99,27 @@
@test.idempotent_id('7aa214cc-ac1a-4397-931f-3bb2e83bb0fd')
def test_get_qos(self):
"""Tests the detail of a given qos-specs"""
- body = self.volume_qos_client.show_qos(self.created_qos['id'])
+ body = self.volume_qos_client.show_qos(
+ self.created_qos['id'])['qos_specs']
self.assertEqual(self.qos_name, body['name'])
self.assertEqual(self.qos_consumer, body['consumer'])
@test.idempotent_id('75e04226-bcf7-4595-a34b-fdf0736f38fc')
def test_list_qos(self):
"""Tests the list of all qos-specs"""
- body = self.volume_qos_client.list_qos()
+ body = self.volume_qos_client.list_qos()['qos_specs']
self.assertIn(self.created_qos, body)
@test.idempotent_id('ed00fd85-4494-45f2-8ceb-9e2048919aed')
def test_set_unset_qos_key(self):
"""Test the addition of a specs key to qos-specs"""
args = {'iops_bytes': '500'}
- body = self.volume_qos_client.set_qos_key(self.created_qos['id'],
- iops_bytes='500')
+ body = self.volume_qos_client.set_qos_key(
+ self.created_qos['id'],
+ iops_bytes='500')['qos_specs']
self.assertEqual(args, body)
- body = self.volume_qos_client.show_qos(self.created_qos['id'])
+ body = self.volume_qos_client.show_qos(
+ self.created_qos['id'])['qos_specs']
self.assertEqual(args['iops_bytes'], body['specs']['iops_bytes'])
# test the deletion of a specs key from qos-specs
@@ -125,7 +128,8 @@
operation = 'qos-key-unset'
self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'],
operation, keys)
- body = self.volume_qos_client.show_qos(self.created_qos['id'])
+ body = self.volume_qos_client.show_qos(
+ self.created_qos['id'])['qos_specs']
self.assertNotIn(keys[0], body['specs'])
@test.idempotent_id('1dd93c76-6420-485d-a771-874044c416ac')
diff --git a/tempest/api/volume/test_snapshot_metadata.py b/tempest/api/volume/test_snapshot_metadata.py
index 641317a..ce6ba90 100644
--- a/tempest/api/volume/test_snapshot_metadata.py
+++ b/tempest/api/volume/test_snapshot_metadata.py
@@ -48,16 +48,18 @@
"key3": "value3"}
expected = {"key2": "value2",
"key3": "value3"}
- body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(
+ self.snapshot_id, metadata)['metadata']
# Get the metadata of the snapshot
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Delete one item metadata of the snapshot
self.client.delete_snapshot_metadata_item(
self.snapshot_id, "key1")
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(expected.items()))
self.assertNotIn("key1", body)
@@ -70,17 +72,19 @@
update = {"key3": "value3_update",
"key4": "value4"}
# Create metadata for the snapshot
- body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(
+ self.snapshot_id, metadata)['metadata']
# Get the metadata of the snapshot
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata item
body = self.client.update_snapshot_metadata(
- self.snapshot_id, update)
+ self.snapshot_id, update)['metadata']
# Get the metadata of the snapshot
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertEqual(update, body)
@test.idempotent_id('e8ff85c5-8f97-477f-806a-3ac364a949ed')
@@ -94,16 +98,18 @@
"key2": "value2",
"key3": "value3_update"}
# Create metadata for the snapshot
- body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(
+ self.snapshot_id, metadata)['metadata']
# Get the metadata of the snapshot
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata item
body = self.client.update_snapshot_metadata_item(
- self.snapshot_id, "key3", update_item)
+ self.snapshot_id, "key3", update_item)['meta']
# Get the metadata of the snapshot
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(expect.items()))
diff --git a/tempest/api/volume/test_volume_metadata.py b/tempest/api/volume/test_volume_metadata.py
index 8529cfc..e529538 100644
--- a/tempest/api/volume/test_volume_metadata.py
+++ b/tempest/api/volume/test_volume_metadata.py
@@ -42,14 +42,16 @@
"key4": "<value&special_chars>"}
body = self.volumes_client.create_volume_metadata(self.volume_id,
- metadata)
+ metadata)['metadata']
# Get the metadata of the volume
- body = self.volumes_client.show_volume_metadata(self.volume_id)
+ body = self.volumes_client.show_volume_metadata(
+ self.volume_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Delete one item metadata of the volume
self.volumes_client.delete_volume_metadata_item(
self.volume_id, "key1")
- body = self.volumes_client.show_volume_metadata(self.volume_id)
+ body = self.volumes_client.show_volume_metadata(
+ self.volume_id)['metadata']
self.assertNotIn("key1", body)
del metadata["key1"]
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
@@ -66,15 +68,17 @@
# Create metadata for the volume
body = self.volumes_client.create_volume_metadata(
- self.volume_id, metadata)
+ self.volume_id, metadata)['metadata']
# Get the metadata of the volume
- body = self.volumes_client.show_volume_metadata(self.volume_id)
+ body = self.volumes_client.show_volume_metadata(
+ self.volume_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata
body = self.volumes_client.update_volume_metadata(
- self.volume_id, update)
+ self.volume_id, update)['metadata']
# Get the metadata of the volume
- body = self.volumes_client.show_volume_metadata(self.volume_id)
+ body = self.volumes_client.show_volume_metadata(
+ self.volume_id)['metadata']
self.assertEqual(update, body)
@test.idempotent_id('862261c5-8df4-475a-8c21-946e50e36a20')
@@ -89,13 +93,14 @@
"key3": "value3_update"}
# Create metadata for the volume
body = self.volumes_client.create_volume_metadata(
- self.volume_id, metadata)
+ self.volume_id, metadata)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata item
body = self.volumes_client.update_volume_metadata_item(
- self.volume_id, "key3", update_item)
+ self.volume_id, "key3", update_item)['meta']
# Get the metadata of the volume
- body = self.volumes_client.show_volume_metadata(self.volume_id)
+ body = self.volumes_client.show_volume_metadata(
+ self.volume_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(expect.items()))
diff --git a/tempest/api/volume/test_volume_transfers.py b/tempest/api/volume/test_volume_transfers.py
index 27f8112..c0b6b7e 100644
--- a/tempest/api/volume/test_volume_transfers.py
+++ b/tempest/api/volume/test_volume_transfers.py
@@ -47,24 +47,24 @@
self.addCleanup(self._delete_volume, volume['id'])
# Create a volume transfer
- transfer = self.client.create_volume_transfer(volume['id'])
+ transfer = self.client.create_volume_transfer(volume['id'])['transfer']
transfer_id = transfer['id']
auth_key = transfer['auth_key']
self.client.wait_for_volume_status(volume['id'],
'awaiting-transfer')
# Get a volume transfer
- body = self.client.show_volume_transfer(transfer_id)
+ body = self.client.show_volume_transfer(transfer_id)['transfer']
self.assertEqual(volume['id'], body['volume_id'])
# List volume transfers, the result should be greater than
# or equal to 1
- body = self.client.list_volume_transfers()
+ body = self.client.list_volume_transfers()['transfers']
self.assertThat(len(body), matchers.GreaterThan(0))
# Accept a volume transfer by alt_tenant
body = self.alt_client.accept_volume_transfer(transfer_id,
- auth_key)
+ auth_key)['transfer']
self.alt_client.wait_for_volume_status(volume['id'], 'available')
@test.idempotent_id('ab526943-b725-4c07-b875-8e8ef87a2c30')
@@ -74,13 +74,13 @@
self.addCleanup(self._delete_volume, volume['id'])
# Create a volume transfer
- body = self.client.create_volume_transfer(volume['id'])
+ body = self.client.create_volume_transfer(volume['id'])['transfer']
transfer_id = body['id']
self.client.wait_for_volume_status(volume['id'],
'awaiting-transfer')
# List all volume transfers (looking for the one we created)
- body = self.client.list_volume_transfers()
+ body = self.client.list_volume_transfers()['transfers']
for transfer in body:
if volume['id'] == transfer['volume_id']:
break
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 067c0c1..d4636ee 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -37,23 +37,20 @@
# Create a test shared instance
srv_name = data_utils.rand_name(cls.__name__ + '-Instance')
- cls.server = cls.create_server(srv_name)
- waiters.wait_for_server_status(cls.servers_client, cls.server['id'],
- 'ACTIVE')
+ cls.server = cls.create_server(
+ name=srv_name,
+ wait_until='ACTIVE')
# Create a test shared volume for attach/detach tests
cls.volume = cls.create_volume()
cls.client.wait_for_volume_status(cls.volume['id'], 'available')
- def _delete_image_with_wait(self, image_id):
- self.image_client.delete_image(image_id)
- self.image_client.wait_for_resource_deletion(image_id)
-
@classmethod
def resource_cleanup(cls):
# Delete the test instance
cls.servers_client.delete_server(cls.server['id'])
- cls.servers_client.wait_for_server_termination(cls.server['id'])
+ waiters.wait_for_server_termination(cls.servers_client,
+ cls.server['id'])
super(VolumesV2ActionsTest, cls).resource_cleanup()
@@ -78,7 +75,8 @@
# Verify that a volume bootable flag is retrieved
for bool_bootable in [True, False]:
self.client.set_bootable_volume(self.volume['id'], bool_bootable)
- fetched_volume = self.client.show_volume(self.volume['id'])
+ fetched_volume = self.client.show_volume(
+ self.volume['id'])['volume']
# Get Volume information
bool_flag = self._is_true(fetched_volume['bootable'])
self.assertEqual(bool_bootable, bool_flag)
@@ -99,7 +97,7 @@
self.volume['id'],
'available')
self.addCleanup(self.client.detach_volume, self.volume['id'])
- volume = self.client.show_volume(self.volume['id'])
+ volume = self.client.show_volume(self.volume['id'])['volume']
self.assertIn('attachments', volume)
attachment = self.client.get_attachment_from_volume(volume)
self.assertEqual(mountpoint, attachment['device'])
@@ -115,9 +113,9 @@
# there is no way to delete it from Cinder, so we delete it from Glance
# using the Glance image_client and from Cinder via tearDownClass.
image_name = data_utils.rand_name('Image')
- body = self.client.upload_volume(self.volume['id'],
- image_name,
- CONF.volume.disk_format)
+ body = self.client.upload_volume(
+ self.volume['id'], image_name,
+ CONF.volume.disk_format)['os-volume_upload_image']
image_id = body["image_id"]
self.addCleanup(self.image_client.delete_image, image_id)
self.image_client.wait_for_image_status(image_id, 'active')
@@ -128,12 +126,12 @@
# Mark volume as reserved.
body = self.client.reserve_volume(self.volume['id'])
# To get the volume info
- body = self.client.show_volume(self.volume['id'])
+ body = self.client.show_volume(self.volume['id'])['volume']
self.assertIn('attaching', body['status'])
# Unmark volume as reserved.
body = self.client.unreserve_volume(self.volume['id'])
# To get the volume info
- body = self.client.show_volume(self.volume['id'])
+ body = self.client.show_volume(self.volume['id'])['volume']
self.assertIn('available', body['status'])
def _is_true(self, val):
@@ -146,7 +144,7 @@
self.client.update_volume_readonly(self.volume['id'],
readonly)
# Get Volume information
- fetched_volume = self.client.show_volume(self.volume['id'])
+ fetched_volume = self.client.show_volume(self.volume['id'])['volume']
bool_flag = self._is_true(fetched_volume['metadata']['readonly'])
self.assertEqual(True, bool_flag)
@@ -155,7 +153,7 @@
self.client.update_volume_readonly(self.volume['id'], readonly)
# Get Volume information
- fetched_volume = self.client.show_volume(self.volume['id'])
+ fetched_volume = self.client.show_volume(self.volume['id'])['volume']
bool_flag = self._is_true(fetched_volume['metadata']['readonly'])
self.assertEqual(False, bool_flag)
diff --git a/tempest/api/volume/test_volumes_extend.py b/tempest/api/volume/test_volumes_extend.py
index 179f8d3..78f5571 100644
--- a/tempest/api/volume/test_volumes_extend.py
+++ b/tempest/api/volume/test_volumes_extend.py
@@ -34,7 +34,7 @@
extend_size = int(self.volume['size']) + 1
self.client.extend_volume(self.volume['id'], extend_size)
self.client.wait_for_volume_status(self.volume['id'], 'available')
- volume = self.client.show_volume(self.volume['id'])
+ volume = self.client.show_volume(self.volume['id'])['volume']
self.assertEqual(int(volume['size']), extend_size)
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index a90f9ca..35c8898 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import testtools
from testtools import matchers
from tempest.api.volume import base
@@ -49,7 +50,7 @@
# Create a volume
kwargs[self.name_field] = v_name
kwargs['metadata'] = metadata
- volume = self.client.create_volume(**kwargs)
+ volume = self.client.create_volume(**kwargs)['volume']
self.assertIn('id', volume)
self.addCleanup(self._delete_volume, volume['id'])
self.client.wait_for_volume_status(volume['id'], 'available')
@@ -60,7 +61,7 @@
self.assertTrue(volume['id'] is not None,
"Field volume id is empty or not found.")
# Get Volume information
- fetched_volume = self.client.show_volume(volume['id'])
+ fetched_volume = self.client.show_volume(volume['id'])['volume']
self.assertEqual(v_name,
fetched_volume[self.name_field],
'The fetched Volume name is different '
@@ -88,12 +89,13 @@
new_desc = 'This is the new description of volume'
params = {self.name_field: new_v_name,
self.descrip_field: new_desc}
- update_volume = self.client.update_volume(volume['id'], **params)
+ update_volume = self.client.update_volume(
+ volume['id'], **params)['volume']
# Assert response body for update_volume method
self.assertEqual(new_v_name, update_volume[self.name_field])
self.assertEqual(new_desc, update_volume[self.descrip_field])
# Assert response body for show_volume method
- updated_volume = self.client.show_volume(volume['id'])
+ updated_volume = self.client.show_volume(volume['id'])['volume']
self.assertEqual(volume['id'], updated_volume['id'])
self.assertEqual(new_v_name, updated_volume[self.name_field])
self.assertEqual(new_desc, updated_volume[self.descrip_field])
@@ -108,7 +110,7 @@
new_v_desc = data_utils.rand_name('@#$%^* description')
params = {self.descrip_field: new_v_desc,
'availability_zone': volume['availability_zone']}
- new_volume = self.client.create_volume(**params)
+ new_volume = self.client.create_volume(**params)['volume']
self.assertIn('id', new_volume)
self.addCleanup(self._delete_volume, new_volume['id'])
self.client.wait_for_volume_status(new_volume['id'], 'available')
@@ -131,13 +133,15 @@
@test.idempotent_id('54a01030-c7fc-447c-86ee-c1182beae638')
@test.services('image')
def test_volume_create_get_update_delete_from_image(self):
- image = self.images_client.show_image(CONF.compute.image_ref)
+ image = self.images_client.show_image(CONF.compute.image_ref)['image']
min_disk = image.get('minDisk')
disk_size = max(min_disk, CONF.volume.volume_size)
self._volume_create_get_update_delete(
imageRef=CONF.compute.image_ref, size=disk_size)
@test.idempotent_id('3f591b4a-7dc6-444c-bd51-77469506b3a1')
+ @testtools.skipUnless(CONF.volume_feature_enabled.clone,
+ 'Cinder volume clones are disabled')
def test_volume_create_get_update_delete_as_clone(self):
origin = self.create_volume()
self._volume_create_get_update_delete(source_volid=origin['id'])
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index 3847877..620366a 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -70,7 +70,7 @@
cls.metadata = {'Type': 'work'}
for i in range(3):
volume = cls.create_volume(metadata=cls.metadata)
- volume = cls.client.show_volume(volume['id'])
+ volume = cls.client.show_volume(volume['id'])['volume']
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
@@ -89,9 +89,10 @@
"""
if with_detail:
fetched_vol_list = \
- self.client.list_volumes(detail=True, params=params)
+ self.client.list_volumes(detail=True, params=params)['volumes']
else:
- fetched_vol_list = self.client.list_volumes(params=params)
+ fetched_vol_list = self.client.list_volumes(
+ params=params)['volumes']
# Validating params of fetched volumes
# In v2, only list detail view includes items in params.
@@ -116,7 +117,7 @@
def test_volume_list(self):
# Get a list of Volumes
# Fetch all volumes
- fetched_list = self.client.list_volumes()
+ fetched_list = self.client.list_volumes()['volumes']
self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS)
@@ -124,14 +125,14 @@
def test_volume_list_with_details(self):
# Get a list of Volumes with details
# Fetch all Volumes
- fetched_list = self.client.list_volumes(detail=True)
+ fetched_list = self.client.list_volumes(detail=True)['volumes']
self.assertVolumesIn(fetched_list, self.volume_list)
@test.idempotent_id('a28e8da4-0b56-472f-87a8-0f4d3f819c02')
def test_volume_list_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {self.name: volume[self.name]}
- fetched_vol = self.client.list_volumes(params=params)
+ fetched_vol = self.client.list_volumes(params=params)['volumes']
self.assertEqual(1, len(fetched_vol), str(fetched_vol))
self.assertEqual(fetched_vol[0][self.name],
volume[self.name])
@@ -140,7 +141,8 @@
def test_volume_list_details_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {self.name: volume[self.name]}
- fetched_vol = self.client.list_volumes(detail=True, params=params)
+ fetched_vol = self.client.list_volumes(
+ detail=True, params=params)['volumes']
self.assertEqual(1, len(fetched_vol), str(fetched_vol))
self.assertEqual(fetched_vol[0][self.name],
volume[self.name])
@@ -148,7 +150,7 @@
@test.idempotent_id('39654e13-734c-4dab-95ce-7613bf8407ce')
def test_volumes_list_by_status(self):
params = {'status': 'available'}
- fetched_list = self.client.list_volumes(params=params)
+ fetched_list = self.client.list_volumes(params=params)['volumes']
self._list_by_param_value_and_assert(params)
self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS)
@@ -156,7 +158,8 @@
@test.idempotent_id('2943f712-71ec-482a-bf49-d5ca06216b9f')
def test_volumes_list_details_by_status(self):
params = {'status': 'available'}
- fetched_list = self.client.list_volumes(detail=True, params=params)
+ fetched_list = self.client.list_volumes(
+ detail=True, params=params)['volumes']
for volume in fetched_list:
self.assertEqual('available', volume['status'])
self.assertVolumesIn(fetched_list, self.volume_list)
@@ -166,7 +169,7 @@
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
- fetched_list = self.client.list_volumes(params=params)
+ fetched_list = self.client.list_volumes(params=params)['volumes']
self._list_by_param_value_and_assert(params)
self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS)
@@ -176,7 +179,8 @@
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
- fetched_list = self.client.list_volumes(detail=True, params=params)
+ fetched_list = self.client.list_volumes(
+ detail=True, params=params)['volumes']
for volume in fetched_list:
self.assertEqual(zone, volume['availability_zone'])
self.assertVolumesIn(fetched_list, self.volume_list)
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 5203444..0af40ea 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -180,12 +180,13 @@
@test.services('compute')
def test_attach_volumes_with_nonexistent_volume_id(self):
srv_name = data_utils.rand_name('Instance')
- server = self.create_server(srv_name)
- self.addCleanup(self.servers_client.wait_for_server_termination,
- server['id'])
+ server = self.create_server(
+ name=srv_name,
+ wait_until='ACTIVE')
+ self.addCleanup(waiters.wait_for_server_termination,
+ self.servers_client, server['id'])
self.addCleanup(self.servers_client.delete_server, server['id'])
- waiters.wait_for_server_status(self.servers_client, server['id'],
- 'ACTIVE')
+
self.assertRaises(lib_exc.NotFound,
self.client.attach_volume,
str(uuid.uuid4()),
@@ -270,7 +271,7 @@
def test_list_volumes_with_nonexistent_name(self):
v_name = data_utils.rand_name('Volume')
params = {self.name_field: v_name}
- fetched_volume = self.client.list_volumes(params=params)
+ fetched_volume = self.client.list_volumes(params=params)['volumes']
self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative'])
@@ -279,14 +280,14 @@
v_name = data_utils.rand_name('Volume')
params = {self.name_field: v_name}
fetched_volume = \
- self.client.list_volumes(detail=True, params=params)
+ self.client.list_volumes(detail=True, params=params)['volumes']
self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative'])
@test.idempotent_id('143b279b-7522-466b-81be-34a87d564a7c')
def test_list_volumes_with_invalid_status(self):
params = {'status': 'null'}
- fetched_volume = self.client.list_volumes(params=params)
+ fetched_volume = self.client.list_volumes(params=params)['volumes']
self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative'])
@@ -294,7 +295,7 @@
def test_list_volumes_detail_with_invalid_status(self):
params = {'status': 'null'}
fetched_volume = \
- self.client.list_volumes(detail=True, params=params)
+ self.client.list_volumes(detail=True, params=params)['volumes']
self.assertEqual(0, len(fetched_volume))
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 1df1896..7eaa9cc 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -14,7 +14,6 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
-from tempest.common import waiters
from tempest import config
from tempest import test
@@ -49,12 +48,11 @@
and validates result.
"""
if with_detail:
- fetched_snap_list = \
- self.snapshots_client.\
- list_snapshots(detail=True, params=params)
+ fetched_snap_list = self.snapshots_client.list_snapshots(
+ detail=True, params=params)['snapshots']
else:
- fetched_snap_list = \
- self.snapshots_client.list_snapshots(params=params)
+ fetched_snap_list = self.snapshots_client.list_snapshots(
+ params=params)['snapshots']
# Validating params of fetched snapshots
for snap in fetched_snap_list:
@@ -69,13 +67,14 @@
# Create a snapshot when volume status is in-use
# Create a test instance
server_name = data_utils.rand_name('instance')
- server = self.create_server(server_name)
+ server = self.create_server(
+ name=server_name,
+ wait_until='ACTIVE')
self.addCleanup(self.servers_client.delete_server, server['id'])
- waiters.wait_for_server_status(self.servers_client, server['id'],
- 'ACTIVE')
mountpoint = '/dev/%s' % CONF.compute.volume_device_name
self.servers_client.attach_volume(
- server['id'], self.volume_origin['id'], mountpoint)
+ server['id'], volumeId=self.volume_origin['id'],
+ device=mountpoint)
self.volumes_client.wait_for_volume_status(self.volume_origin['id'],
'in-use')
self.addCleanup(self.volumes_client.wait_for_volume_status,
@@ -98,14 +97,15 @@
snapshot = self.create_snapshot(self.volume_origin['id'], **params)
# Get the snap and check for some of its details
- snap_get = self.snapshots_client.show_snapshot(snapshot['id'])
+ snap_get = self.snapshots_client.show_snapshot(
+ snapshot['id'])['snapshot']
self.assertEqual(self.volume_origin['id'],
snap_get['volume_id'],
"Referred volume origin mismatch")
# Compare also with the output from the list action
tracking_data = (snapshot['id'], snapshot[self.name_field])
- snaps_list = self.snapshots_client.list_snapshots()
+ snaps_list = self.snapshots_client.list_snapshots()['snapshots']
snaps_data = [(f['id'], f[self.name_field]) for f in snaps_list]
self.assertIn(tracking_data, snaps_data)
@@ -114,14 +114,14 @@
new_desc = 'This is the new description of snapshot.'
params = {self.name_field: new_s_name,
self.descrip_field: new_desc}
- update_snapshot = \
- self.snapshots_client.update_snapshot(snapshot['id'], **params)
+ update_snapshot = self.snapshots_client.update_snapshot(
+ snapshot['id'], **params)['snapshot']
# Assert response body for update_snapshot method
self.assertEqual(new_s_name, update_snapshot[self.name_field])
self.assertEqual(new_desc, update_snapshot[self.descrip_field])
# Assert response body for show_snapshot method
- updated_snapshot = \
- self.snapshots_client.show_snapshot(snapshot['id'])
+ updated_snapshot = self.snapshots_client.show_snapshot(
+ snapshot['id'])['snapshot']
self.assertEqual(new_s_name, updated_snapshot[self.name_field])
self.assertEqual(new_desc, updated_snapshot[self.descrip_field])
@@ -177,7 +177,7 @@
snapshot = self.create_snapshot(self.volume_origin['id'])
# NOTE(gfidente): size is required also when passing snapshot_id
volume = self.volumes_client.create_volume(
- snapshot_id=snapshot['id'])
+ snapshot_id=snapshot['id'])['volume']
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
self.volumes_client.delete_volume(volume['id'])
self.volumes_client.wait_for_resource_deletion(volume['id'])
diff --git a/tempest/api/volume/v2/test_volumes_list.py b/tempest/api/volume/v2/test_volumes_list.py
index d1eb694..94a9d16 100644
--- a/tempest/api/volume/v2/test_volumes_list.py
+++ b/tempest/api/volume/v2/test_volumes_list.py
@@ -47,7 +47,7 @@
cls.metadata = {'Type': 'work'}
for i in range(3):
volume = cls.create_volume(metadata=cls.metadata)
- volume = cls.client.show_volume(volume['id'])
+ volume = cls.client.show_volume(volume['id'])['volume']
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
@@ -71,8 +71,8 @@
'sort_dir': sort_dir,
'sort_key': sort_key
}
- fetched_volume = self.client.list_volumes(detail=True,
- params=params)
+ fetched_volume = self.client.list_volumes(
+ detail=True, params=params)['volumes']
self.assertEqual(limit, len(fetched_volume),
"The count of volumes is %s, expected:%s " %
(len(fetched_volume), limit))
@@ -118,12 +118,12 @@
else:
remaining = None
- # Mark that we are not comming from a next link
+ # Mark that the current iteration is not from a 'next' link
next = None
while True:
# Get a list page
- response = method(return_body=True, params=params, **kwargs)
+ response = method(params=params, **kwargs)
# If we have to check ids
if remaining is not None:
@@ -149,8 +149,8 @@
# We no longer expect it
remaining.remove(element_id)
- # If we come from a next link check that absolute url is the same
- # as the one used for this request
+ # If the current iteration is from a 'next' link, check that the
+ # absolute url is the same as the one used for this request
if next:
self.assertEqual(next, response.response['content-location'])
diff --git a/tempest/api_schema/response/compute/v2_1/version.py b/tempest/api_schema/response/compute/v2_1/version.py
deleted file mode 100644
index 6579c63..0000000
--- a/tempest/api_schema/response/compute/v2_1/version.py
+++ /dev/null
@@ -1,59 +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.
-
-version = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'version': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'links': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'href': {'type': 'string', 'format': 'uri'},
- 'rel': {'type': 'string'},
- 'type': {'type': 'string'}
- },
- 'required': ['href', 'rel']
- }
- },
- 'media-types': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'base': {'type': 'string'},
- 'type': {'type': 'string'}
- },
- 'required': ['base', 'type']
- }
- },
- 'status': {'type': 'string'},
- 'updated': {'type': 'string', 'format': 'date-time'},
- 'version': {'type': 'string'},
- 'min_version': {'type': 'string'}
- },
- # NOTE: version and min_version have been added since Kilo,
- # so they should not be required.
- 'required': ['id', 'links', 'media-types', 'status', 'updated']
- }
- },
- 'required': ['version']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/versions.py b/tempest/api_schema/response/compute/v2_1/versions.py
new file mode 100644
index 0000000..a01dd41
--- /dev/null
+++ b/tempest/api_schema/response/compute/v2_1/versions.py
@@ -0,0 +1,54 @@
+# 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.
+
+list_versions = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'versions': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string'},
+ 'links': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'href': {'type': 'string',
+ 'format': 'uri'},
+ 'rel': {'type': 'string'},
+ },
+ 'required': ['href', 'rel'],
+ 'additionalProperties': False
+ }
+ },
+ 'status': {'type': 'string'},
+ 'updated': {'type': 'string', 'format': 'date-time'},
+ 'version': {'type': 'string'},
+ 'min_version': {'type': 'string'}
+ },
+ # NOTE: version and min_version have been added since Kilo,
+ # so they should not be required.
+ 'required': ['id', 'links', 'status', 'updated'],
+ 'additionalProperties': False
+ }
+ }
+ },
+ 'required': ['versions'],
+ 'additionalProperties': False
+ }
+}
diff --git a/tempest/clients.py b/tempest/clients.py
index b3fb8a8..c0d4585 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -77,6 +77,7 @@
TenantNetworksClient
from tempest.services.compute.json.tenant_usages_client import \
TenantUsagesClient
+from tempest.services.compute.json.versions_client import VersionsClient
from tempest.services.compute.json.volumes_extensions_client import \
VolumesExtensionsClient
from tempest.services.data_processing.v1_1.data_processing_client import \
@@ -243,8 +244,8 @@
# with identity v2
if CONF.identity_feature_enabled.api_v2 and \
CONF.identity.auth_version == 'v2':
- # EC2 and S3 clients, if used, will check onfigured AWS credentials
- # and generate new ones if needed
+ # EC2 and S3 clients, if used, will check configured AWS
+ # credentials and generate new ones if needed
self.ec2api_client = botoclients.APIClientEC2(self.identity_client)
self.s3_client = botoclients.ObjectClientS3(self.identity_client)
@@ -321,8 +322,9 @@
'build_timeout': CONF.volume.build_timeout
})
self.volumes_extensions_client = VolumesExtensionsClient(
- self.auth_provider, default_volume_size=CONF.volume.volume_size,
- **params_volume)
+ self.auth_provider, **params_volume)
+ self.compute_versions_client = VersionsClient(self.auth_provider,
+ **params_volume)
def _set_database_clients(self):
self.database_flavors_client = DatabaseFlavorsClient(
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index 0360146..3d24547 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -25,7 +25,7 @@
**Usage:** ``tempest-account-generator [-h] [OPTIONS] accounts_file.yaml``.
Positional Arguments
------------------
+--------------------
**accounts_file.yaml** (Required) Provide an output accounts yaml file. Utility
creates a .yaml file in the directory where the command is ran. The appropriate
name for the file is *accounts.yaml* and it should be placed in *tempest/etc*
@@ -49,7 +49,7 @@
+----------+------------------+----------------------+
Optional Arguments
------------------
+------------------
**-h**, **--help** (Optional) Shows help message with the description of
utility and its arguments, and exits.
@@ -160,7 +160,7 @@
raise exceptions.TempestException(
"Role: %s - doesn't exist" % r
)
- existing = [x['name'] for x in identity_admin.list_tenants()]
+ existing = [x['name'] for x in identity_admin.list_tenants()['tenants']]
for tenant in resources['tenants']:
if tenant not in existing:
identity_admin.create_tenant(tenant)
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 2e96c81..6d4e3a9 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -195,7 +195,7 @@
def list(self):
client = self.client
- sgs = client.list_server_groups()
+ sgs = client.list_server_groups()['server_groups']
LOG.debug("List count, %s Server Groups" % len(sgs))
return sgs
@@ -220,7 +220,7 @@
def list(self):
client = self.client
- stacks = client.list_stacks()
+ stacks = client.list_stacks()['stacks']
LOG.debug("List count, %s Stacks" % len(stacks))
return stacks
@@ -245,7 +245,7 @@
def list(self):
client = self.client
- keypairs = client.list_keypairs()
+ keypairs = client.list_keypairs()['keypairs']
LOG.debug("List count, %s Keypairs" % len(keypairs))
return keypairs
@@ -271,7 +271,7 @@
def list(self):
client = self.client
- secgrps = client.list_security_groups()
+ secgrps = client.list_security_groups()['security_groups']
secgrp_del = [grp for grp in secgrps if grp['name'] != 'default']
LOG.debug("List count, %s Security Groups" % len(secgrp_del))
return secgrp_del
@@ -297,7 +297,7 @@
def list(self):
client = self.client
- floating_ips = client.list_floating_ips()
+ floating_ips = client.list_floating_ips()['floating_ips']
LOG.debug("List count, %s Floating IPs" % len(floating_ips))
return floating_ips
@@ -322,7 +322,7 @@
def list(self):
client = self.client
- vols = client.list_volumes()
+ vols = client.list_volumes()['volumes']
LOG.debug("List count, %s Volumes" % len(vols))
return vols
@@ -353,7 +353,7 @@
LOG.exception("Delete Volume Quotas exception.")
def dry_run(self):
- quotas = self.client.show_quota_usage(self.tenant_id)
+ quotas = self.client.show_quota_usage(self.tenant_id)['quota_set']
self.data['volume_quotas'] = quotas
@@ -372,7 +372,7 @@
def dry_run(self):
client = self.limits_client
- quotas = client.show_limits()
+ quotas = client.show_limits()['limits']
self.data['compute_quotas'] = quotas['absolute']
@@ -731,7 +731,7 @@
def list(self):
client = self.client
- flavors = client.list_flavors({"is_public": None})
+ flavors = client.list_flavors({"is_public": None})['flavors']
if not self.is_save_state:
# recreate list removing saved flavors
flavors = [flavor for flavor in flavors if flavor['id']
@@ -770,7 +770,7 @@
def list(self):
client = self.client
- images = client.list_images({"all_tenants": True})
+ images = client.list_images({"all_tenants": True})['images']
if not self.is_save_state:
images = [image for image in images if image['id']
not in self.saved_state_json['images'].keys()]
@@ -889,7 +889,7 @@
def list(self):
client = self.client
- tenants = client.list_tenants()
+ tenants = client.list_tenants()['tenants']
if not self.is_save_state:
tenants = [tenant for tenant in tenants if (tenant['id']
not in self.saved_state_json['tenants'].keys()
@@ -930,7 +930,7 @@
def list(self):
client = self.client
- domains = client.list_domains()
+ domains = client.list_domains()['domains']
if not self.is_save_state:
domains = [domain for domain in domains if domain['id']
not in self.saved_state_json['domains'].keys()]
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 30fb38c..6973c87 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -119,6 +119,7 @@
from tempest_lib import exceptions as lib_exc
import yaml
+from tempest.common import waiters
from tempest import config
from tempest.services.compute.json import flavors_client
from tempest.services.compute.json import floating_ips_client
@@ -273,7 +274,7 @@
Don't create the tenants if they already exist.
"""
admin = keystone_admin()
- body = admin.identity.list_tenants()
+ body = admin.identity.list_tenants()['tenants']
existing = [x['name'] for x in body]
for tenant in tenants:
if tenant not in existing:
@@ -503,7 +504,7 @@
def check_telemetry(self):
"""Check that ceilometer provides a sane sample.
- Confirm that there are more than one sample and that they have the
+ Confirm that there is more than one sample and that they have the
expected metadata.
If in check mode confirm that the oldest sample available is from
@@ -680,7 +681,7 @@
response = _get_image_by_name(client, image['name'])
if not response:
- LOG.info("Image '%s' does not exists" % image['name'])
+ LOG.info("Image '%s' does not exist" % image['name'])
continue
client.images.delete_image(response['id'])
@@ -729,7 +730,7 @@
# only create a network if the name isn't here
body = client.networks.list_networks()
if any(item['name'] == network['name'] for item in body['networks']):
- LOG.warning("Dupplicated network name: %s" % network['name'])
+ LOG.warning("Duplicated network name: %s" % network['name'])
continue
client.networks.create_network(name=network['name'])
@@ -781,7 +782,7 @@
# only create a router if the name isn't here
body = client.networks.list_routers()
if any(item['name'] == router['name'] for item in body['routers']):
- LOG.warning("Dupplicated router name: %s" % router['name'])
+ LOG.warning("Duplicated router name: %s" % router['name'])
continue
client.networks.create_router(router['name'])
@@ -813,7 +814,7 @@
# connect routers to their subnets
client.networks.add_router_interface_with_subnet_id(router_id,
subnet_id)
- # connect routers to exteral network if set to "gateway"
+ # connect routers to external network if set to "gateway"
if router['gateway']:
if CONF.network.public_network_id:
ext_net = CONF.network.public_network_id
@@ -839,7 +840,7 @@
def _get_flavor_by_name(client, name):
- body = client.flavors.list_flavors()
+ body = client.flavors.list_flavors()['flavors']
for flavor in body:
if name == flavor['name']:
return flavor
@@ -871,13 +872,13 @@
server['name'], image_id, flavor_id, **kwargs)
server_id = body['id']
client.servers.wait_for_server_status(server_id, 'ACTIVE')
- # create to security group(s) after server spawning
+ # create security group(s) after server spawning
for secgroup in server['secgroups']:
client.servers.add_security_group(server_id, secgroup)
if CONF.compute.use_floatingip_for_ssh:
floating_ip_pool = server.get('floating_ip_pool')
floating_ip = client.floating_ips.create_floating_ip(
- pool_name=floating_ip_pool)
+ pool_name=floating_ip_pool)['floating_ip']
client.floating_ips.associate_floating_ip_to_server(
floating_ip['ip'], server_id)
@@ -896,8 +897,8 @@
# TODO(EmilienM): disassociate floating IP from server and release it.
client.servers.delete_server(response['id'])
- client.servers.wait_for_server_termination(response['id'],
- ignore_error=True)
+ waiters.wait_for_server_termination(client.servers, response['id'],
+ ignore_error=True)
def create_secgroups(secgroups):
@@ -908,14 +909,15 @@
# only create a security group if the name isn't here
# i.e. a security group may be used by another server
# only create a router if the name isn't here
- body = client.secgroups.list_security_groups()
+ body = client.secgroups.list_security_groups()['security_groups']
if any(item['name'] == secgroup['name'] for item in body):
LOG.warning("Security group '%s' already exists" %
secgroup['name'])
continue
body = client.secgroups.create_security_group(
- name=secgroup['name'], description=secgroup['description'])
+ name=secgroup['name'],
+ description=secgroup['description'])['security_group']
secgroup_id = body['id']
# for each security group, create the rules
for rule in secgroup['rules']:
@@ -943,7 +945,7 @@
#######################
def _get_volume_by_name(client, name):
- body = client.volumes.list_volumes()
+ body = client.volumes.list_volumes()['volumes']
for volume in body:
if name == volume['display_name']:
return volume
@@ -965,7 +967,7 @@
size = volume['gb']
v_name = volume['name']
body = client.volumes.create_volume(size=size,
- display_name=v_name)
+ display_name=v_name)['volume']
client.volumes.wait_for_volume_status(body['id'], 'available')
@@ -995,7 +997,7 @@
def create_resources():
LOG.info("Creating Resources")
# first create keystone level resources, and we need to be admin
- # for those.
+ # for this.
create_tenants(RES['tenants'])
create_users(RES['users'])
collect_users(RES['users'])
@@ -1015,7 +1017,7 @@
create_volumes(RES['volumes'])
# Only attempt attaching the volumes if servers are defined in the
- # resourcefile
+ # resource file
if 'servers' in RES:
create_servers(RES['servers'])
attach_volumes(RES['volumes'])
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
index 06e3493..5c4d8af 100644
--- a/tempest/common/compute.py
+++ b/tempest/common/compute.py
@@ -26,8 +26,8 @@
LOG = logging.getLogger(__name__)
-def create_test_server(clients, validatable, validation_resources=None,
- tenant_network=None, **kwargs):
+def create_test_server(clients, validatable=False, validation_resources=None,
+ tenant_network=None, wait_until=None, **kwargs):
"""Common wrapper utility returning a test server.
This method is a common wrapper returning a test server that can be
@@ -37,6 +37,9 @@
:param validatable: Whether the server will be pingable or sshable.
:param validation_resources: Resources created for the connection to the
server. Include a keypair, a security group and an IP.
+ :param tenant_network: Tenant network to be used for creating a server.
+ :param wait_until: Server status to wait for the server to reach after
+ its creation.
:returns a tuple
"""
@@ -78,8 +81,8 @@
LOG.debug("No key provided.")
if CONF.validation.connect_method == 'floating':
- if 'wait_until' not in kwargs:
- kwargs['wait_until'] = 'ACTIVE'
+ if wait_until is None:
+ wait_until = 'ACTIVE'
body = clients.servers_client.create_server(name, image_id, flavor,
**kwargs)
@@ -96,11 +99,11 @@
# long for PEP8 compliance so:
assoc = clients.floating_ips_client.associate_floating_ip_to_server
- if 'wait_until' in kwargs:
+ if wait_until:
for server in servers:
try:
waiters.wait_for_server_status(
- clients.servers_client, server['id'], kwargs['wait_until'])
+ clients.servers_client, server['id'], wait_until)
# Multiple validatable servers are not supported for now. Their
# creation will fail with the condition above (l.58).
diff --git a/tempest/common/fixed_network.py b/tempest/common/fixed_network.py
index 9ec0ec6..b81830a 100644
--- a/tempest/common/fixed_network.py
+++ b/tempest/common/fixed_network.py
@@ -40,7 +40,7 @@
if not name:
raise exceptions.InvalidConfiguration()
- networks = compute_networks_client.list_networks()
+ networks = compute_networks_client.list_networks()['networks']
networks = [n for n in networks if n['label'] == name]
# Check that a network exists, else raise an InvalidConfigurationException
diff --git a/tempest/common/glance_http.py b/tempest/common/glance_http.py
index 4be3da1..868a3e9 100644
--- a/tempest/common/glance_http.py
+++ b/tempest/common/glance_http.py
@@ -330,7 +330,7 @@
try:
self.context.load_verify_locations(self.ca_certs)
except Exception as e:
- msg = 'Unable to load CA from "%s"' % (self.ca_certs, e)
+ msg = 'Unable to load CA from "%s" %s' % (self.ca_certs, e)
raise exc.SSLConfigurationError(msg)
else:
self.context.set_default_verify_paths()
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 7888811..6dca3a3 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -45,6 +45,8 @@
def create_user(self, username, password, project, email):
user = self.identity_client.create_user(
username, password, project['id'], email)
+ if 'user' in user:
+ user = user['user']
return user
@abc.abstractmethod
@@ -113,7 +115,7 @@
# Domain names must be unique, in any case a list is returned,
# selecting the first (and only) element
self.creds_domain = self.identity_client.list_domains(
- params={'name': domain_name})[0]
+ params={'name': domain_name})['domains'][0]
except lib_exc.NotFound:
# TODO(andrea) we could probably create the domain on the fly
msg = "Configured domain %s could not be found" % domain_name
@@ -122,7 +124,7 @@
def create_project(self, name, description):
project = self.identity_client.create_project(
name=name, description=description,
- domain_id=self.creds_domain['id'])
+ domain_id=self.creds_domain['id'])['project']
return project
def get_credentials(self, user, project, password):
@@ -136,6 +138,10 @@
def delete_project(self, project_id):
self.identity_client.delete_project(project_id)
+ def _list_roles(self):
+ roles = self.identity_client.list_roles()['roles']
+ return roles
+
def get_creds_client(identity_client, project_domain_name=None):
if isinstance(identity_client, v2_identity.IdentityClient):
@@ -206,6 +212,8 @@
email = data_utils.rand_name(root) + suffix + "@example.com"
user = self.creds_client.create_user(
username, user_password, project, email)
+ if 'user' in user:
+ user = user['user']
role_assigned = False
if admin:
self.creds_client.assign_user_role(user, project,
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 93c2c10..a567c6a 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -106,7 +106,8 @@
def get_nic_name(self, address):
cmd = "ip -o addr | awk '/%s/ {print $2}'" % address
- return self.exec_command(cmd)
+ nic = self.exec_command(cmd)
+ return nic.strip().strip(":").lower()
def get_ip_list(self):
cmd = "ip address"
@@ -144,7 +145,6 @@
"""Renews DHCP lease via udhcpc client. """
file_path = '/var/run/udhcpc.'
nic_name = self.get_nic_name(fixed_ip)
- nic_name = nic_name.strip().lower()
pid = self.exec_command('cat {path}{nic}.pid'.
format(path=file_path, nic=nic_name))
pid = pid.strip()
diff --git a/tempest/common/validation_resources.py b/tempest/common/validation_resources.py
index 402638d..debc200 100644
--- a/tempest/common/validation_resources.py
+++ b/tempest/common/validation_resources.py
@@ -23,17 +23,17 @@
def create_ssh_security_group(os, add_rule=False):
- security_group_client = os.security_groups_client
+ security_groups_client = os.security_groups_client
+ security_group_rules_client = os.security_group_rules_client
sg_name = data_utils.rand_name('securitygroup-')
sg_description = data_utils.rand_name('description-')
- security_group = \
- security_group_client.create_security_group(name=sg_name,
- description=sg_description)
+ security_group = security_groups_client.create_security_group(
+ name=sg_name, description=sg_description)['security_group']
if add_rule:
- security_group_client.create_security_group_rule(
+ security_group_rules_client.create_security_group_rule(
parent_group_id=security_group['id'], ip_protocol='tcp',
from_port=22, to_port=22)
- security_group_client.create_security_group_rule(
+ security_group_rules_client.create_security_group_rule(
parent_group_id=security_group['id'], ip_protocol='icmp',
from_port=-1, to_port=-1)
LOG.debug("SSH Validation resource security group with tcp and icmp "
@@ -48,8 +48,8 @@
if validation_resources:
if validation_resources['keypair']:
keypair_name = data_utils.rand_name('keypair')
- validation_data['keypair'] = \
- os.keypairs_client.create_keypair(name=keypair_name)
+ validation_data.update(os.keypairs_client.create_keypair(
+ name=keypair_name))
LOG.debug("Validation resource key %s created" % keypair_name)
add_rule = False
if validation_resources['security_group']:
@@ -59,8 +59,7 @@
create_ssh_security_group(os, add_rule)
if validation_resources['floating_ip']:
floating_client = os.floating_ips_client
- validation_data['floating_ip'] = \
- floating_client.create_floating_ip()
+ validation_data.update(floating_client.create_floating_ip())
return validation_data
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index 85a03cf..b0afcc1 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -15,6 +15,7 @@
from oslo_log import log as logging
from tempest_lib.common.utils import misc as misc_utils
+from tempest_lib import exceptions as lib_exc
from tempest import config
from tempest import exceptions
@@ -50,7 +51,7 @@
return
# NOTE(afazekas): The instance is in "ready for action state"
# when no task in progress
- # NOTE(afazekas): Converted to string bacuse of the XML
+ # NOTE(afazekas): Converted to string because of the XML
# responses
if str(task_state) == "None":
# without state api extension 3 sec usually enough
@@ -96,6 +97,25 @@
old_task_state = task_state
+def wait_for_server_termination(client, server_id, ignore_error=False):
+ """Waits for server to reach termination."""
+ start_time = int(time.time())
+ while True:
+ try:
+ body = client.show_server(server_id)
+ except lib_exc.NotFound:
+ return
+
+ server_status = body['status']
+ if server_status == 'ERROR' and not ignore_error:
+ raise exceptions.BuildErrorException(server_id=server_id)
+
+ if int(time.time()) - start_time >= client.build_timeout:
+ raise exceptions.TimeoutException
+
+ time.sleep(client.build_interval)
+
+
def wait_for_image_status(client, image_id, status):
"""Waits for an image to reach a given status.
@@ -103,11 +123,19 @@
The client should also have build_interval and build_timeout attributes.
"""
image = client.show_image(image_id)
+ # Compute image client return response wrapped in 'image' element
+ # which is not case with glance image client.
+ if 'image' in image:
+ image = image['image']
start = int(time.time())
while image['status'] != status:
time.sleep(client.build_interval)
image = client.show_image(image_id)
+ # Compute image client return response wrapped in 'image' element
+ # which is not case with glance image client.
+ if 'image' in image:
+ image = image['image']
status_curr = image['status']
if status_curr == 'ERROR':
raise exceptions.AddImageException(image_id=image_id)
@@ -135,15 +163,24 @@
def wait_for_volume_status(client, volume_id, status):
"""Waits for a Volume to reach a given status."""
body = client.show_volume(volume_id)
+ if 'volume' in body:
+ body = body['volume']
volume_status = body['status']
start = int(time.time())
while volume_status != status:
time.sleep(client.build_interval)
body = client.show_volume(volume_id)
+ # TODO(jswarren) always extract 'volume' value
+ # once the compute clients also return the full
+ # response.
+ if 'volume' in body:
+ body = body['volume']
volume_status = body['status']
if volume_status == 'error':
raise exceptions.VolumeBuildErrorException(volume_id=volume_id)
+ if volume_status == 'error_restoring':
+ raise exceptions.VolumeRestoreErrorException(volume_id=volume_id)
if int(time.time()) - start >= client.build_timeout:
message = ('Volume %s failed to reach %s status (current %s) '
diff --git a/tempest/config.py b/tempest/config.py
index 0262d1b..5721c27 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -77,7 +77,7 @@
cfg.BoolOpt('create_isolated_networks',
default=True,
help="If allow_tenant_isolation is set to True and Neutron is "
- "enabled Tempest will try to create a useable network, "
+ "enabled Tempest will try to create a usable network, "
"subnet, and router when needed for each tenant it "
"creates. However in some neutron configurations, like "
"with VLAN provider networks, this doesn't work. So if "
@@ -702,6 +702,9 @@
cfg.BoolOpt('snapshot',
default=True,
help='Runs Cinder volume snapshot test'),
+ cfg.BoolOpt('clone',
+ default=True,
+ help='Runs Cinder volume clone test'),
cfg.ListOpt('api_extensions',
default=['all'],
help='A list of enabled volume extensions with a special '
@@ -857,6 +860,7 @@
help="The endpoint type to use for the telemetry service."),
cfg.BoolOpt('too_slow_to_test',
default=True,
+ deprecated_for_removal=True,
help="This variable is used as flag to enable "
"notification tests")
]
@@ -881,7 +885,8 @@
help="Where the dashboard can be found"),
cfg.StrOpt('login_url',
default='http://localhost/auth/login/',
- help="Login page for the dashboard"),
+ help="Login page for the dashboard",
+ deprecated_for_removal=True),
]
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 15617c6..15482ab 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -92,6 +92,10 @@
message = "Volume %(volume_id)s failed to build and is in ERROR status"
+class VolumeRestoreErrorException(TempestException):
+ message = "Volume %(volume_id)s failed to restore and is in ERROR status"
+
+
class SnapshotBuildErrorException(TempestException):
message = "Snapshot %(snapshot_id)s failed to build and is in ERROR status"
diff --git a/tempest/hacking/checks.py b/tempest/hacking/checks.py
index db6375f..06ca09b 100644
--- a/tempest/hacking/checks.py
+++ b/tempest/hacking/checks.py
@@ -29,6 +29,7 @@
VI_HEADER_RE = re.compile(r"^#\s+vim?:.+")
RAND_NAME_HYPHEN_RE = re.compile(r".*rand_name\(.+[\-\_][\"\']\)")
mutable_default_args = re.compile(r"^\s*def .+\((.+=\{\}|.+=\[\])")
+TESTTOOLS_SKIP_DECORATOR = re.compile(r'\s*@testtools\.skip\((.*)\)')
def import_no_clients_in_api_and_scenario_tests(physical_line, filename):
@@ -132,6 +133,16 @@
yield (0, msg)
+def no_testtools_skip_decorator(logical_line):
+ """Check that methods do not have the testtools.skip decorator
+
+ T109
+ """
+ if TESTTOOLS_SKIP_DECORATOR.match(logical_line):
+ yield (0, "T109: Cannot use testtools.skip decorator; instead use "
+ "decorators.skip_because from tempest-lib")
+
+
def factory(register):
register(import_no_clients_in_api_and_scenario_tests)
register(scenario_tests_need_service_tags)
@@ -140,3 +151,4 @@
register(service_tags_not_in_module_path)
register(no_hyphen_at_end_of_rand_name)
register(no_mutable_default_args)
+ register(no_testtools_skip_decorator)
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 4b613bc..4f113d3 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -18,6 +18,7 @@
import netaddr
from oslo_log import log
+from oslo_serialization import jsonutils as json
import six
from tempest_lib.common.utils import misc as misc_utils
from tempest_lib import exceptions as lib_exc
@@ -101,10 +102,11 @@
def addCleanup_with_wait(self, waiter_callable, thing_id, thing_id_param,
cleanup_callable, cleanup_args=None,
- cleanup_kwargs=None, ignore_error=True):
+ cleanup_kwargs=None, waiter_client=None):
"""Adds wait for async resource deletion at the end of cleanups
@param waiter_callable: callable to wait for the resource to delete
+ with the following waiter_client if specified.
@param thing_id: the id of the resource to be cleaned-up
@param thing_id_param: the name of the id param in the waiter
@param cleanup_callable: method to load pass to self.addCleanup with
@@ -120,6 +122,8 @@
'waiter_callable': waiter_callable,
thing_id_param: thing_id
}
+ if waiter_client:
+ wait_dict['client'] = waiter_client
self.cleanup_waits.append(wait_dict)
def _wait_for_cleanups(self):
@@ -147,7 +151,7 @@
# We don't need to create a keypair by pubkey in scenario
body = client.create_keypair(name=name)
self.addCleanup(client.delete_keypair, name)
- return body
+ return body['keypair']
def create_server(self, name=None, image=None, flavor=None,
wait_on_boot=True, wait_on_delete=True,
@@ -177,13 +181,15 @@
server = self.servers_client.create_server(name, image, flavor,
**create_kwargs)
if wait_on_delete:
- self.addCleanup(self.servers_client.wait_for_server_termination,
+ self.addCleanup(waiters.wait_for_server_termination,
+ self.servers_client,
server['id'])
self.addCleanup_with_wait(
- waiter_callable=self.servers_client.wait_for_server_termination,
+ waiter_callable=waiters.wait_for_server_termination,
thing_id=server['id'], thing_id_param='server_id',
cleanup_callable=self.delete_wrapper,
- cleanup_args=[self.servers_client.delete_server, server['id']])
+ cleanup_args=[self.servers_client.delete_server, server['id']],
+ waiter_client=self.servers_client)
if wait_on_boot:
waiters.wait_for_server_status(self.servers_client,
server_id=server['id'],
@@ -201,7 +207,7 @@
name = data_utils.rand_name(self.__class__.__name__)
volume = self.volumes_client.create_volume(
size=size, display_name=name, snapshot_id=snapshot_id,
- imageRef=imageRef, volume_type=volume_type)
+ imageRef=imageRef, volume_type=volume_type)['volume']
if wait_on_delete:
self.addCleanup(self.volumes_client.wait_for_resource_deletion,
@@ -223,14 +229,14 @@
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
# The volume retrieved on creation has a non-up-to-date status.
# Retrieval after it becomes active ensures correct details.
- volume = self.volumes_client.show_volume(volume['id'])
+ volume = self.volumes_client.show_volume(volume['id'])['volume']
return volume
def _create_loginable_secgroup_rule(self, secgroup_id=None):
_client = self.security_groups_client
_client_rules = self.security_group_rules_client
if secgroup_id is None:
- sgs = _client.list_security_groups()
+ sgs = _client.list_security_groups()['security_groups']
for sg in sgs:
if sg['name'] == 'default':
secgroup_id = sg['id']
@@ -258,7 +264,7 @@
rules = list()
for ruleset in rulesets:
sg_rule = _client_rules.create_security_group_rule(
- parent_group_id=secgroup_id, **ruleset)
+ parent_group_id=secgroup_id, **ruleset)['security_group_rule']
self.addCleanup(self.delete_wrapper,
_client_rules.delete_security_group_rule,
sg_rule['id'])
@@ -270,7 +276,7 @@
sg_name = data_utils.rand_name(self.__class__.__name__)
sg_desc = sg_name + " description"
secgroup = self.security_groups_client.create_security_group(
- name=sg_name, description=sg_desc)
+ name=sg_name, description=sg_desc)['security_group']
self.assertEqual(secgroup['name'], sg_name)
self.assertEqual(secgroup['description'], sg_desc)
self.addCleanup(self.delete_wrapper,
@@ -351,7 +357,7 @@
'is_public': 'False',
}
params['properties'] = properties
- image = self.image_client.create_image(**params)
+ image = self.image_client.create_image(**params)['image']
self.addCleanup(self.image_client.delete_image, image['id'])
self.assertEqual("queued", image['status'])
self.image_client.update_image(image['id'], data=image_file)
@@ -420,6 +426,21 @@
cleanup_callable=self.delete_wrapper,
cleanup_args=[_image_client.delete_image, image_id])
snapshot_image = _image_client.get_image_meta(image_id)
+
+ bdm = snapshot_image.get('properties', {}).get('block_device_mapping')
+ if bdm:
+ bdm = json.loads(bdm)
+ if bdm and 'snapshot_id' in bdm[0]:
+ snapshot_id = bdm[0]['snapshot_id']
+ self.addCleanup(
+ self.snapshots_client.wait_for_resource_deletion,
+ snapshot_id)
+ self.addCleanup(
+ self.delete_wrapper, self.snapshots_client.delete_snapshot,
+ snapshot_id)
+ self.snapshots_client.wait_for_snapshot_status(snapshot_id,
+ 'available')
+
image_name = snapshot_image['name']
self.assertEqual(name, image_name)
LOG.debug("Created snapshot image %s for server %s",
@@ -428,19 +449,19 @@
def nova_volume_attach(self):
volume = self.servers_client.attach_volume(
- self.server['id'], self.volume['id'], '/dev/%s'
+ self.server['id'], volumeId=self.volume['id'], device='/dev/%s'
% CONF.compute.volume_device_name)
self.assertEqual(self.volume['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
# Refresh the volume after the attachment
- self.volume = self.volumes_client.show_volume(volume['id'])
+ self.volume = self.volumes_client.show_volume(volume['id'])['volume']
def nova_volume_detach(self):
self.servers_client.detach_volume(self.server['id'], self.volume['id'])
self.volumes_client.wait_for_volume_status(self.volume['id'],
'available')
- volume = self.volumes_client.show_volume(self.volume['id'])
+ volume = self.volumes_client.show_volume(self.volume['id'])['volume']
self.assertEqual('available', volume['status'])
def rebuild_server(self, server_id, image=None,
@@ -453,9 +474,10 @@
LOG.debug("Rebuilding server (id: %s, image: %s, preserve eph: %s)",
server_id, image, preserve_ephemeral)
- self.servers_client.rebuild(server_id=server_id, image_ref=image,
- preserve_ephemeral=preserve_ephemeral,
- **rebuild_kwargs)
+ self.servers_client.rebuild_server(
+ server_id=server_id, image_ref=image,
+ preserve_ephemeral=preserve_ephemeral,
+ **rebuild_kwargs)
if wait:
waiters.wait_for_server_status(self.servers_client,
server_id, 'ACTIVE')
@@ -525,7 +547,8 @@
Nova clients
"""
- floating_ip = self.floating_ips_client.create_floating_ip(pool_name)
+ floating_ip = (self.floating_ips_client.create_floating_ip(pool_name)
+ ['floating_ip'])
self.addCleanup(self.delete_wrapper,
self.floating_ips_client.delete_floating_ip,
floating_ip['id'])
@@ -596,6 +619,12 @@
*args, **kwargs)
return ports_list['ports']
+ def _list_agents(self, *args, **kwargs):
+ """List agents using admin creds """
+ agents_list = self.admin_manager.network_client.list_agents(
+ *args, **kwargs)
+ return agents_list['agents']
+
def _create_subnet(self, network, client=None, namestart='subnet-smoke',
**kwargs):
"""
@@ -672,14 +701,18 @@
def _get_server_port_id_and_ip4(self, server, ip_addr=None):
ports = self._list_ports(device_id=server['id'],
fixed_ip=ip_addr)
- self.assertEqual(len(ports), 1,
- "Unable to determine which port to target.")
# it might happen here that this port has more then one ip address
# as in case of dual stack- when this port is created on 2 subnets
- for ip46 in ports[0]['fixed_ips']:
- ip = ip46['ip_address']
- if netaddr.valid_ipv4(ip):
- return ports[0]['id'], ip
+ port_map = [(p["id"], fxip["ip_address"])
+ for p in ports
+ for fxip in p["fixed_ips"]
+ if netaddr.valid_ipv4(fxip["ip_address"])]
+
+ self.assertEqual(len(port_map), 1,
+ "Found multiple IPv4 addresses: %s. "
+ "Unable to determine which port to target."
+ % port_map)
+ return port_map[0]
def _get_network_by_name(self, network_name):
net = self._list_networks(name=network_name)
@@ -1089,14 +1122,10 @@
port = self._create_port(network_id=net_id,
client=net_client,
**create_port_body)
- # if port_vnic_type is set, ports in the passing
- # create_kwargs will be override, which cause the
- # inconsistence. Set the port_id according to network id
- if net_id == self.network['id']:
- self.port_id = port.id
ports.append({'port': port.id})
if ports:
create_kwargs['networks'] = ports
+ self.ports = ports
return super(NetworkScenarioTest, self).create_server(
name=name, image=image, flavor=flavor,
@@ -1294,7 +1323,7 @@
randomized_name = data_utils.rand_name('scenario-type-' + name)
LOG.debug("Creating a volume type: %s", randomized_name)
body = client.create_volume_type(
- randomized_name)
+ randomized_name)['volume_type']
self.assertIn('id', body)
self.addCleanup(client.delete_volume_type, body['id'])
return body
@@ -1310,7 +1339,7 @@
LOG.debug("Creating an encryption type for volume type: %s", type_id)
client.create_encryption_type(
type_id, provider=provider, key_size=key_size, cipher=cipher,
- control_location=control_location)
+ control_location=control_location)['encryption']
class SwiftScenarioTest(ScenarioTest):
diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py
index f5f4a61..22d2603 100644
--- a/tempest/scenario/test_aggregates_basic_ops.py
+++ b/tempest/scenario/test_aggregates_basic_ops.py
@@ -46,7 +46,8 @@
cls.hosts_client = cls.manager.hosts_client
def _create_aggregate(self, **kwargs):
- aggregate = self.aggregates_client.create_aggregate(**kwargs)
+ aggregate = (self.aggregates_client.create_aggregate(**kwargs)
+ ['aggregate'])
self.addCleanup(self._delete_aggregate, aggregate)
aggregate_name = kwargs['name']
availability_zone = kwargs['availability_zone']
@@ -58,23 +59,25 @@
self.aggregates_client.delete_aggregate(aggregate['id'])
def _get_host_name(self):
- hosts = self.hosts_client.list_hosts()
+ hosts = self.hosts_client.list_hosts()['hosts']
self.assertTrue(len(hosts) >= 1)
computes = [x for x in hosts if x['service'] == 'compute']
return computes[0]['host_name']
def _add_host(self, aggregate_id, host):
- aggregate = self.aggregates_client.add_host(aggregate_id, host=host)
+ aggregate = (self.aggregates_client.add_host(aggregate_id, host=host)
+ ['aggregate'])
self.addCleanup(self._remove_host, aggregate['id'], host)
self.assertIn(host, aggregate['hosts'])
def _remove_host(self, aggregate_id, host):
aggregate = self.aggregates_client.remove_host(aggregate_id, host=host)
- self.assertNotIn(host, aggregate['hosts'])
+ self.assertNotIn(host, aggregate['aggregate']['hosts'])
def _check_aggregate_details(self, aggregate, aggregate_name, azone,
hosts, metadata):
- aggregate = self.aggregates_client.show_aggregate(aggregate['id'])
+ aggregate = (self.aggregates_client.show_aggregate(aggregate['id'])
+ ['aggregate'])
self.assertEqual(aggregate_name, aggregate['name'])
self.assertEqual(azone, aggregate['availability_zone'])
self.assertEqual(hosts, aggregate['hosts'])
@@ -88,13 +91,14 @@
metadata=meta)
for key, value in meta.items():
- self.assertEqual(meta[key], aggregate['metadata'][key])
+ self.assertEqual(meta[key],
+ aggregate['aggregate']['metadata'][key])
def _update_aggregate(self, aggregate, aggregate_name,
availability_zone):
aggregate = self.aggregates_client.update_aggregate(
aggregate['id'], name=aggregate_name,
- availability_zone=availability_zone)
+ availability_zone=availability_zone)['aggregate']
self.assertEqual(aggregate['name'], aggregate_name)
self.assertEqual(aggregate['availability_zone'], availability_zone)
return aggregate
diff --git a/tempest/scenario/test_baremetal_basic_ops.py b/tempest/scenario/test_baremetal_basic_ops.py
index 346f56b..c0b5a44 100644
--- a/tempest/scenario/test_baremetal_basic_ops.py
+++ b/tempest/scenario/test_baremetal_basic_ops.py
@@ -101,14 +101,15 @@
def get_flavor_ephemeral_size(self):
"""Returns size of the ephemeral partition in GiB."""
f_id = self.instance['flavor']['id']
- flavor = self.flavors_client.show_flavor(f_id)
+ flavor = self.flavors_client.show_flavor(f_id)['flavor']
ephemeral = flavor.get('OS-FLV-EXT-DATA:ephemeral')
if not ephemeral or ephemeral == 'N/A':
return None
return int(ephemeral)
def add_floating_ip(self):
- floating_ip = self.floating_ips_client.create_floating_ip()
+ floating_ip = (self.floating_ips_client.create_floating_ip()
+ ['floating_ip'])
self.floating_ips_client.associate_floating_ip_to_server(
floating_ip['ip'], self.instance['id'])
return floating_ip['ip']
diff --git a/tempest/scenario/test_dashboard_basic_ops.py b/tempest/scenario/test_dashboard_basic_ops.py
index eb018eb..d5bad64 100644
--- a/tempest/scenario/test_dashboard_basic_ops.py
+++ b/tempest/scenario/test_dashboard_basic_ops.py
@@ -26,6 +26,7 @@
class HorizonHTMLParser(HTMLParser.HTMLParser):
csrf_token = None
region = None
+ login = None
def _find_name(self, attrs, name):
for attrpair in attrs:
@@ -39,12 +40,20 @@
return attrpair[1]
return None
+ def _find_attr_value(self, attrs, attr_name):
+ for attrpair in attrs:
+ if attrpair[0] == attr_name:
+ return attrpair[1]
+ return None
+
def handle_starttag(self, tag, attrs):
if tag == 'input':
if self._find_name(attrs, 'csrfmiddlewaretoken'):
self.csrf_token = self._find_value(attrs)
if self._find_name(attrs, 'region'):
self.region = self._find_value(attrs)
+ if tag == 'form':
+ self.login = self._find_attr_value(attrs, 'action')
class TestDashboardBasicOps(manager.ScenarioTest):
@@ -79,8 +88,12 @@
parser = HorizonHTMLParser()
parser.feed(response)
+ # construct login url for dashboard, discovery accommodates non-/ web
+ # root for dashboard
+ login_url = CONF.dashboard.dashboard_url + parser.login[1:]
+
# Prepare login form request
- req = request.Request(CONF.dashboard.login_url)
+ req = request.Request(login_url)
req.add_header('Content-type', 'application/x-www-form-urlencoded')
req.add_header('Referer', CONF.dashboard.dashboard_url)
params = {'username': username,
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index c44557e..2ad5d2d 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -87,7 +87,8 @@
# Since no traffic is tested, we don't need to actually add rules to
# secgroup
secgroup = self.security_groups_client.create_security_group(
- name='secgroup-%s' % name, description='secgroup-desc-%s' % name)
+ name='secgroup-%s' % name,
+ description='secgroup-desc-%s' % name)['security_group']
self.addCleanupClass(self.security_groups_client.delete_security_group,
secgroup['id'])
create_kwargs = {
@@ -109,8 +110,8 @@
for server in self.servers:
# after deleting all servers - wait for all servers to clear
# before cleanup continues
- self.addCleanupClass(self.servers_client.
- wait_for_server_termination,
+ self.addCleanupClass(waiters.wait_for_server_termination,
+ self.servers_client,
server['id'])
for server in self.servers:
self.addCleanupClass(self.servers_client.delete_server,
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index f868382..402bc68 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -63,23 +63,26 @@
def nova_show(self):
got_server = self.servers_client.show_server(self.server['id'])
+ excluded_keys = ['OS-EXT-AZ:availability_zone']
+ # Exclude these keys because of LP:#1486475
+ excluded_keys.extend(['OS-EXT-STS:power_state', 'updated'])
self.assertThat(
self.server, custom_matchers.MatchesDictExceptForKeys(
- got_server, excluded_keys=['OS-EXT-AZ:availability_zone']))
+ got_server, excluded_keys=excluded_keys))
def cinder_create(self):
self.volume = self.create_volume()
def cinder_list(self):
- volumes = self.volumes_client.list_volumes()
+ volumes = self.volumes_client.list_volumes()['volumes']
self.assertIn(self.volume['id'], [x['id'] for x in volumes])
def cinder_show(self):
- volume = self.volumes_client.show_volume(self.volume['id'])
+ volume = self.volumes_client.show_volume(self.volume['id'])['volume']
self.assertEqual(self.volume, volume)
def nova_reboot(self):
- self.servers_client.reboot(self.server['id'], 'SOFT')
+ self.servers_client.reboot_server(self.server['id'], 'SOFT')
self._wait_for_server_status('ACTIVE')
def check_partitions(self):
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index 3d233d8..62b2976 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -100,18 +100,19 @@
@test.services('compute', 'network')
def test_server_connectivity_stop_start(self):
self._setup_network_and_servers()
- self.servers_client.stop(self.server['id'])
+ self.servers_client.stop_server(self.server['id'])
waiters.wait_for_server_status(self.servers_client,
self.server['id'], 'SHUTOFF')
self._check_network_connectivity(should_connect=False)
- self.servers_client.start(self.server['id'])
+ self.servers_client.start_server(self.server['id'])
self._wait_server_status_and_check_network_connectivity()
@test.idempotent_id('7b6860c2-afa3-4846-9522-adeb38dfbe08')
@test.services('compute', 'network')
def test_server_connectivity_reboot(self):
self._setup_network_and_servers()
- self.servers_client.reboot(self.server['id'], reboot_type='SOFT')
+ self.servers_client.reboot_server(self.server['id'],
+ reboot_type='SOFT')
self._wait_server_status_and_check_network_connectivity()
@test.idempotent_id('88a529c2-1daa-4c85-9aec-d541ba3eb699')
@@ -119,8 +120,8 @@
def test_server_connectivity_rebuild(self):
self._setup_network_and_servers()
image_ref_alt = CONF.compute.image_ref_alt
- self.servers_client.rebuild(self.server['id'],
- image_ref=image_ref_alt)
+ self.servers_client.rebuild_server(self.server['id'],
+ image_ref=image_ref_alt)
self._wait_server_status_and_check_network_connectivity()
@test.idempotent_id('2b2642db-6568-4b35-b812-eceed3fa20ce')
@@ -159,8 +160,9 @@
msg = "Skipping test - flavor_ref and flavor_ref_alt are identical"
raise self.skipException(msg)
self._setup_network_and_servers()
- self.servers_client.resize(self.server['id'], flavor_ref=resize_flavor)
+ self.servers_client.resize_server(self.server['id'],
+ flavor_ref=resize_flavor)
waiters.wait_for_server_status(self.servers_client, self.server['id'],
'VERIFY_RESIZE')
- self.servers_client.confirm_resize(self.server['id'])
+ self.servers_client.confirm_resize_server(self.server['id'])
self._wait_server_status_and_check_network_connectivity()
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index b31ba69..8ca5e72 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -20,6 +20,7 @@
import testtools
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import exceptions
from tempest.scenario import manager
@@ -101,19 +102,18 @@
self.servers = []
def _setup_network_and_servers(self, **kwargs):
- vnic_type = CONF.network.port_vnic_type
boot_with_port = kwargs.pop('boot_with_port', False)
self.security_group = \
self._create_security_group(tenant_id=self.tenant_id)
self.network, self.subnet, self.router = self.create_networks(**kwargs)
self.check_networks()
+ self.ports = []
self.port_id = None
- # when vnic_type is set, ports will be created in create_server.
- # So no need to create a port here in this case.
- if boot_with_port and not vnic_type:
+ if boot_with_port:
# create a port on the network and boot with that
self.port_id = self._create_port(self.network['id']).id
+ self.ports.append({'port': self.port_id})
name = data_utils.rand_name('server-smoke')
server = self._create_server(name, self.network, self.port_id)
@@ -247,7 +247,7 @@
old_port = port_list[0]
interface = self.interface_client.create_interface(
server_id=server['id'],
- net_id=self.new_net.id)
+ net_id=self.new_net.id)['interfaceAttachment']
self.addCleanup(self.network_client.wait_for_resource_deletion,
'port',
interface['port_id'])
@@ -341,8 +341,8 @@
for remote_ip in address_list:
if should_connect:
- msg = "Timed out waiting for "
- "%s to become reachable" % remote_ip
+ msg = ("Timed out waiting for %s to become "
+ "reachable") % remote_ip
else:
msg = "ip address %s is reachable" % remote_ip
try:
@@ -634,7 +634,11 @@
# Setup the network, create a port and boot the server from that port.
self._setup_network_and_servers(boot_with_port=True)
_, server = self.floating_ip_tuple
- self.assertIsNotNone(self.port_id,
+ self.assertEqual(1, len(self.ports),
+ 'There should only be one port created for '
+ 'server %s.' % server['id'])
+ port_id = self.ports[0]['port']
+ self.assertIsNotNone(port_id,
'Server should have been created from a '
'pre-existing port.')
# Assert the port is bound to the server.
@@ -643,13 +647,86 @@
self.assertEqual(1, len(port_list),
'There should only be one port created for '
'server %s.' % server['id'])
- self.assertEqual(self.port_id, port_list[0]['id'])
+ self.assertEqual(port_id, port_list[0]['id'])
# Delete the server.
self.servers_client.delete_server(server['id'])
- self.servers_client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.servers_client, server['id'])
# Assert the port still exists on the network but is unbound from
# the deleted server.
- port = self.network_client.show_port(self.port_id)['port']
+ port = self.network_client.show_port(port_id)['port']
self.assertEqual(self.network['id'], port['network_id'])
self.assertEqual('', port['device_id'])
self.assertEqual('', port['device_owner'])
+
+ @test.idempotent_id('2e788c46-fb3f-4ac9-8f82-0561555bea73')
+ @test.services('compute', 'network')
+ def test_router_rescheduling(self):
+ """Tests that router can be removed from agent and add to a new agent.
+
+ 1. Verify connectivity
+ 2. Remove router from all l3-agents
+ 3. Verify connectivity is down
+ 4. Assign router to new l3-agent (or old one if no new agent is
+ available)
+ 5. Verify connectivity
+ """
+
+ # TODO(yfried): refactor this test to be used for other agents (dhcp)
+ # as well
+
+ list_hosts = (self.admin_manager.network_client.
+ list_l3_agents_hosting_router)
+ schedule_router = (self.admin_manager.network_client.
+ add_router_to_l3_agent)
+ unschedule_router = (self.admin_manager.network_client.
+ remove_router_from_l3_agent)
+
+ agent_list = set(a["id"] for a in
+ self._list_agents(agent_type="L3 agent"))
+ self._setup_network_and_servers()
+
+ # NOTE(kevinbenton): we have to use the admin credentials to check
+ # for the distributed flag because self.router only has a tenant view.
+ admin = self.admin_manager.network_client.show_router(self.router.id)
+ if admin['router'].get('distributed', False):
+ msg = "Rescheduling test does not apply to distributed routers."
+ raise self.skipException(msg)
+
+ self.check_public_network_connectivity(should_connect=True)
+
+ # remove resource from agents
+ hosting_agents = set(a["id"] for a in
+ list_hosts(self.router.id)['agents'])
+ no_migration = agent_list == hosting_agents
+ LOG.info("Router will be assigned to {mig} hosting agent".
+ format(mig="the same" if no_migration else "a new"))
+
+ for hosting_agent in hosting_agents:
+ unschedule_router(hosting_agent, self.router.id)
+ self.assertNotIn(hosting_agent,
+ [a["id"] for a in
+ list_hosts(self.router.id)['agents']],
+ 'unscheduling router failed')
+
+ # verify resource is un-functional
+ self.check_public_network_connectivity(
+ should_connect=False,
+ msg='after router unscheduling',
+ should_check_floating_ip_status=False
+ )
+
+ # schedule resource to new agent
+ target_agent = list(hosting_agents if no_migration else
+ agent_list - hosting_agents)[0]
+ schedule_router(target_agent,
+ self.router['id'])
+ self.assertEqual(
+ target_agent,
+ list_hosts(self.router.id)['agents'][0]['id'],
+ "Router failed to reschedule. Hosting agent doesn't match "
+ "target agent")
+
+ # verify resource is functional
+ self.check_public_network_connectivity(
+ should_connect=True,
+ msg='After router rescheduling')
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index 9481e58..a9394cb 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -69,13 +69,18 @@
'key_name': self.keypair['name'],
'security_groups': [{'name': self.sec_grp['name']}]}
- def prepare_network(self, address6_mode, n_subnets6=1):
+ def prepare_network(self, address6_mode, n_subnets6=1, dualnet=False):
"""Creates network with
given number of IPv6 subnets in the given mode and
one IPv4 subnet
Creates router with ports on all subnets
+ if dualnet - create IPv6 subnets on a different network
+ :return: list of created networks
"""
self.network = self._create_network(tenant_id=self.tenant_id)
+ if dualnet:
+ self.network_v6 = self._create_network(tenant_id=self.tenant_id)
+
sub4 = self._create_subnet(network=self.network,
namestart='sub4',
ip_version=4)
@@ -86,7 +91,8 @@
self.subnets_v6 = []
for _ in range(n_subnets6):
- sub6 = self._create_subnet(network=self.network,
+ net6 = self.network_v6 if dualnet else self.network
+ sub6 = self._create_subnet(network=net6,
namestart='sub6',
ip_version=6,
ipv6_ra_mode=address6_mode,
@@ -96,6 +102,8 @@
self.addCleanup(sub6.delete)
self.subnets_v6.append(sub6)
+ return [self.network, self.network_v6] if dualnet else [self.network]
+
@staticmethod
def define_server_ips(srv):
ips = {'4': None, '6': []}
@@ -107,11 +115,12 @@
ips['4'] = nic['addr']
return ips
- def prepare_server(self):
+ def prepare_server(self, networks=None):
username = CONF.compute.image_ssh_user
create_kwargs = self.srv_kwargs
- create_kwargs['networks'] = [{'uuid': self.network.id}]
+ networks = networks or [self.network]
+ create_kwargs['networks'] = [{'uuid': n.id} for n in networks]
srv = self.create_server(create_kwargs=create_kwargs)
fip = self.create_floating_ip(thing=srv)
@@ -119,18 +128,42 @@
ssh = self.get_remote_client(
server_or_ip=fip.floating_ip_address,
username=username)
- return ssh, ips
+ return ssh, ips, srv["id"]
- def _prepare_and_test(self, address6_mode, n_subnets6=1):
- self.prepare_network(address6_mode=address6_mode,
- n_subnets6=n_subnets6)
+ def turn_nic6_on(self, ssh, sid):
+ """Turns the IPv6 vNIC on
- sshv4_1, ips_from_api_1 = self.prepare_server()
- sshv4_2, ips_from_api_2 = self.prepare_server()
+ Required because guest images usually set only the first vNIC on boot.
+ Searches for the IPv6 vNIC's MAC and brings it up.
+
+ @param ssh: RemoteClient ssh instance to server
+ @param sid: server uuid
+ """
+ ports = [p["mac_address"] for p in
+ self._list_ports(device_id=sid,
+ network_id=self.network_v6.id)]
+ self.assertEqual(1, len(ports),
+ message="Multiple IPv6 ports found on network %s"
+ % self.network_v6)
+ mac6 = ports[0]
+ ssh.turn_nic_on(ssh.get_nic_name(mac6))
+
+ def _prepare_and_test(self, address6_mode, n_subnets6=1, dualnet=False):
+ net_list = self.prepare_network(address6_mode=address6_mode,
+ n_subnets6=n_subnets6,
+ dualnet=dualnet)
+
+ sshv4_1, ips_from_api_1, sid1 = self.prepare_server(networks=net_list)
+ sshv4_2, ips_from_api_2, sid2 = self.prepare_server(networks=net_list)
def guest_has_address(ssh, addr):
return addr in ssh.get_ip_list()
+ # Turn on 2nd NIC for Cirros when dualnet
+ if dualnet:
+ self.turn_nic6_on(sshv4_1, sid1)
+ self.turn_nic6_on(sshv4_2, sid2)
+
# get addresses assigned to vNIC as reported by 'ip address' utility
ips_from_ip_1 = sshv4_1.get_ip_list()
ips_from_ip_2 = sshv4_2.get_ip_list()
@@ -196,3 +229,25 @@
@test.services('compute', 'network')
def test_multi_prefix_slaac(self):
self._prepare_and_test(address6_mode='slaac', n_subnets6=2)
+
+ @test.idempotent_id('b6399d76-4438-4658-bcf5-0d6c8584fde2')
+ @test.services('compute', 'network')
+ def test_dualnet_slaac_from_os(self):
+ self._prepare_and_test(address6_mode='slaac', dualnet=True)
+
+ @test.idempotent_id('76f26acd-9688-42b4-bc3e-cd134c4cb09e')
+ @test.services('compute', 'network')
+ def test_dualnet_dhcp6_stateless_from_os(self):
+ self._prepare_and_test(address6_mode='dhcpv6-stateless', dualnet=True)
+
+ @test.idempotent_id('cf1c4425-766b-45b8-be35-e2959728eb00')
+ @test.services('compute', 'network')
+ def test_dualnet_multi_prefix_dhcpv6_stateless(self):
+ self._prepare_and_test(address6_mode='dhcpv6-stateless', n_subnets6=2,
+ dualnet=True)
+
+ @test.idempotent_id('9178ad42-10e4-47e9-8987-e02b170cc5cd')
+ @test.services('compute', 'network')
+ def test_dualnet_multi_prefix_slaac(self):
+ self._prepare_and_test(address6_mode='slaac', n_subnets6=2,
+ dualnet=True)
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 18fd09d..1db1ac2 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -161,9 +161,6 @@
cls.floating_ip_access = not CONF.network.public_router_id
- def cleanup_wrapper(self, resource):
- self.cleanup_resource(resource, self.__class__.__name__)
-
def setUp(self):
super(TestSecurityGroupsBasicOps, self).setUp()
self._deploy_tenant(self.primary_tenant)
diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py
index e405cf5..99eecae 100644
--- a/tempest/scenario/test_server_advanced_ops.py
+++ b/tempest/scenario/test_server_advanced_ops.py
@@ -58,12 +58,12 @@
resize_flavor = CONF.compute.flavor_ref_alt
LOG.debug("Resizing instance %s from flavor %s to flavor %s",
instance['id'], instance['flavor']['id'], resize_flavor)
- self.servers_client.resize(instance_id, resize_flavor)
+ self.servers_client.resize_server(instance_id, resize_flavor)
waiters.wait_for_server_status(self.servers_client, instance_id,
'VERIFY_RESIZE')
LOG.debug("Confirming resize of instance %s", instance_id)
- self.servers_client.confirm_resize(instance_id)
+ self.servers_client.confirm_resize_server(instance_id)
waiters.wait_for_server_status(self.servers_client, instance_id,
'ACTIVE')
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index f61b151..0f27cd1 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -16,6 +16,7 @@
from oslo_log import log as logging
from tempest import config
+from tempest import exceptions
from tempest.scenario import manager
from tempest.scenario import utils as test_utils
from tempest import test
@@ -82,7 +83,8 @@
def verify_ssh(self):
if self.run_ssh:
# Obtain a floating IP
- self.floating_ip = self.floating_ips_client.create_floating_ip()
+ self.floating_ip = (self.floating_ips_client.create_floating_ip()
+ ['floating_ip'])
self.addCleanup(self.delete_wrapper,
self.floating_ips_client.delete_floating_ip,
self.floating_ip['id'])
@@ -98,9 +100,24 @@
def verify_metadata(self):
if self.run_ssh and CONF.compute_feature_enabled.metadata_service:
# Verify metadata service
- result = self.ssh_client.exec_command(
- "curl http://169.254.169.254/latest/meta-data/public-ipv4")
- self.assertEqual(self.floating_ip['ip'], result)
+ md_url = 'http://169.254.169.254/latest/meta-data/public-ipv4'
+
+ def exec_cmd_and_verify_output():
+ cmd = 'curl ' + md_url
+ floating_ip = self.floating_ip['ip']
+ result = self.ssh_client.exec_command(cmd)
+ if result:
+ msg = ('Failed while verifying metadata on server. Result '
+ 'of command "%s" is NOT "%s".' % (cmd, floating_ip))
+ self.assertEqual(floating_ip, result, msg)
+ return 'Verification is successful!'
+
+ if not test.call_until_true(exec_cmd_and_verify_output,
+ CONF.compute.build_timeout,
+ CONF.compute.build_interval):
+ raise exceptions.TimeoutException('Timed out while waiting to '
+ 'verify metadata on server. '
+ '%s is empty.' % md_url)
@test.idempotent_id('7fff3fb3-91d8-4fd0-bd7d-0204f1f180ba')
@test.attr(type='smoke')
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index 02ee7b9..022306e 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -82,7 +82,8 @@
create_kwargs=create_kwargs)
if CONF.compute.use_floatingip_for_ssh:
- floating_ip = self.floating_ips_client.create_floating_ip()
+ floating_ip = (self.floating_ips_client.create_floating_ip()
+ ['floating_ip'])
self.addCleanup(self.delete_wrapper,
self.floating_ips_client.delete_floating_ip,
floating_ip['id'])
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index c1d9a1b..a7bdba3 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -80,12 +80,13 @@
def _create_volume_snapshot(self, volume):
snapshot_name = data_utils.rand_name('scenario-snapshot')
_, snapshot = self.snapshots_client.create_snapshot(
- volume['id'], display_name=snapshot_name)
+ volume['id'], display_name=snapshot_name)['snapshot']
def cleaner():
self.snapshots_client.delete_snapshot(snapshot['id'])
try:
- while self.snapshots_client.show_snapshot(snapshot['id']):
+ while self.snapshots_client.show_snapshot(
+ snapshot['id'])['snapshot']:
time.sleep(1)
except lib_exc.NotFound:
pass
@@ -104,7 +105,7 @@
def _attach_volume(self, server, volume):
attached_volume = self.servers_client.attach_volume(
- server['id'], volume['id'], device='/dev/%s'
+ server['id'], volumeId=volume['id'], device='/dev/%s'
% CONF.compute.volume_device_name)
self.assertEqual(volume['id'], attached_volume['id'])
self._wait_for_volume_status(attached_volume, 'in-use')
diff --git a/tempest/scenario/test_swift_telemetry_middleware.py b/tempest/scenario/test_swift_telemetry_middleware.py
index 29ce1a0..c5a0e7c 100644
--- a/tempest/scenario/test_swift_telemetry_middleware.py
+++ b/tempest/scenario/test_swift_telemetry_middleware.py
@@ -50,9 +50,6 @@
skip_msg = ("%s skipped as ceilometer is not available" %
cls.__name__)
raise cls.skipException(skip_msg)
- elif CONF.telemetry.too_slow_to_test:
- skip_msg = "Ceilometer feature for fast work mysql is disabled"
- raise cls.skipException(skip_msg)
@classmethod
def setup_clients(cls):
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index b019f85..ba419a6 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -11,6 +11,7 @@
# under the License.
from oslo_log import log
+from tempest_lib import decorators
from tempest.common.utils import data_utils
from tempest.common import waiters
@@ -48,7 +49,7 @@
vol_name = data_utils.rand_name('volume-origin')
return self.create_volume(name=vol_name, imageRef=img_uuid)
- def _boot_instance_from_volume(self, vol_id, keypair, security_group):
+ def _get_bdm(self, vol_id, delete_on_termination=False):
# NOTE(gfidente): the syntax for block_device_mapping is
# dev_name=id:type:size:delete_on_terminate
# where type needs to be "snap" if the server is booted
@@ -56,12 +57,20 @@
bd_map = [{
'device_name': 'vda',
'volume_id': vol_id,
- 'delete_on_termination': '0'}]
- create_kwargs = {
- 'block_device_mapping': bd_map,
- 'key_name': keypair['name'],
- 'security_groups': [{'name': security_group['name']}]
- }
+ 'delete_on_termination': str(int(delete_on_termination))}]
+ return {'block_device_mapping': bd_map}
+
+ def _boot_instance_from_volume(self, vol_id, keypair=None,
+ security_group=None,
+ delete_on_termination=False):
+ create_kwargs = dict()
+ if keypair:
+ create_kwargs['key_name'] = keypair['name']
+ if security_group:
+ create_kwargs['security_groups'] = [
+ {'name': security_group['name']}]
+ create_kwargs.update(self._get_bdm(
+ vol_id, delete_on_termination=delete_on_termination))
return self.create_server(image='', create_kwargs=create_kwargs)
def _create_snapshot_from_volume(self, vol_id):
@@ -69,7 +78,7 @@
snap = self.snapshots_client.create_snapshot(
volume_id=vol_id,
force=True,
- display_name=snap_name)
+ display_name=snap_name)['snapshot']
self.addCleanup(
self.snapshots_client.wait_for_resource_deletion, snap['id'])
self.addCleanup(self.snapshots_client.delete_snapshot, snap['id'])
@@ -90,27 +99,14 @@
def _stop_instances(self, instances):
# NOTE(gfidente): two loops so we do not wait for the status twice
for i in instances:
- self.servers_client.stop(i['id'])
+ self.servers_client.stop_server(i['id'])
for i in instances:
waiters.wait_for_server_status(self.servers_client,
i['id'], 'SHUTOFF')
- def _detach_volumes(self, volumes):
- # NOTE(gfidente): two loops so we do not wait for the status twice
- for v in volumes:
- self.volumes_client.detach_volume(v['id'])
- for v in volumes:
- self.volumes_client.wait_for_volume_status(v['id'], 'available')
-
def _ssh_to_server(self, server, keypair):
if CONF.compute.use_floatingip_for_ssh:
- floating_ip = self.floating_ips_client.create_floating_ip()
- self.addCleanup(self.delete_wrapper,
- self.floating_ips_client.delete_floating_ip,
- floating_ip['id'])
- self.floating_ips_client.associate_floating_ip_to_server(
- floating_ip['ip'], server['id'])
- ip = floating_ip['ip']
+ ip = self.create_floating_ip(server)['ip']
else:
ip = server
@@ -128,7 +124,7 @@
def _delete_server(self, server):
self.servers_client.delete_server(server['id'])
- self.servers_client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.servers_client, server['id'])
def _check_content_of_written_file(self, ssh_client, expected):
actual = self._get_content(ssh_client)
@@ -180,18 +176,35 @@
# deletion operations to succeed
self._stop_instances([instance_2nd, instance_from_snapshot])
+ @decorators.skip_because(bug='1489581')
+ @test.idempotent_id('36c34c67-7b54-4b59-b188-02a2f458a63b')
+ @test.services('compute', 'volume', 'image')
+ def test_create_ebs_image_and_check_boot(self):
+ # create an instance from volume
+ volume_origin = self._create_volume_from_image()
+ instance = self._boot_instance_from_volume(volume_origin['id'],
+ delete_on_termination=True)
+ # create EBS image
+ name = data_utils.rand_name('image')
+ image = self.create_server_snapshot(instance, name=name)
+
+ # delete instance
+ self._delete_server(instance)
+
+ # boot instance from EBS image
+ instance = self.create_server(image=image['id'])
+ # just ensure that instance booted
+
+ # delete instance
+ self._delete_server(instance)
+
class TestVolumeBootPatternV2(TestVolumeBootPattern):
- def _boot_instance_from_volume(self, vol_id, keypair, security_group):
+ def _get_bdm(self, vol_id, delete_on_termination=False):
bd_map_v2 = [{
'uuid': vol_id,
'source_type': 'volume',
'destination_type': 'volume',
'boot_index': 0,
- 'delete_on_termination': False}]
- create_kwargs = {
- 'block_device_mapping_v2': bd_map_v2,
- 'key_name': keypair['name'],
- 'security_groups': [{'name': security_group['name']}]
- }
- return self.create_server(image='', create_kwargs=create_kwargs)
+ 'delete_on_termination': delete_on_termination}]
+ return {'block_device_mapping_v2': bd_map_v2}
diff --git a/tempest/scenario/utils.py b/tempest/scenario/utils.py
index b1246d2..0a7d492 100644
--- a/tempest/scenario/utils.py
+++ b/tempest/scenario/utils.py
@@ -44,7 +44,7 @@
self.flavors_client = os.flavors_client
def ssh_user(self, image_id):
- _image = self.images_client.show_image(image_id)
+ _image = self.images_client.show_image(image_id)['image']
for regex, user in self.ssh_users:
# First match wins
if re.match(regex, _image['name']) is not None:
@@ -57,15 +57,15 @@
string=str(image['name']))
def is_sshable_image(self, image_id):
- _image = self.images_client.show_image(image_id)
+ _image = self.images_client.show_image(image_id)['image']
return self._is_sshable_image(_image)
def _is_flavor_enough(self, flavor, image):
return image['minDisk'] <= flavor['disk']
def is_flavor_enough(self, flavor_id, image_id):
- _image = self.images_client.show_image(image_id)
- _flavor = self.flavors_client.show_flavor(flavor_id)
+ _image = self.images_client.show_image(image_id)['image']
+ _flavor = self.flavors_client.show_flavor(flavor_id)['flavor']
return self._is_flavor_enough(_flavor, _image)
@@ -131,7 +131,7 @@
return []
if not hasattr(self, '_scenario_images'):
try:
- images = self.images_client.list_images()
+ images = self.images_client.list_images()['images']
self._scenario_images = [
(self._normalize_name(i['name']), dict(image_ref=i['id']))
for i in images if re.search(self.image_pattern,
@@ -148,7 +148,7 @@
"""
if not hasattr(self, '_scenario_flavors'):
try:
- flavors = self.flavors_client.list_flavors()
+ flavors = self.flavors_client.list_flavors()['flavors']
self._scenario_flavors = [
(self._normalize_name(f['name']), dict(flavor_ref=f['id']))
for f in flavors if re.search(self.flavor_pattern,
diff --git a/tempest/services/compute/json/agents_client.py b/tempest/services/compute/json/agents_client.py
index 1a1d832..d38c8cd 100644
--- a/tempest/services/compute/json/agents_client.py
+++ b/tempest/services/compute/json/agents_client.py
@@ -32,7 +32,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_agents, resp, body)
- return service_client.ResponseBodyList(resp, body['agents'])
+ return service_client.ResponseBody(resp, body)
def create_agent(self, **kwargs):
"""Create an agent build."""
@@ -40,7 +40,7 @@
resp, body = self.post('os-agents', post_body)
body = json.loads(body)
self.validate_response(schema.create_agent, resp, body)
- return service_client.ResponseBody(resp, body['agent'])
+ return service_client.ResponseBody(resp, body)
def delete_agent(self, agent_id):
"""Delete an existing agent build."""
@@ -53,4 +53,4 @@
put_body = json.dumps({'para': kwargs})
resp, body = self.put('os-agents/%s' % agent_id, put_body)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['agent'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/aggregates_client.py b/tempest/services/compute/json/aggregates_client.py
index 4114b8b..c9895db 100644
--- a/tempest/services/compute/json/aggregates_client.py
+++ b/tempest/services/compute/json/aggregates_client.py
@@ -27,14 +27,14 @@
resp, body = self.get("os-aggregates")
body = json.loads(body)
self.validate_response(schema.list_aggregates, resp, body)
- return service_client.ResponseBodyList(resp, body['aggregates'])
+ return service_client.ResponseBody(resp, body)
def show_aggregate(self, aggregate_id):
"""Get details of the given aggregate."""
resp, body = self.get("os-aggregates/%s" % aggregate_id)
body = json.loads(body)
self.validate_response(schema.get_aggregate, resp, body)
- return service_client.ResponseBody(resp, body['aggregate'])
+ return service_client.ResponseBody(resp, body)
def create_aggregate(self, **kwargs):
"""Creates a new aggregate."""
@@ -43,7 +43,7 @@
body = json.loads(body)
self.validate_response(schema.create_aggregate, resp, body)
- return service_client.ResponseBody(resp, body['aggregate'])
+ return service_client.ResponseBody(resp, body)
def update_aggregate(self, aggregate_id, **kwargs):
"""Update a aggregate."""
@@ -52,7 +52,7 @@
body = json.loads(body)
self.validate_response(schema.update_aggregate, resp, body)
- return service_client.ResponseBody(resp, body['aggregate'])
+ return service_client.ResponseBody(resp, body)
def delete_aggregate(self, aggregate_id):
"""Deletes the given aggregate."""
@@ -79,7 +79,7 @@
post_body)
body = json.loads(body)
self.validate_response(schema.aggregate_add_remove_host, resp, body)
- return service_client.ResponseBody(resp, body['aggregate'])
+ return service_client.ResponseBody(resp, body)
def remove_host(self, aggregate_id, **kwargs):
"""Removes a host from the given aggregate."""
@@ -88,7 +88,7 @@
post_body)
body = json.loads(body)
self.validate_response(schema.aggregate_add_remove_host, resp, body)
- return service_client.ResponseBody(resp, body['aggregate'])
+ return service_client.ResponseBody(resp, body)
def set_metadata(self, aggregate_id, **kwargs):
"""Replaces the aggregate's existing metadata with new metadata."""
@@ -97,4 +97,4 @@
post_body)
body = json.loads(body)
self.validate_response(schema.aggregate_set_metadata, resp, body)
- return service_client.ResponseBody(resp, body['aggregate'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/availability_zone_client.py b/tempest/services/compute/json/availability_zone_client.py
index c74fd10..0012637 100644
--- a/tempest/services/compute/json/availability_zone_client.py
+++ b/tempest/services/compute/json/availability_zone_client.py
@@ -32,5 +32,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema_list, resp, body)
- return service_client.ResponseBodyList(resp,
- body['availabilityZoneInfo'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/baremetal_nodes_client.py b/tempest/services/compute/json/baremetal_nodes_client.py
index 8165292..15f883a 100644
--- a/tempest/services/compute/json/baremetal_nodes_client.py
+++ b/tempest/services/compute/json/baremetal_nodes_client.py
@@ -33,7 +33,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_baremetal_nodes, resp, body)
- return service_client.ResponseBodyList(resp, body['nodes'])
+ return service_client.ResponseBody(resp, body)
def show_baremetal_node(self, baremetal_node_id):
"""Returns the details of a single baremetal node."""
@@ -41,4 +41,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_baremetal_node, resp, body)
- return service_client.ResponseBody(resp, body['node'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py
index c25b273..d6c72f4 100644
--- a/tempest/services/compute/json/certificates_client.py
+++ b/tempest/services/compute/json/certificates_client.py
@@ -26,7 +26,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_certificate, resp, body)
- return service_client.ResponseBody(resp, body['certificate'])
+ return service_client.ResponseBody(resp, body)
def create_certificate(self):
"""create certificates."""
@@ -34,4 +34,4 @@
resp, body = self.post(url, None)
body = json.loads(body)
self.validate_response(schema.create_certificate, resp, body)
- return service_client.ResponseBody(resp, body['certificate'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/extensions_client.py b/tempest/services/compute/json/extensions_client.py
index da342a8..4741812 100644
--- a/tempest/services/compute/json/extensions_client.py
+++ b/tempest/services/compute/json/extensions_client.py
@@ -26,9 +26,9 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_extensions, resp, body)
- return service_client.ResponseBodyList(resp, body['extensions'])
+ return service_client.ResponseBody(resp, body)
def show_extension(self, extension_alias):
resp, body = self.get('extensions/%s' % extension_alias)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['extension'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/fixed_ips_client.py b/tempest/services/compute/json/fixed_ips_client.py
index d0d9ca1..23401c3 100644
--- a/tempest/services/compute/json/fixed_ips_client.py
+++ b/tempest/services/compute/json/fixed_ips_client.py
@@ -26,7 +26,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_fixed_ip, resp, body)
- return service_client.ResponseBody(resp, body['fixed_ip'])
+ return service_client.ResponseBody(resp, body)
def reserve_fixed_ip(self, fixed_ip, **kwargs):
"""This reserves and unreserves fixed ips."""
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index 1422944..2c32d30 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -39,13 +39,13 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(_schema, resp, body)
- return service_client.ResponseBodyList(resp, body['flavors'])
+ return service_client.ResponseBody(resp, body)
def show_flavor(self, flavor_id):
resp, body = self.get("flavors/%s" % flavor_id)
body = json.loads(body)
self.validate_response(schema.create_get_flavor_details, resp, body)
- return service_client.ResponseBody(resp, body['flavor'])
+ return service_client.ResponseBody(resp, body)
def create_flavor(self, **kwargs):
"""Creates a new flavor or instance type.
@@ -64,7 +64,7 @@
body = json.loads(body)
self.validate_response(schema.create_get_flavor_details, resp, body)
- return service_client.ResponseBody(resp, body['flavor'])
+ return service_client.ResponseBody(resp, body)
def delete_flavor(self, flavor_id):
"""Deletes the given flavor."""
@@ -76,7 +76,7 @@
# Did not use show_flavor(id) for verification as it gives
# 200 ok even for deleted id. LP #981263
# we can remove the loop here and use get by ID when bug gets sortedout
- flavors = self.list_flavors(detail=True)
+ flavors = self.list_flavors(detail=True)['flavors']
for flavor in flavors:
if flavor['id'] == id:
return False
@@ -95,7 +95,7 @@
body = json.loads(body)
self.validate_response(schema_extra_specs.set_get_flavor_extra_specs,
resp, body)
- return service_client.ResponseBody(resp, body['extra_specs'])
+ return service_client.ResponseBody(resp, body)
def list_flavor_extra_specs(self, flavor_id):
"""Gets extra Specs details of the mentioned flavor."""
@@ -103,7 +103,7 @@
body = json.loads(body)
self.validate_response(schema_extra_specs.set_get_flavor_extra_specs,
resp, body)
- return service_client.ResponseBody(resp, body['extra_specs'])
+ return service_client.ResponseBody(resp, body)
def show_flavor_extra_spec(self, flavor_id, key):
"""Gets extra Specs key-value of the mentioned flavor and key."""
@@ -138,7 +138,7 @@
body = json.loads(body)
self.validate_response(schema_access.add_remove_list_flavor_access,
resp, body)
- return service_client.ResponseBodyList(resp, body['flavor_access'])
+ return service_client.ResponseBody(resp, body)
def add_flavor_access(self, flavor_id, tenant_id):
"""Add flavor access for the specified tenant."""
@@ -152,7 +152,7 @@
body = json.loads(body)
self.validate_response(schema_access.add_remove_list_flavor_access,
resp, body)
- return service_client.ResponseBodyList(resp, body['flavor_access'])
+ return service_client.ResponseBody(resp, body)
def remove_flavor_access(self, flavor_id, tenant_id):
"""Remove flavor access from the specified tenant."""
@@ -166,4 +166,4 @@
body = json.loads(body)
self.validate_response(schema_access.add_remove_list_flavor_access,
resp, body)
- return service_client.ResponseBody(resp, body['flavor_access'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/floating_ip_pools_client.py b/tempest/services/compute/json/floating_ip_pools_client.py
index 1e2133b..c83537a 100644
--- a/tempest/services/compute/json/floating_ip_pools_client.py
+++ b/tempest/services/compute/json/floating_ip_pools_client.py
@@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import json
-
+from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute.v2_1 import floating_ips as schema
@@ -24,7 +23,7 @@
class FloatingIPPoolsClient(service_client.ServiceClient):
def list_floating_ip_pools(self, params=None):
- """Returns a list of all floating IP Pools."""
+ """Gets all floating IP Pools list."""
url = 'os-floating-ip-pools'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -32,4 +31,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_floating_ip_pools, resp, body)
- return service_client.ResponseBodyList(resp, body['floating_ip_pools'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/floating_ips_bulk_client.py b/tempest/services/compute/json/floating_ips_bulk_client.py
index 8b1c5a9..dfe69f0 100644
--- a/tempest/services/compute/json/floating_ips_bulk_client.py
+++ b/tempest/services/compute/json/floating_ips_bulk_client.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import json
+from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import floating_ips as schema
from tempest.common import service_client
@@ -32,21 +32,19 @@
resp, body = self.post('os-floating-ips-bulk', post_body)
body = json.loads(body)
self.validate_response(schema.create_floating_ips_bulk, resp, body)
- return service_client.ResponseBody(resp,
- body['floating_ips_bulk_create'])
+ return service_client.ResponseBody(resp, body)
def list_floating_ips_bulk(self):
- """Returns a list of all floating IPs bulk."""
+ """Gets all floating IPs in bulk."""
resp, body = self.get('os-floating-ips-bulk')
body = json.loads(body)
self.validate_response(schema.list_floating_ips_bulk, resp, body)
- return service_client.ResponseBodyList(resp, body['floating_ip_info'])
+ return service_client.ResponseBody(resp, body)
def delete_floating_ips_bulk(self, ip_range):
- """Deletes the provided floating IPs bulk."""
+ """Deletes the provided floating IPs in bulk."""
post_body = json.dumps({'ip_range': ip_range})
resp, body = self.put('os-floating-ips-bulk/delete', post_body)
body = json.loads(body)
self.validate_response(schema.delete_floating_ips_bulk, resp, body)
- data = body['floating_ips_bulk_delete']
- return service_client.ResponseBodyData(resp, data)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 2193949..69d06a3 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -32,7 +32,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_floating_ips, resp, body)
- return service_client.ResponseBodyList(resp, body['floating_ips'])
+ return service_client.ResponseBody(resp, body)
def show_floating_ip(self, floating_ip_id):
"""Get the details of a floating IP."""
@@ -40,7 +40,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.create_get_floating_ip, resp, body)
- return service_client.ResponseBody(resp, body['floating_ip'])
+ return service_client.ResponseBody(resp, body)
def create_floating_ip(self, pool_name=None):
"""Allocate a floating IP to the project."""
@@ -50,7 +50,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.validate_response(schema.create_get_floating_ip, resp, body)
- return service_client.ResponseBody(resp, body['floating_ip'])
+ return service_client.ResponseBody(resp, body)
def delete_floating_ip(self, floating_ip_id):
"""Deletes the provided floating IP from the project."""
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index 752af68..3d3cb18 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -31,7 +31,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_hosts, resp, body)
- return service_client.ResponseBodyList(resp, body['hosts'])
+ return service_client.ResponseBody(resp, body)
def show_host(self, hostname):
"""Show detail information for the host."""
@@ -39,7 +39,7 @@
resp, body = self.get("os-hosts/%s" % hostname)
body = json.loads(body)
self.validate_response(schema.get_host_detail, resp, body)
- return service_client.ResponseBodyList(resp, body['host'])
+ return service_client.ResponseBody(resp, body)
def update_host(self, hostname, **kwargs):
"""Update a host."""
@@ -62,7 +62,7 @@
resp, body = self.get("os-hosts/%s/startup" % hostname)
body = json.loads(body)
self.validate_response(schema.startup_host, resp, body)
- return service_client.ResponseBody(resp, body['host'])
+ return service_client.ResponseBody(resp, body)
def shutdown_host(self, hostname):
"""Shutdown a host."""
@@ -70,7 +70,7 @@
resp, body = self.get("os-hosts/%s/shutdown" % hostname)
body = json.loads(body)
self.validate_response(schema.shutdown_host, resp, body)
- return service_client.ResponseBody(resp, body['host'])
+ return service_client.ResponseBody(resp, body)
def reboot_host(self, hostname):
"""reboot a host."""
@@ -78,4 +78,4 @@
resp, body = self.get("os-hosts/%s/reboot" % hostname)
body = json.loads(body)
self.validate_response(schema.reboot_host, resp, body)
- return service_client.ResponseBody(resp, body['host'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/hypervisor_client.py b/tempest/services/compute/json/hypervisor_client.py
index e894a5c..ba06f23 100644
--- a/tempest/services/compute/json/hypervisor_client.py
+++ b/tempest/services/compute/json/hypervisor_client.py
@@ -32,39 +32,39 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(_schema, resp, body)
- return service_client.ResponseBodyList(resp, body['hypervisors'])
+ return service_client.ResponseBody(resp, body)
def show_hypervisor(self, hypervisor_id):
"""Display the details of the specified hypervisor."""
resp, body = self.get('os-hypervisors/%s' % hypervisor_id)
body = json.loads(body)
self.validate_response(schema.get_hypervisor, resp, body)
- return service_client.ResponseBody(resp, body['hypervisor'])
+ return service_client.ResponseBody(resp, body)
def list_servers_on_hypervisor(self, hypervisor_name):
"""List instances belonging to the specified hypervisor."""
resp, body = self.get('os-hypervisors/%s/servers' % hypervisor_name)
body = json.loads(body)
self.validate_response(schema.get_hypervisors_servers, resp, body)
- return service_client.ResponseBodyList(resp, body['hypervisors'])
+ return service_client.ResponseBody(resp, body)
def show_hypervisor_statistics(self):
"""Get hypervisor statistics over all compute nodes."""
resp, body = self.get('os-hypervisors/statistics')
body = json.loads(body)
self.validate_response(schema.get_hypervisor_statistics, resp, body)
- return service_client.ResponseBody(resp, body['hypervisor_statistics'])
+ return service_client.ResponseBody(resp, body)
def show_hypervisor_uptime(self, hypervisor_id):
"""Display the uptime of the specified hypervisor."""
resp, body = self.get('os-hypervisors/%s/uptime' % hypervisor_id)
body = json.loads(body)
self.validate_response(schema.get_hypervisor_uptime, resp, body)
- return service_client.ResponseBody(resp, body['hypervisor'])
+ return service_client.ResponseBody(resp, body)
def search_hypervisor(self, hypervisor_name):
"""Search specified hypervisor."""
resp, body = self.get('os-hypervisors/%s/search' % hypervisor_name)
body = json.loads(body)
self.validate_response(schema.list_search_hypervisors, resp, body)
- return service_client.ResponseBodyList(resp, body['hypervisors'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py
index 4e7e93f..99fdfe6 100644
--- a/tempest/services/compute/json/images_client.py
+++ b/tempest/services/compute/json/images_client.py
@@ -47,7 +47,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(_schema, resp, body)
- return service_client.ResponseBodyList(resp, body['images'])
+ return service_client.ResponseBody(resp, body)
def show_image(self, image_id):
"""Returns the details of a single image."""
@@ -55,7 +55,7 @@
self.expected_success(200, resp.status)
body = json.loads(body)
self.validate_response(schema.get_image, resp, body)
- return service_client.ResponseBody(resp, body['image'])
+ return service_client.ResponseBody(resp, body)
def delete_image(self, image_id):
"""Deletes the provided image."""
@@ -68,7 +68,7 @@
resp, body = self.get("images/%s/metadata" % image_id)
body = json.loads(body)
self.validate_response(schema.image_metadata, resp, body)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def set_image_metadata(self, image_id, meta):
"""Sets the metadata for an image."""
@@ -76,7 +76,7 @@
resp, body = self.put('images/%s/metadata' % image_id, post_body)
body = json.loads(body)
self.validate_response(schema.image_metadata, resp, body)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def update_image_metadata(self, image_id, meta):
"""Updates the metadata for an image."""
@@ -84,14 +84,14 @@
resp, body = self.post('images/%s/metadata' % image_id, post_body)
body = json.loads(body)
self.validate_response(schema.image_metadata, resp, body)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def show_image_metadata_item(self, image_id, key):
"""Returns the value for a specific image metadata key."""
resp, body = self.get("images/%s/metadata/%s" % (image_id, key))
body = json.loads(body)
self.validate_response(schema.image_meta_item, resp, body)
- return service_client.ResponseBody(resp, body['meta'])
+ return service_client.ResponseBody(resp, body)
def set_image_metadata_item(self, image_id, key, meta):
"""Sets the value for a specific image metadata key."""
@@ -100,7 +100,7 @@
post_body)
body = json.loads(body)
self.validate_response(schema.image_meta_item, resp, body)
- return service_client.ResponseBody(resp, body['meta'])
+ return service_client.ResponseBody(resp, body)
def delete_image_metadata_item(self, image_id, key):
"""Deletes a single image metadata key/value pair."""
diff --git a/tempest/services/compute/json/instance_usage_audit_log_client.py b/tempest/services/compute/json/instance_usage_audit_log_client.py
index f06a675..4d9625e 100644
--- a/tempest/services/compute/json/instance_usage_audit_log_client.py
+++ b/tempest/services/compute/json/instance_usage_audit_log_client.py
@@ -28,13 +28,11 @@
body = json.loads(body)
self.validate_response(schema.list_instance_usage_audit_log,
resp, body)
- return service_client.ResponseBody(resp,
- body["instance_usage_audit_logs"])
+ return service_client.ResponseBody(resp, body)
def show_instance_usage_audit_log(self, time_before):
url = 'os-instance_usage_audit_log/%s' % time_before
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_instance_usage_audit_log, resp, body)
- return service_client.ResponseBody(resp,
- body["instance_usage_audit_log"])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/interfaces_client.py b/tempest/services/compute/json/interfaces_client.py
index c437c08..2e66082 100644
--- a/tempest/services/compute/json/interfaces_client.py
+++ b/tempest/services/compute/json/interfaces_client.py
@@ -26,8 +26,7 @@
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.ResponseBodyList(resp,
- body['interfaceAttachments'])
+ return service_client.ResponseBody(resp, body)
def create_interface(self, server_id, **kwargs):
post_body = {'interfaceAttachment': kwargs}
@@ -36,14 +35,14 @@
body=post_body)
body = json.loads(body)
self.validate_response(schema.get_create_interfaces, resp, body)
- return service_client.ResponseBody(resp, body['interfaceAttachment'])
+ 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['interfaceAttachment'])
+ 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,
diff --git a/tempest/services/compute/json/keypairs_client.py b/tempest/services/compute/json/keypairs_client.py
index e51671f..2e22bc6 100644
--- a/tempest/services/compute/json/keypairs_client.py
+++ b/tempest/services/compute/json/keypairs_client.py
@@ -24,26 +24,21 @@
def list_keypairs(self):
resp, body = self.get("os-keypairs")
body = json.loads(body)
- # Each returned keypair is embedded within an unnecessary 'keypair'
- # element which is a deviation from other resources like floating-ips,
- # servers, etc. A bug?
- # For now we shall adhere to the spec, but the spec for keypairs
- # is yet to be found
self.validate_response(schema.list_keypairs, resp, body)
- return service_client.ResponseBodyList(resp, body['keypairs'])
+ return service_client.ResponseBody(resp, body)
def show_keypair(self, keypair_name):
resp, body = self.get("os-keypairs/%s" % keypair_name)
body = json.loads(body)
self.validate_response(schema.get_keypair, resp, body)
- return service_client.ResponseBody(resp, body['keypair'])
+ return service_client.ResponseBody(resp, body)
def create_keypair(self, **kwargs):
post_body = json.dumps({'keypair': kwargs})
resp, body = self.post("os-keypairs", body=post_body)
body = json.loads(body)
self.validate_response(schema.create_keypair, resp, body)
- return service_client.ResponseBody(resp, body['keypair'])
+ return service_client.ResponseBody(resp, body)
def delete_keypair(self, keypair_name):
resp, body = self.delete("os-keypairs/%s" % keypair_name)
diff --git a/tempest/services/compute/json/limits_client.py b/tempest/services/compute/json/limits_client.py
index 4287619..b64b4a5 100644
--- a/tempest/services/compute/json/limits_client.py
+++ b/tempest/services/compute/json/limits_client.py
@@ -25,4 +25,4 @@
resp, body = self.get("limits")
body = json.loads(body)
self.validate_response(schema.get_limit, resp, body)
- return service_client.ResponseBody(resp, body['limits'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/migrations_client.py b/tempest/services/compute/json/migrations_client.py
index 06c8f13..b302539 100644
--- a/tempest/services/compute/json/migrations_client.py
+++ b/tempest/services/compute/json/migrations_client.py
@@ -31,4 +31,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_migrations, resp, body)
- return service_client.ResponseBodyList(resp, body['migrations'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/networks_client.py b/tempest/services/compute/json/networks_client.py
index 6373f01..dd20ee5 100644
--- a/tempest/services/compute/json/networks_client.py
+++ b/tempest/services/compute/json/networks_client.py
@@ -24,10 +24,10 @@
resp, body = self.get("os-networks")
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['networks'])
+ return service_client.ResponseBody(resp, body)
def show_network(self, network_id):
resp, body = self.get("os-networks/%s" % network_id)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['network'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/quota_classes_client.py b/tempest/services/compute/json/quota_classes_client.py
index 30d3501..d55c3f1 100644
--- a/tempest/services/compute/json/quota_classes_client.py
+++ b/tempest/services/compute/json/quota_classes_client.py
@@ -29,7 +29,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(classes_schema.get_quota_class_set, resp, body)
- return service_client.ResponseBody(resp, body['quota_class_set'])
+ return service_client.ResponseBody(resp, body)
def update_quota_class_set(self, quota_class_id, **kwargs):
"""
@@ -43,4 +43,4 @@
body = json.loads(body)
self.validate_response(classes_schema.update_quota_class_set,
resp, body)
- return service_client.ResponseBody(resp, body['quota_class_set'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
index 88d0567..4a1b909 100644
--- a/tempest/services/compute/json/quotas_client.py
+++ b/tempest/services/compute/json/quotas_client.py
@@ -30,7 +30,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_quota_set, resp, body)
- return service_client.ResponseBody(resp, body['quota_set'])
+ return service_client.ResponseBody(resp, body)
def show_default_quota_set(self, tenant_id):
"""List the default quota set for a tenant."""
@@ -39,7 +39,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_quota_set, resp, body)
- return service_client.ResponseBody(resp, body['quota_set'])
+ return service_client.ResponseBody(resp, body)
def update_quota_set(self, tenant_id, user_id=None, **kwargs):
"""
@@ -56,7 +56,7 @@
body = json.loads(body)
self.validate_response(schema.update_quota_set, resp, body)
- return service_client.ResponseBody(resp, body['quota_set'])
+ return service_client.ResponseBody(resp, body)
def delete_quota_set(self, tenant_id):
"""Delete the tenant's quota set."""
diff --git a/tempest/services/compute/json/security_group_default_rules_client.py b/tempest/services/compute/json/security_group_default_rules_client.py
index 658b89a..6e4d1e4 100644
--- a/tempest/services/compute/json/security_group_default_rules_client.py
+++ b/tempest/services/compute/json/security_group_default_rules_client.py
@@ -36,8 +36,7 @@
body = json.loads(body)
self.validate_response(schema.create_get_security_group_default_rule,
resp, body)
- rule = body['security_group_default_rule']
- return service_client.ResponseBody(resp, rule)
+ return service_client.ResponseBody(resp, body)
def delete_security_group_default_rule(self,
security_group_default_rule_id):
@@ -54,8 +53,7 @@
body = json.loads(body)
self.validate_response(schema.list_security_group_default_rules,
resp, body)
- rules = body['security_group_default_rules']
- return service_client.ResponseBodyList(resp, rules)
+ return service_client.ResponseBody(resp, body)
def show_security_group_default_rule(self, security_group_default_rule_id):
"""Return the details of provided Security Group default rule."""
@@ -64,5 +62,4 @@
body = json.loads(body)
self.validate_response(schema.create_get_security_group_default_rule,
resp, body)
- rule = body['security_group_default_rule']
- return service_client.ResponseBody(resp, rule)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/security_group_rules_client.py b/tempest/services/compute/json/security_group_rules_client.py
index 9a7c881..c1c6b1a 100644
--- a/tempest/services/compute/json/security_group_rules_client.py
+++ b/tempest/services/compute/json/security_group_rules_client.py
@@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import json
-
+from oslo_serialization import jsonutils as json
from tempest_lib import exceptions as lib_exc
from tempest.api_schema.response.compute.v2_1 import security_groups as schema
@@ -39,7 +38,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.validate_response(schema.create_security_group_rule, resp, body)
- return service_client.ResponseBody(resp, body['security_group_rule'])
+ return service_client.ResponseBody(resp, body)
def delete_security_group_rule(self, group_rule_id):
"""Deletes the provided Security Group rule."""
@@ -55,5 +54,5 @@
self.validate_response(schema.list_security_groups, resp, body)
for sg in body['security_groups']:
if sg['id'] == security_group_id:
- return service_client.ResponseBodyList(resp, sg['rules'])
+ return service_client.ResponseBody(resp, sg)
raise lib_exc.NotFound('No such Security Group')
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index c0b667b..083d03a 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -33,7 +33,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_security_groups, resp, body)
- return service_client.ResponseBodyList(resp, body['security_groups'])
+ return service_client.ResponseBody(resp, body)
def show_security_group(self, security_group_id):
"""Get the details of a Security Group."""
@@ -41,7 +41,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_security_group, resp, body)
- return service_client.ResponseBody(resp, body['security_group'])
+ return service_client.ResponseBody(resp, body)
def create_security_group(self, **kwargs):
"""
@@ -53,7 +53,7 @@
resp, body = self.post('os-security-groups', post_body)
body = json.loads(body)
self.validate_response(schema.get_security_group, resp, body)
- return service_client.ResponseBody(resp, body['security_group'])
+ return service_client.ResponseBody(resp, body)
def update_security_group(self, security_group_id, **kwargs):
"""
@@ -67,7 +67,7 @@
post_body)
body = json.loads(body)
self.validate_response(schema.update_security_group, resp, body)
- return service_client.ResponseBody(resp, body['security_group'])
+ return service_client.ResponseBody(resp, body)
def delete_security_group(self, security_group_id):
"""Deletes the provided Security Group."""
diff --git a/tempest/services/compute/json/server_groups_client.py b/tempest/services/compute/json/server_groups_client.py
index 9fec930..33501fb 100644
--- a/tempest/services/compute/json/server_groups_client.py
+++ b/tempest/services/compute/json/server_groups_client.py
@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import json
+from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import servers as schema
from tempest.common import service_client
@@ -38,7 +38,7 @@
body = json.loads(body)
self.validate_response(schema.create_get_server_group, resp, body)
- return service_client.ResponseBody(resp, body['server_group'])
+ return service_client.ResponseBody(resp, body)
def delete_server_group(self, server_group_id):
"""Delete the given server-group."""
@@ -51,11 +51,11 @@
resp, body = self.get("os-server-groups")
body = json.loads(body)
self.validate_response(schema.list_server_groups, resp, body)
- return service_client.ResponseBodyList(resp, body['server_groups'])
+ return service_client.ResponseBody(resp, body)
def get_server_group(self, server_group_id):
"""Get the details of given server_group."""
resp, body = self.get("os-server-groups/%s" % server_group_id)
body = json.loads(body)
self.validate_response(schema.create_get_server_group, resp, body)
- return service_client.ResponseBody(resp, body['server_group'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 1159a58..5603fed 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -14,15 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-import time
-
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
-from tempest_lib import exceptions as lib_exc
from tempest.api_schema.response.compute.v2_1 import servers as schema
from tempest.common import service_client
-from tempest import exceptions
class ServersClient(service_client.ServiceClient):
@@ -101,35 +97,16 @@
self.validate_response(create_schema, resp, body)
return service_client.ResponseBody(resp, body['server'])
- def update_server(self, server_id, name=None, meta=None, accessIPv4=None,
- accessIPv6=None, disk_config=None):
+ def update_server(self, server_id, **kwargs):
+ """Updates the properties of an existing server.
+ Most parameters except the following are passed to the API without
+ any changes.
+ :param disk_config: The name is changed to OS-DCF:diskConfig
"""
- Updates the properties of an existing server.
- server_id: The id of an existing server.
- name: The name of the server.
- personality: A list of files to be injected into the server.
- accessIPv4: The IPv4 access address for the server.
- accessIPv6: The IPv6 access address for the server.
- """
+ if kwargs.get('disk_config'):
+ kwargs['OS-DCF:diskConfig'] = kwargs.pop('disk_config')
- post_body = {}
-
- if meta is not None:
- post_body['metadata'] = meta
-
- if name is not None:
- post_body['name'] = name
-
- if accessIPv4 is not None:
- post_body['accessIPv4'] = accessIPv4
-
- if accessIPv6 is not None:
- post_body['accessIPv6'] = accessIPv6
-
- if disk_config is not None:
- post_body['OS-DCF:diskConfig'] = disk_config
-
- post_body = json.dumps({'server': post_body})
+ 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)
@@ -165,24 +142,6 @@
self.validate_response(_schema, resp, body)
return service_client.ResponseBody(resp, body)
- def wait_for_server_termination(self, server_id, ignore_error=False):
- """Waits for server to reach termination."""
- start_time = int(time.time())
- while True:
- try:
- body = self.show_server(server_id)
- except lib_exc.NotFound:
- return
-
- server_status = body['status']
- if server_status == 'ERROR' and not ignore_error:
- raise exceptions.BuildErrorException(server_id=server_id)
-
- if int(time.time()) - start_time >= self.build_timeout:
- raise exceptions.TimeoutException
-
- time.sleep(self.build_interval)
-
def list_addresses(self, server_id):
"""Lists all addresses for a server."""
resp, body = self.get("servers/%s/ips" % server_id)
@@ -206,15 +165,7 @@
post_body)
if response_key is not None:
body = json.loads(body)
- # Check for Schema as 'None' because if we do not have any server
- # action schema implemented yet then they can pass 'None' to skip
- # the validation.Once all server action has their schema
- # implemented then, this check can be removed if every actions are
- # supposed to validate their response.
- # TODO(GMann): Remove the below 'if' check once all server actions
- # schema are implemented.
- if schema is not None:
- self.validate_response(schema, resp, body)
+ self.validate_response(schema, resp, body)
body = body[response_key]
else:
self.validate_response(schema, resp, body)
@@ -251,16 +202,19 @@
resp, body)
return service_client.ResponseBody(resp, body)
- def reboot(self, server_id, reboot_type):
+ def reboot_server(self, server_id, reboot_type):
"""Reboots a server."""
return self.action(server_id, 'reboot', None, type=reboot_type)
- def rebuild(self, server_id, image_ref, **kwargs):
- """Rebuilds a server with a new image."""
+ def rebuild_server(self, server_id, image_ref, **kwargs):
+ """Rebuilds a server with a new image.
+ 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['disk_config']
- del kwargs['disk_config']
+ kwargs['OS-DCF:diskConfig'] = kwargs.pop('disk_config')
if self.enable_instance_password:
rebuild_schema = schema.rebuild_server_with_admin_pass
else:
@@ -268,21 +222,24 @@
return self.action(server_id, 'rebuild', 'server',
rebuild_schema, **kwargs)
- def resize(self, server_id, flavor_ref, **kwargs):
- """Changes the flavor of a server."""
+ def resize_server(self, server_id, flavor_ref, **kwargs):
+ """Changes the flavor of a server.
+ Most parameters except the following are passed to the API without
+ any changes.
+ :param disk_config: The name is changed to OS-DCF:diskConfig
+ """
kwargs['flavorRef'] = flavor_ref
if 'disk_config' in kwargs:
- kwargs['OS-DCF:diskConfig'] = kwargs['disk_config']
- del kwargs['disk_config']
+ kwargs['OS-DCF:diskConfig'] = kwargs.pop('disk_config')
return self.action(server_id, 'resize', None, **kwargs)
- def confirm_resize(self, server_id, **kwargs):
+ def confirm_resize_server(self, server_id, **kwargs):
"""Confirms the flavor change for a server."""
return self.action(server_id, 'confirmResize',
None, schema.server_actions_confirm_resize,
**kwargs)
- def revert_resize(self, server_id, **kwargs):
+ def revert_resize_server(self, server_id, **kwargs):
"""Reverts a server back to its original flavor."""
return self.action(server_id, 'revertResize', None, **kwargs)
@@ -335,20 +292,15 @@
resp, body)
return service_client.ResponseBody(resp, body)
- def stop(self, server_id, **kwargs):
+ def stop_server(self, server_id, **kwargs):
return self.action(server_id, 'os-stop', None, **kwargs)
- def start(self, server_id, **kwargs):
+ def start_server(self, server_id, **kwargs):
return self.action(server_id, 'os-start', None, **kwargs)
- def attach_volume(self, server_id, volume_id, device='/dev/vdz'):
+ def attach_volume(self, server_id, **kwargs):
"""Attaches a volume to a server instance."""
- post_body = json.dumps({
- 'volumeAttachment': {
- 'volumeId': volume_id,
- 'device': device,
- }
- })
+ post_body = json.dumps({'volumeAttachment': kwargs})
resp, body = self.post('servers/%s/os-volume_attachments' % server_id,
post_body)
body = json.loads(body)
@@ -386,16 +338,10 @@
"""Removes a security group from the server."""
return self.action(server_id, 'removeSecurityGroup', None, name=name)
- def live_migrate_server(self, server_id, dest_host, use_block_migration):
+ def live_migrate_server(self, server_id, **kwargs):
"""This should be called with administrator privileges ."""
- migrate_params = {
- "disk_over_commit": False,
- "block_migration": use_block_migration,
- "host": dest_host
- }
-
- req_body = json.dumps({'os-migrateLive': migrate_params})
+ req_body = json.dumps({'os-migrateLive': kwargs})
resp, body = self.post("servers/%s/action" % server_id, req_body)
self.validate_response(schema.server_actions_common_schema,
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
index 699d3e7..232b301 100644
--- a/tempest/services/compute/json/services_client.py
+++ b/tempest/services/compute/json/services_client.py
@@ -31,7 +31,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_services, resp, body)
- return service_client.ResponseBodyList(resp, body['services'])
+ return service_client.ResponseBody(resp, body)
def enable_service(self, host_name, binary):
"""
@@ -43,7 +43,7 @@
resp, body = self.put('os-services/enable', post_body)
body = json.loads(body)
self.validate_response(schema.enable_service, resp, body)
- return service_client.ResponseBody(resp, body['service'])
+ return service_client.ResponseBody(resp, body)
def disable_service(self, host_name, binary):
"""
@@ -54,4 +54,4 @@
post_body = json.dumps({'binary': binary, 'host': host_name})
resp, body = self.put('os-services/disable', post_body)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['service'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/tenant_networks_client.py b/tempest/services/compute/json/tenant_networks_client.py
index d31c5f5..33166c0 100644
--- a/tempest/services/compute/json/tenant_networks_client.py
+++ b/tempest/services/compute/json/tenant_networks_client.py
@@ -24,10 +24,10 @@
resp, body = self.get("os-tenant-networks")
body = json.loads(body)
self.validate_response(schema.list_tenant_networks, resp, body)
- return service_client.ResponseBodyList(resp, body['networks'])
+ return service_client.ResponseBody(resp, body)
def show_tenant_network(self, network_id):
resp, body = self.get("os-tenant-networks/%s" % network_id)
body = json.loads(body)
self.validate_response(schema.get_tenant_network, resp, body)
- return service_client.ResponseBody(resp, body['network'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/tenant_usages_client.py b/tempest/services/compute/json/tenant_usages_client.py
index 72fcde2..73b4706 100644
--- a/tempest/services/compute/json/tenant_usages_client.py
+++ b/tempest/services/compute/json/tenant_usages_client.py
@@ -30,7 +30,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_tenant_usage, resp, body)
- return service_client.ResponseBodyList(resp, body['tenant_usages'][0])
+ return service_client.ResponseBody(resp, body)
def show_tenant_usage(self, tenant_id, **params):
url = 'os-simple-tenant-usage/%s' % tenant_id
@@ -40,4 +40,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_tenant_usage, resp, body)
- return service_client.ResponseBodyList(resp, body['tenant_usage'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/versions_client.py b/tempest/services/compute/json/versions_client.py
new file mode 100644
index 0000000..cbad02c
--- /dev/null
+++ b/tempest/services/compute/json/versions_client.py
@@ -0,0 +1,37 @@
+# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo_serialization import jsonutils as json
+from six.moves import urllib
+
+from tempest.api_schema.response.compute.v2_1 import versions as schema
+from tempest.common import service_client
+
+
+class VersionsClient(service_client.ServiceClient):
+
+ def list_versions(self):
+ # NOTE: The URL which is gotten from keystone's catalog contains
+ # API version and project-id like "v2/{project-id}", but we need
+ # to access the URL which doesn't contain them for getting API
+ # versions. For that, here should use raw_request() instead of
+ # get().
+ endpoint = self.base_url
+ url = urllib.parse.urlparse(endpoint)
+ version_url = '%s://%s/' % (url.scheme, url.netloc)
+
+ resp, body = self.raw_request(version_url, 'GET')
+ body = json.loads(body)
+ self.validate_response(schema.list_versions, resp, body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_extensions_client.py
index ac55049..c86aaff 100644
--- a/tempest/services/compute/json/volumes_extensions_client.py
+++ b/tempest/services/compute/json/volumes_extensions_client.py
@@ -23,12 +23,6 @@
class VolumesExtensionsClient(service_client.ServiceClient):
- def __init__(self, auth_provider, service, region,
- default_volume_size=1, **kwargs):
- super(VolumesExtensionsClient, self).__init__(
- auth_provider, service, region, **kwargs)
- self.default_volume_size = default_volume_size
-
def list_volumes(self, detail=False, **params):
"""List all the volumes created."""
url = 'os-volumes'
@@ -51,7 +45,7 @@
self.validate_response(schema.create_get_volume, resp, body)
return service_client.ResponseBody(resp, body['volume'])
- def create_volume(self, size=None, **kwargs):
+ def create_volume(self, **kwargs):
"""
Creates a new Volume.
size(Required): Size of volume in GB.
@@ -59,14 +53,7 @@
display_name: Optional Volume Name.
metadata: A dictionary of values to be used as metadata.
"""
- if size is None:
- size = self.default_volume_size
- post_body = {
- 'size': size
- }
- post_body.update(kwargs)
-
- post_body = json.dumps({'volume': post_body})
+ post_body = json.dumps({'volume': kwargs})
resp, body = self.post('os-volumes', post_body)
body = json.loads(body)
self.validate_response(schema.create_get_volume, resp, body)
diff --git a/tempest/services/data_processing/v1_1/data_processing_client.py b/tempest/services/data_processing/v1_1/data_processing_client.py
index bbc0f2a..cba4c42 100644
--- a/tempest/services/data_processing/v1_1/data_processing_client.py
+++ b/tempest/services/data_processing/v1_1/data_processing_client.py
@@ -39,8 +39,8 @@
self.expected_success(resp_status, resp.status)
return resp, body
- def _request_check_and_parse_resp(self, request_func, uri, resp_status,
- resource_name, *args, **kwargs):
+ def _request_check_and_parse_resp(self, request_func, uri,
+ resp_status, *args, **kwargs):
"""Make a request using specified request_func, check response status
code and parse response body.
@@ -50,36 +50,19 @@
resp, body = request_func(uri, headers=headers, *args, **kwargs)
self.expected_success(resp_status, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body[resource_name])
-
- def _request_check_and_parse_resp_list(self, request_func, uri,
- resp_status, resource_name,
- *args, **kwargs):
- """Make a request using specified request_func, check response status
- code and parse response body.
-
- It returns a ResponseBodyList.
- """
- headers = {'Content-Type': 'application/json'}
- resp, body = request_func(uri, headers=headers, *args, **kwargs)
- self.expected_success(resp_status, resp.status)
- body = json.loads(body)
- return service_client.ResponseBodyList(resp, body[resource_name])
+ return service_client.ResponseBody(resp, body)
def list_node_group_templates(self):
"""List all node group templates for a user."""
uri = 'node-group-templates'
- return self._request_check_and_parse_resp_list(self.get, uri,
- 200,
- 'node_group_templates')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_node_group_template(self, tmpl_id):
"""Returns the details of a single node group template."""
uri = 'node-group-templates/%s' % tmpl_id
- return self._request_check_and_parse_resp(self.get, uri,
- 200, 'node_group_template')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_node_group_template(self, name, plugin_name, hadoop_version,
node_processes, flavor_id,
@@ -100,7 +83,6 @@
'node_configs': node_configs or dict(),
})
return self._request_check_and_parse_resp(self.post, uri, 202,
- 'node_group_template',
body=json.dumps(body))
def delete_node_group_template(self, tmpl_id):
@@ -113,8 +95,7 @@
"""List all enabled plugins."""
uri = 'plugins'
- return self._request_check_and_parse_resp_list(self.get,
- uri, 200, 'plugins')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_plugin(self, plugin_name, plugin_version=None):
"""Returns the details of a single plugin."""
@@ -122,22 +103,19 @@
uri = 'plugins/%s' % plugin_name
if plugin_version:
uri += '/%s' % plugin_version
- return self._request_check_and_parse_resp(self.get, uri, 200, 'plugin')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def list_cluster_templates(self):
"""List all cluster templates for a user."""
uri = 'cluster-templates'
- return self._request_check_and_parse_resp_list(self.get, uri,
- 200,
- 'cluster_templates')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_cluster_template(self, tmpl_id):
"""Returns the details of a single cluster template."""
uri = 'cluster-templates/%s' % tmpl_id
- return self._request_check_and_parse_resp(self.get,
- uri, 200, 'cluster_template')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_cluster_template(self, name, plugin_name, hadoop_version,
node_groups, cluster_configs=None,
@@ -157,7 +135,6 @@
'cluster_configs': cluster_configs or dict(),
})
return self._request_check_and_parse_resp(self.post, uri, 202,
- 'cluster_template',
body=json.dumps(body))
def delete_cluster_template(self, tmpl_id):
@@ -170,16 +147,13 @@
"""List all data sources for a user."""
uri = 'data-sources'
- return self._request_check_and_parse_resp_list(self.get,
- uri, 200,
- 'data_sources')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_data_source(self, source_id):
"""Returns the details of a single data source."""
uri = 'data-sources/%s' % source_id
- return self._request_check_and_parse_resp(self.get,
- uri, 200, 'data_source')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_data_source(self, name, data_source_type, url, **kwargs):
"""Creates data source with specified params.
@@ -195,8 +169,7 @@
'url': url
})
return self._request_check_and_parse_resp(self.post, uri,
- 202, 'data_source',
- body=json.dumps(body))
+ 202, body=json.dumps(body))
def delete_data_source(self, source_id):
"""Deletes the specified data source by id."""
@@ -208,22 +181,19 @@
"""List all job binary internals for a user."""
uri = 'job-binary-internals'
- return self._request_check_and_parse_resp_list(self.get,
- uri, 200, 'binaries')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_job_binary_internal(self, job_binary_id):
"""Returns the details of a single job binary internal."""
uri = 'job-binary-internals/%s' % job_binary_id
- return self._request_check_and_parse_resp(self.get, uri,
- 200, 'job_binary_internal')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_job_binary_internal(self, name, data):
"""Creates job binary internal with specified params."""
uri = 'job-binary-internals/%s' % name
- return self._request_check_and_parse_resp(self.put, uri, 202,
- 'job_binary_internal', data)
+ return self._request_check_and_parse_resp(self.put, uri, 202, data)
def delete_job_binary_internal(self, job_binary_id):
"""Deletes the specified job binary internal by id."""
@@ -241,15 +211,13 @@
"""List all job binaries for a user."""
uri = 'job-binaries'
- return self._request_check_and_parse_resp_list(self.get,
- uri, 200, 'binaries')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_job_binary(self, job_binary_id):
"""Returns the details of a single job binary."""
uri = 'job-binaries/%s' % job_binary_id
- return self._request_check_and_parse_resp(self.get,
- uri, 200, 'job_binary')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_job_binary(self, name, url, extra=None, **kwargs):
"""Creates job binary with specified params.
@@ -265,8 +233,7 @@
'extra': extra or dict(),
})
return self._request_check_and_parse_resp(self.post, uri,
- 202, 'job_binary',
- body=json.dumps(body))
+ 202, body=json.dumps(body))
def delete_job_binary(self, job_binary_id):
"""Deletes the specified job binary by id."""
@@ -284,14 +251,13 @@
"""List all jobs for a user."""
uri = 'jobs'
- return self._request_check_and_parse_resp_list(self.get,
- uri, 200, 'jobs')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_job(self, job_id):
"""Returns the details of a single job."""
uri = 'jobs/%s' % job_id
- return self._request_check_and_parse_resp(self.get, uri, 200, 'job')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_job(self, name, job_type, mains, libs=None, **kwargs):
"""Creates job with specified params.
@@ -307,8 +273,8 @@
'mains': mains,
'libs': libs or list(),
})
- return self._request_check_and_parse_resp(self.post, uri, 202,
- 'job', body=json.dumps(body))
+ return self._request_check_and_parse_resp(self.post, uri,
+ 202, body=json.dumps(body))
def delete_job(self, job_id):
"""Deletes the specified job by id."""
diff --git a/tempest/services/database/json/limits_client.py b/tempest/services/database/json/limits_client.py
index 830b67f..da495d7 100644
--- a/tempest/services/database/json/limits_client.py
+++ b/tempest/services/database/json/limits_client.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.common import service_client
@@ -27,4 +28,5 @@
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, self._parse_resp(body))
+ body = json.loads(body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/database/json/versions_client.py b/tempest/services/database/json/versions_client.py
index ed1ba81..7a560d9 100644
--- a/tempest/services/database/json/versions_client.py
+++ b/tempest/services/database/json/versions_client.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.common import service_client
@@ -43,4 +44,5 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, self._parse_resp(body))
+ body = json.loads(body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v2/json/identity_client.py b/tempest/services/identity/v2/json/identity_client.py
index c9345e0..8eeefe7 100644
--- a/tempest/services/identity/v2/json/identity_client.py
+++ b/tempest/services/identity/v2/json/identity_client.py
@@ -56,7 +56,7 @@
resp, body = self.get('OS-KSADM/roles/%s' % role_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body)
def create_tenant(self, name, **kwargs):
"""
@@ -125,10 +125,10 @@
resp, body = self.get('tenants')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['tenants'])
+ return service_client.ResponseBody(resp, body)
def get_tenant_by_name(self, tenant_name):
- tenants = self.list_tenants()
+ tenants = self.list_tenants()['tenants']
for tenant in tenants:
if tenant['name'] == tenant_name:
return tenant
@@ -297,6 +297,17 @@
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, self._parse_resp(body))
+ def update_user_own_password(self, user_id, new_pass, old_pass):
+ """User updates own password"""
+ patch_body = {
+ "password": new_pass,
+ "original_password": old_pass
+ }
+ patch_body = json.dumps({'user': patch_body})
+ resp, body = self.patch('OS-KSCRUD/users/%s' % user_id, patch_body)
+ self.expected_success(200, resp.status)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
+
def list_extensions(self):
"""List all the extensions."""
resp, body = self.get('/extensions')
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
index e27f960..decf3a8 100644
--- a/tempest/services/identity/v3/json/credentials_client.py
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -36,11 +36,11 @@
self.expected_success(201, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return service_client.ResponseBody(resp, body['credential'])
+ return service_client.ResponseBody(resp, body)
def update_credential(self, credential_id, **kwargs):
"""Updates a credential."""
- body = self.get_credential(credential_id)
+ body = self.get_credential(credential_id)['credential']
cred_type = kwargs.get('type', body['type'])
access_key = kwargs.get('access_key', body['blob']['access'])
secret_key = kwargs.get('secret_key', body['blob']['secret'])
@@ -59,7 +59,7 @@
self.expected_success(200, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return service_client.ResponseBody(resp, body['credential'])
+ return service_client.ResponseBody(resp, body)
def get_credential(self, credential_id):
"""To GET Details of a credential."""
@@ -67,14 +67,14 @@
self.expected_success(200, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return service_client.ResponseBody(resp, body['credential'])
+ return service_client.ResponseBody(resp, body)
def list_credentials(self):
"""Lists out all the available credentials."""
resp, body = self.get('credentials')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['credentials'])
+ return service_client.ResponseBody(resp, body)
def delete_credential(self, credential_id):
"""Deletes a credential."""
diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py
index f93fb74..6bdf8b3 100644
--- a/tempest/services/identity/v3/json/endpoints_client.py
+++ b/tempest/services/identity/v3/json/endpoints_client.py
@@ -26,7 +26,7 @@
resp, body = self.get('endpoints')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['endpoints'])
+ return service_client.ResponseBody(resp, body)
def create_endpoint(self, service_id, interface, url, **kwargs):
"""Create endpoint.
@@ -51,7 +51,7 @@
resp, body = self.post('endpoints', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['endpoint'])
+ return service_client.ResponseBody(resp, body)
def update_endpoint(self, endpoint_id, service_id=None, interface=None,
url=None, region=None, enabled=None, **kwargs):
@@ -78,7 +78,7 @@
resp, body = self.patch('endpoints/%s' % endpoint_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['endpoint'])
+ return service_client.ResponseBody(resp, body)
def delete_endpoint(self, endpoint_id):
"""Delete endpoint."""
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 87d4b79..3f27624 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -27,7 +27,8 @@
url = ''
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, self._parse_resp(body))
+ body = json.loads(body)
+ return service_client.ResponseBody(resp, body)
def create_user(self, user_name, password=None, project_id=None,
email=None, domain_id='default', **kwargs):
@@ -49,11 +50,11 @@
resp, body = self.post('users', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['user'])
+ return service_client.ResponseBody(resp, body)
def update_user(self, user_id, name, **kwargs):
"""Updates a user."""
- body = self.get_user(user_id)
+ body = self.get_user(user_id)['user']
email = kwargs.get('email', body['email'])
en = kwargs.get('enabled', body['enabled'])
project_id = kwargs.get('project_id', body['project_id'])
@@ -78,7 +79,7 @@
resp, body = self.patch('users/%s' % user_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['user'])
+ return service_client.ResponseBody(resp, body)
def update_user_password(self, user_id, password, original_password):
"""Updates a user password."""
@@ -96,7 +97,7 @@
resp, body = self.get('users/%s/projects' % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['projects'])
+ return service_client.ResponseBody(resp, body)
def get_users(self, params=None):
"""Get the list of users."""
@@ -106,14 +107,14 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['users'])
+ return service_client.ResponseBody(resp, body)
def get_user(self, user_id):
"""GET a user."""
resp, body = self.get("users/%s" % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['user'])
+ return service_client.ResponseBody(resp, body)
def delete_user(self, user_id):
"""Deletes a User."""
@@ -136,7 +137,7 @@
resp, body = self.post('projects', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['project'])
+ return service_client.ResponseBody(resp, body)
def list_projects(self, params=None):
url = "projects"
@@ -145,10 +146,10 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['projects'])
+ return service_client.ResponseBody(resp, body)
def update_project(self, project_id, **kwargs):
- body = self.get_project(project_id)
+ body = self.get_project(project_id)['project']
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
@@ -164,14 +165,14 @@
resp, body = self.patch('projects/%s' % project_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['project'])
+ return service_client.ResponseBody(resp, body)
def get_project(self, project_id):
"""GET a Project."""
resp, body = self.get("projects/%s" % project_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['project'])
+ return service_client.ResponseBody(resp, body)
def delete_project(self, project_id):
"""Delete a project."""
@@ -188,21 +189,21 @@
resp, body = self.post('roles', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body)
def get_role(self, role_id):
"""GET a Role."""
resp, body = self.get('roles/%s' % str(role_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body)
def list_roles(self):
"""Get the list of Roles."""
resp, body = self.get("roles")
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def update_role(self, name, role_id):
"""Create a Role."""
@@ -213,7 +214,7 @@
resp, body = self.patch('roles/%s' % str(role_id), post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body)
def delete_role(self, role_id):
"""Delete a role."""
@@ -241,7 +242,7 @@
resp, body = self.post('domains', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['domain'])
+ return service_client.ResponseBody(resp, body)
def delete_domain(self, domain_id):
"""Delete a domain."""
@@ -257,11 +258,11 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['domains'])
+ return service_client.ResponseBody(resp, body)
def update_domain(self, domain_id, **kwargs):
"""Updates a domain."""
- body = self.get_domain(domain_id)
+ body = self.get_domain(domain_id)['domain']
description = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
name = kwargs.get('name', body['name'])
@@ -274,14 +275,14 @@
resp, body = self.patch('domains/%s' % domain_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['domain'])
+ return service_client.ResponseBody(resp, body)
def get_domain(self, domain_id):
"""Get Domain details."""
resp, body = self.get('domains/%s' % domain_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['domain'])
+ return service_client.ResponseBody(resp, body)
def get_token(self, resp_token):
"""Get token details."""
@@ -289,7 +290,7 @@
resp, body = self.get("auth/tokens", headers=headers)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['token'])
+ return service_client.ResponseBody(resp, body)
def delete_token(self, resp_token):
"""Deletes token."""
@@ -313,25 +314,25 @@
resp, body = self.post('groups', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['group'])
+ return service_client.ResponseBody(resp, body)
def get_group(self, group_id):
"""Get group details."""
resp, body = self.get('groups/%s' % group_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['group'])
+ return service_client.ResponseBody(resp, body)
def list_groups(self):
"""Lists the groups."""
resp, body = self.get('groups')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['groups'])
+ return service_client.ResponseBody(resp, body)
def update_group(self, group_id, **kwargs):
"""Updates a group."""
- body = self.get_group(group_id)
+ body = self.get_group(group_id)['group']
name = kwargs.get('name', body['name'])
description = kwargs.get('description', body['description'])
post_body = {
@@ -342,7 +343,7 @@
resp, body = self.patch('groups/%s' % group_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['group'])
+ return service_client.ResponseBody(resp, body)
def delete_group(self, group_id):
"""Delete a group."""
@@ -362,14 +363,14 @@
resp, body = self.get('groups/%s/users' % group_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['users'])
+ return service_client.ResponseBody(resp, body)
def list_user_groups(self, user_id):
"""Lists groups which a user belongs to."""
resp, body = self.get('users/%s/groups' % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['groups'])
+ return service_client.ResponseBody(resp, body)
def delete_group_user(self, group_id, user_id):
"""Delete user in group."""
@@ -397,7 +398,7 @@
(project_id, user_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def list_user_roles_on_domain(self, domain_id, user_id):
"""list roles of a user on a domain."""
@@ -405,7 +406,7 @@
(domain_id, user_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def revoke_role_from_user_on_project(self, project_id, user_id, role_id):
"""Delete role of a user on a project."""
@@ -441,7 +442,7 @@
(project_id, group_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def list_group_roles_on_domain(self, domain_id, group_id):
"""list roles of a user on a domain."""
@@ -449,7 +450,7 @@
(domain_id, group_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def revoke_role_from_group_on_project(self, project_id, group_id, role_id):
"""Delete role of a user on a project."""
@@ -481,7 +482,7 @@
resp, body = self.post('OS-TRUST/trusts', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['trust'])
+ return service_client.ResponseBody(resp, body)
def delete_trust(self, trust_id):
"""Deletes a trust."""
@@ -501,21 +502,21 @@
resp, body = self.get("OS-TRUST/trusts")
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['trusts'])
+ return service_client.ResponseBody(resp, body)
def get_trust(self, trust_id):
"""GET trust."""
resp, body = self.get("OS-TRUST/trusts/%s" % trust_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['trust'])
+ return service_client.ResponseBody(resp, body)
def get_trust_roles(self, trust_id):
"""GET roles delegated by a trust."""
resp, body = self.get("OS-TRUST/trusts/%s/roles" % trust_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def get_trust_role(self, trust_id, role_id):
"""GET role delegated by a trust."""
@@ -523,7 +524,7 @@
% (trust_id, role_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body)
def check_trust_role(self, trust_id, role_id):
"""HEAD Check if role is delegated by a trust."""
diff --git a/tempest/services/identity/v3/json/policy_client.py b/tempest/services/identity/v3/json/policy_client.py
index f820598..3231bb0 100644
--- a/tempest/services/identity/v3/json/policy_client.py
+++ b/tempest/services/identity/v3/json/policy_client.py
@@ -31,14 +31,14 @@
resp, body = self.post('policies', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['policy'])
+ return service_client.ResponseBody(resp, body)
def list_policies(self):
"""Lists the policies."""
resp, body = self.get('policies')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['policies'])
+ return service_client.ResponseBody(resp, body)
def get_policy(self, policy_id):
"""Lists out the given policy."""
@@ -46,7 +46,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['policy'])
+ return service_client.ResponseBody(resp, body)
def update_policy(self, policy_id, **kwargs):
"""Updates a policy."""
@@ -59,7 +59,7 @@
resp, body = self.patch(url, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['policy'])
+ return service_client.ResponseBody(resp, body)
def delete_policy(self, policy_id):
"""Deletes the policy."""
diff --git a/tempest/services/identity/v3/json/region_client.py b/tempest/services/identity/v3/json/region_client.py
index 43226be..24c6f33 100644
--- a/tempest/services/identity/v3/json/region_client.py
+++ b/tempest/services/identity/v3/json/region_client.py
@@ -37,7 +37,7 @@
resp, body = self.post('regions', req_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['region'])
+ return service_client.ResponseBody(resp, body)
def update_region(self, region_id, **kwargs):
"""Updates a region."""
@@ -50,7 +50,7 @@
resp, body = self.patch('regions/%s' % region_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['region'])
+ return service_client.ResponseBody(resp, body)
def get_region(self, region_id):
"""Get region."""
@@ -58,7 +58,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['region'])
+ return service_client.ResponseBody(resp, body)
def list_regions(self, params=None):
"""List regions."""
@@ -68,7 +68,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['regions'])
+ return service_client.ResponseBody(resp, body)
def delete_region(self, region_id):
"""Delete region."""
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index 52ff479..2acc3a8 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -23,7 +23,7 @@
def update_service(self, service_id, **kwargs):
"""Updates a service."""
- body = self.get_service(service_id)
+ body = self.get_service(service_id)['service']
name = kwargs.get('name', body['name'])
type = kwargs.get('type', body['type'])
desc = kwargs.get('description', body['description'])
@@ -36,7 +36,7 @@
resp, body = self.patch('services/%s' % service_id, patch_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['service'])
+ return service_client.ResponseBody(resp, body)
def get_service(self, service_id):
"""Get Service."""
@@ -44,7 +44,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['service'])
+ return service_client.ResponseBody(resp, body)
def create_service(self, serv_type, name=None, description=None,
enabled=True):
@@ -58,7 +58,7 @@
resp, body = self.post("services", body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body["service"])
+ return service_client.ResponseBody(resp, body)
def delete_service(self, serv_id):
url = "services/" + serv_id
@@ -70,4 +70,4 @@
resp, body = self.get('services')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['services'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index a07612a..d97da36 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -130,7 +130,7 @@
self._error_checker('POST', '/v1/images', headers, data, resp,
body_iter)
body = json.loads(''.join([c for c in body_iter]))
- return service_client.ResponseBody(resp, body['image'])
+ return service_client.ResponseBody(resp, body)
def _update_with_data(self, image_id, headers, data):
url = '/v1/images/%s' % image_id
@@ -139,7 +139,7 @@
self._error_checker('PUT', url, headers, data,
resp, body_iter)
body = json.loads(''.join([c for c in body_iter]))
- return service_client.ResponseBody(resp, body['image'])
+ return service_client.ResponseBody(resp, body)
@property
def http(self):
@@ -169,7 +169,7 @@
resp, body = self.post('v1/images', None, headers)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['image'])
+ return service_client.ResponseBody(resp, body)
def update_image(self, image_id, name=None, container_format=None,
data=None, properties=None):
@@ -193,7 +193,7 @@
resp, body = self.put(url, data, headers)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['image'])
+ return service_client.ResponseBody(resp, body)
def delete_image(self, image_id):
url = 'v1/images/%s' % image_id
@@ -223,7 +223,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['images'])
+ return service_client.ResponseBody(resp, body)
def get_image_meta(self, image_id):
url = 'v1/images/%s' % image_id
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index 67f7708..6cad746 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -71,7 +71,8 @@
"-json-patch"}
resp, body = self.patch('v2/images/%s' % image_id, data, headers)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, self._parse_resp(body))
+ body = json.loads(body)
+ return service_client.ResponseBody(resp, body)
def create_image(self, name, container_format, disk_format, **kwargs):
params = {
@@ -123,7 +124,7 @@
self.expected_success(200, resp.status)
body = json.loads(body)
self._validate_schema(body, type='images')
- return service_client.ResponseBodyList(resp, body['images'])
+ return service_client.ResponseBody(resp, body)
def show_image(self, image_id):
url = 'v2/images/%s' % image_id
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index b31fe1b..e8ee20b 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -119,24 +119,6 @@
params={'limit': limit, 'format': 'json'})
self.expected_success(200, resp.status)
return objlist
- """tmp = []
- for obj in objlist:
- tmp.append(obj['name'])
- objlist = tmp
-
- if len(objlist) >= limit:
-
- # Increment marker
- marker = objlist[len(objlist) - 1]
-
- # Get the next chunk of the list
- objlist.extend(_list_all_container_objects(container,
- params={'marker': marker,
- 'limit': limit}))
- return objlist
- else:
- # Return final, complete list
- return objlist"""
def list_container_contents(self, container, params=None):
"""
diff --git a/tempest/services/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py
index 84a9ed9..22e53f5 100644
--- a/tempest/services/orchestration/json/orchestration_client.py
+++ b/tempest/services/orchestration/json/orchestration_client.py
@@ -36,7 +36,7 @@
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['stacks'])
+ return service_client.ResponseBody(resp, body)
def create_stack(self, name, disable_rollback=True, parameters=None,
timeout_mins=60, template=None, template_url=None,
@@ -111,7 +111,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['stack'])
+ return service_client.ResponseBody(resp, body)
def suspend_stack(self, stack_identifier):
"""Suspend a stack."""
@@ -135,7 +135,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['resources'])
+ return service_client.ResponseBody(resp, body)
def show_resource(self, stack_identifier, resource_name):
"""Returns the details of a single resource."""
@@ -143,7 +143,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['resource'])
+ return service_client.ResponseBody(resp, body)
def delete_stack(self, stack_identifier):
"""Deletes the specified Stack."""
@@ -160,7 +160,7 @@
while True:
try:
body = self.show_resource(
- stack_identifier, resource_name)
+ stack_identifier, resource_name)['resource']
except lib_exc.NotFound:
# ignore this, as the resource may not have
# been created yet
@@ -195,7 +195,7 @@
while True:
try:
- body = self.show_stack(stack_identifier)
+ body = self.show_stack(stack_identifier)['stack']
except lib_exc.NotFound:
if status == 'DELETE_COMPLETE':
return
@@ -224,7 +224,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def list_events(self, stack_identifier):
"""Returns list of all events for a stack."""
@@ -232,7 +232,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['events'])
+ return service_client.ResponseBody(resp, body)
def list_resource_events(self, stack_identifier, resource_name):
"""Returns list of all events for a resource from stack."""
@@ -241,7 +241,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['events'])
+ return service_client.ResponseBody(resp, body)
def show_event(self, stack_identifier, resource_name, event_id):
"""Returns the details of a single stack's event."""
@@ -250,7 +250,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['event'])
+ return service_client.ResponseBody(resp, body)
def show_template(self, stack_identifier):
"""Returns the template for the stack."""
@@ -293,7 +293,7 @@
resp, body = self.get('resource_types')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['resource_types'])
+ return service_client.ResponseBody(resp, body)
def show_resource_type(self, resource_type_name):
"""Return the schema of a resource type."""
diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/json/admin/volume_hosts_client.py
index 6801453..ab9cd5a 100644
--- a/tempest/services/volume/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/json/admin/volume_hosts_client.py
@@ -34,7 +34,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['hosts'])
+ return service_client.ResponseBody(resp, body)
class VolumeHostsClient(BaseVolumeHostsClient):
diff --git a/tempest/services/volume/json/admin/volume_quotas_client.py b/tempest/services/volume/json/admin/volume_quotas_client.py
index a979523..207554d 100644
--- a/tempest/services/volume/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/json/admin/volume_quotas_client.py
@@ -31,7 +31,8 @@
url = 'os-quota-sets/%s/defaults' % tenant_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, self._parse_resp(body))
+ body = jsonutils.loads(body)
+ return service_client.ResponseBody(resp, body)
def show_quota_set(self, tenant_id, params=None):
"""List the quota set for a tenant."""
@@ -42,7 +43,8 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, self._parse_resp(body))
+ body = jsonutils.loads(body)
+ return service_client.ResponseBody(resp, body)
def show_quota_usage(self, tenant_id):
"""List the quota set for a tenant."""
@@ -66,7 +68,8 @@
post_body = jsonutils.dumps({'quota_set': post_body})
resp, body = self.put('os-quota-sets/%s' % tenant_id, post_body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, self._parse_resp(body))
+ body = jsonutils.loads(body)
+ return service_client.ResponseBody(resp, body)
def delete_quota_set(self, tenant_id):
"""Delete the tenant's quota set."""
diff --git a/tempest/services/volume/json/admin/volume_services_client.py b/tempest/services/volume/json/admin/volume_services_client.py
index c8607c1..798a642 100644
--- a/tempest/services/volume/json/admin/volume_services_client.py
+++ b/tempest/services/volume/json/admin/volume_services_client.py
@@ -29,7 +29,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['services'])
+ return service_client.ResponseBody(resp, body)
class VolumesServicesClient(BaseVolumesServicesClient):
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
index 84c7bc5..cd61859 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -58,7 +58,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['volume_types'])
+ return service_client.ResponseBody(resp, body)
def show_volume_type(self, volume_id):
"""Returns the details of a single volume_type."""
@@ -66,7 +66,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['volume_type'])
+ return service_client.ResponseBody(resp, body)
def create_volume_type(self, name, **kwargs):
"""
@@ -84,7 +84,7 @@
resp, body = self.post('types', post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['volume_type'])
+ return service_client.ResponseBody(resp, body)
def delete_volume_type(self, volume_id):
"""Deletes the Specified Volume_type."""
@@ -101,7 +101,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['extra_specs'])
+ return service_client.ResponseBody(resp, body)
def show_volume_type_extra_specs(self, vol_type_id, extra_spec_name):
"""Returns the details of a single volume_type extra spec."""
@@ -123,7 +123,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['extra_specs'])
+ return service_client.ResponseBody(resp, body)
def delete_volume_type_extra_specs(self, vol_id, extra_spec_name):
"""Deletes the Specified Volume_type extra spec."""
@@ -177,7 +177,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['encryption'])
+ return service_client.ResponseBody(resp, body)
def delete_encryption_type(self, vol_type_id):
"""Delete the encryption type for the specified volume-type."""
diff --git a/tempest/services/volume/json/availability_zone_client.py b/tempest/services/volume/json/availability_zone_client.py
index 13d5d55..4d24ede 100644
--- a/tempest/services/volume/json/availability_zone_client.py
+++ b/tempest/services/volume/json/availability_zone_client.py
@@ -24,7 +24,7 @@
resp, body = self.get('os-availability-zone')
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['availabilityZoneInfo'])
+ return service_client.ResponseBody(resp, body)
class VolumeAvailabilityZoneClient(BaseVolumeAvailabilityZoneClient):
diff --git a/tempest/services/volume/json/backups_client.py b/tempest/services/volume/json/backups_client.py
index 8d34230..6827c93 100644
--- a/tempest/services/volume/json/backups_client.py
+++ b/tempest/services/volume/json/backups_client.py
@@ -42,7 +42,7 @@
resp, body = self.post('backups', post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return service_client.ResponseBody(resp, body['backup'])
+ return service_client.ResponseBody(resp, body)
def restore_backup(self, backup_id, volume_id=None):
"""Restore volume from backup."""
@@ -51,7 +51,7 @@
resp, body = self.post('backups/%s/restore' % (backup_id), post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return service_client.ResponseBody(resp, body['restore'])
+ return service_client.ResponseBody(resp, body)
def delete_backup(self, backup_id):
"""Delete a backup of volume."""
@@ -65,7 +65,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['backup'])
+ return service_client.ResponseBody(resp, body)
def list_backups(self, detail=False):
"""Information for all the tenant's backups."""
@@ -75,7 +75,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['backups'])
+ return service_client.ResponseBody(resp, body)
def export_backup(self, backup_id):
"""Export backup metadata record."""
@@ -83,7 +83,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['backup-record'])
+ return service_client.ResponseBody(resp, body)
def import_backup(self, backup_service, backup_url):
"""Import backup metadata record."""
@@ -93,17 +93,17 @@
resp, body = self.post("backups/import_record", post_body)
body = json.loads(body)
self.expected_success(201, resp.status)
- return service_client.ResponseBody(resp, body['backup'])
+ return service_client.ResponseBody(resp, body)
def wait_for_backup_status(self, backup_id, status):
"""Waits for a Backup to reach a given status."""
- body = self.show_backup(backup_id)
+ body = self.show_backup(backup_id)['backup']
backup_status = body['status']
start = int(time.time())
while backup_status != status:
time.sleep(self.build_interval)
- body = self.show_backup(backup_id)
+ body = self.show_backup(backup_id)['backup']
backup_status = body['status']
if backup_status == 'error':
raise exceptions.VolumeBackupException(backup_id=backup_id)
diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/json/extensions_client.py
index 1098e1e..5744d4a 100644
--- a/tempest/services/volume/json/extensions_client.py
+++ b/tempest/services/volume/json/extensions_client.py
@@ -25,7 +25,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['extensions'])
+ return service_client.ResponseBody(resp, body)
class ExtensionsClient(BaseExtensionsClient):
diff --git a/tempest/services/volume/json/qos_client.py b/tempest/services/volume/json/qos_client.py
index e3d6a29..c79168c 100644
--- a/tempest/services/volume/json/qos_client.py
+++ b/tempest/services/volume/json/qos_client.py
@@ -48,15 +48,15 @@
start_time = int(time.time())
while True:
if operation == 'qos-key-unset':
- body = self.show_qos(qos_id)
+ body = self.show_qos(qos_id)['qos_specs']
if not any(key in body['specs'] for key in args):
return
elif operation == 'disassociate':
- body = self.show_association_qos(qos_id)
+ body = self.show_association_qos(qos_id)['qos_associations']
if not any(args in body[i]['id'] for i in range(0, len(body))):
return
elif operation == 'disassociate-all':
- body = self.show_association_qos(qos_id)
+ body = self.show_association_qos(qos_id)['qos_associations']
if not body:
return
else:
@@ -79,7 +79,7 @@
resp, body = self.post('qos-specs', post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['qos_specs'])
+ return service_client.ResponseBody(resp, body)
def delete_qos(self, qos_id, force=False):
"""Delete the specified QoS specification."""
@@ -94,7 +94,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['qos_specs'])
+ return service_client.ResponseBody(resp, body)
def show_qos(self, qos_id):
"""Get the specified QoS specification."""
@@ -102,7 +102,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['qos_specs'])
+ return service_client.ResponseBody(resp, body)
def set_qos_key(self, qos_id, **kwargs):
"""Set the specified keys/values of QoS specification.
@@ -113,7 +113,7 @@
resp, body = self.put('qos-specs/%s' % qos_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['qos_specs'])
+ return service_client.ResponseBody(resp, body)
def unset_qos_key(self, qos_id, keys):
"""Unset the specified keys of QoS specification.
@@ -139,7 +139,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['qos_associations'])
+ return service_client.ResponseBody(resp, body)
def disassociate_qos(self, qos_id, vol_type_id):
"""Disassociate the specified QoS with specified volume-type."""
diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/json/snapshots_client.py
index fa1f9dd..3fcf18c 100644
--- a/tempest/services/volume/json/snapshots_client.py
+++ b/tempest/services/volume/json/snapshots_client.py
@@ -40,7 +40,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['snapshots'])
+ return service_client.ResponseBody(resp, body)
def show_snapshot(self, snapshot_id):
"""Returns the details of a single snapshot."""
@@ -48,7 +48,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['snapshot'])
+ return service_client.ResponseBody(resp, body)
def create_snapshot(self, volume_id, **kwargs):
"""
@@ -64,7 +64,7 @@
resp, body = self.post('snapshots', post_body)
body = json.loads(body)
self.expected_success(self.create_resp, resp.status)
- return service_client.ResponseBody(resp, body['snapshot'])
+ return service_client.ResponseBody(resp, body)
def update_snapshot(self, snapshot_id, **kwargs):
"""Updates a snapshot."""
@@ -72,11 +72,11 @@
resp, body = self.put('snapshots/%s' % snapshot_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['snapshot'])
+ return service_client.ResponseBody(resp, body)
# NOTE(afazekas): just for the wait function
def _get_snapshot_status(self, snapshot_id):
- body = self.show_snapshot(snapshot_id)
+ body = self.show_snapshot(snapshot_id)['snapshot']
status = body['status']
# NOTE(afazekas): snapshot can reach an "error"
# state in a "normal" lifecycle
@@ -155,7 +155,7 @@
resp, body = self.post(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def show_snapshot_metadata(self, snapshot_id):
"""Get metadata of the snapshot."""
@@ -163,7 +163,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def update_snapshot_metadata(self, snapshot_id, metadata):
"""Update metadata for the snapshot."""
@@ -172,7 +172,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def update_snapshot_metadata_item(self, snapshot_id, id, meta_item):
"""Update metadata item for the snapshot."""
@@ -181,7 +181,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['meta'])
+ return service_client.ResponseBody(resp, body)
def delete_snapshot_metadata_item(self, snapshot_id, id):
"""Delete metadata item for the snapshot."""
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index 26f186e..9304f63 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -39,30 +39,6 @@
"""Return the element 'attachment' from input volumes."""
return volume['attachments'][0]
- def _ext_get(self, url, key=None, status=200):
- """Extended get method.
-
- Retrieves requested url, checks that status is expected status and
- return a ResponseBody, ResponseBodyList or ResponseBodyData depending
- on received data's key entry.
-
- If key is not specified or is None we will return the whole body in a
- ResponseBody class.
- """
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(status, resp.status)
-
- if not key:
- return service_client.ResponseBody(resp, body)
- elif isinstance(body[key], dict):
- return service_client.ResponseBody(resp, body[key])
- elif isinstance(body[key], list):
- return service_client.ResponseBodyList(resp, body[key])
-
- return service_client.ResponseBodyData(resp, body[key])
-
def _prepare_params(self, params):
"""Prepares params for use in get or _ext_get methods.
@@ -73,14 +49,10 @@
return params
return urllib.urlencode(params)
- def list_volumes(self, detail=False, params=None, return_body=False):
+ def list_volumes(self, detail=False, params=None):
"""List all the volumes created.
Params can be a string (must be urlencoded) or a dictionary.
- If return_body is True then we will return the whole response body in
- a ResponseBody class, it it's False or has not been specified we will
- return only the list of volumes in a ResponseBodyList (inherits from
- list).
"""
url = 'volumes'
if detail:
@@ -88,8 +60,10 @@
if params:
url += '?%s' % self._prepare_params(params)
- key = None if return_body else 'volumes'
- return self._ext_get(url, key)
+ resp, body = self.get(url)
+ body = json.loads(body)
+ self.expected_success(200, resp.status)
+ return service_client.ResponseBody(resp, body)
def show_volume(self, volume_id):
"""Returns the details of a single volume."""
@@ -97,7 +71,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['volume'])
+ return service_client.ResponseBody(resp, body)
def create_volume(self, size=None, **kwargs):
"""
@@ -119,7 +93,7 @@
resp, body = self.post('volumes', post_body)
body = json.loads(body)
self.expected_success(self.create_resp, resp.status)
- return service_client.ResponseBody(resp, body['volume'])
+ return service_client.ResponseBody(resp, body)
def update_volume(self, volume_id, **kwargs):
"""Updates the Specified Volume."""
@@ -127,7 +101,7 @@
resp, body = self.put('volumes/%s' % volume_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['volume'])
+ return service_client.ResponseBody(resp, body)
def delete_volume(self, volume_id):
"""Deletes the Specified Volume."""
@@ -146,8 +120,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return service_client.ResponseBody(resp,
- body['os-volume_upload_image'])
+ return service_client.ResponseBody(resp, body)
def attach_volume(self, volume_id, instance_uuid, mountpoint):
"""Attaches a volume to a given instance on a given mountpoint."""
@@ -258,7 +231,7 @@
resp, body = self.post('os-volume-transfer', post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return service_client.ResponseBody(resp, body['transfer'])
+ return service_client.ResponseBody(resp, body)
def show_volume_transfer(self, transfer_id):
"""Returns the details of a volume transfer."""
@@ -266,7 +239,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['transfer'])
+ return service_client.ResponseBody(resp, body)
def list_volume_transfers(self, params=None):
"""List all the volume transfers created."""
@@ -276,7 +249,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['transfers'])
+ return service_client.ResponseBody(resp, body)
def delete_volume_transfer(self, transfer_id):
"""Delete a volume transfer."""
@@ -294,7 +267,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return service_client.ResponseBody(resp, body['transfer'])
+ return service_client.ResponseBody(resp, body)
def update_volume_readonly(self, volume_id, readonly):
"""Update the Specified Volume readonly."""
@@ -321,7 +294,7 @@
resp, body = self.post(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def show_volume_metadata(self, volume_id):
"""Get metadata of the volume."""
@@ -329,7 +302,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def update_volume_metadata(self, volume_id, metadata):
"""Update metadata for the volume."""
@@ -338,7 +311,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def update_volume_metadata_item(self, volume_id, id, meta_item):
"""Update metadata item for the volume."""
@@ -347,7 +320,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['meta'])
+ return service_client.ResponseBody(resp, body)
def delete_volume_metadata_item(self, volume_id, id):
"""Delete metadata item for the volume."""
diff --git a/tempest/stress/actions/server_create_destroy.py b/tempest/stress/actions/server_create_destroy.py
index 9f41526..17f4bc9 100644
--- a/tempest/stress/actions/server_create_destroy.py
+++ b/tempest/stress/actions/server_create_destroy.py
@@ -37,5 +37,6 @@
self.logger.info("created %s" % server_id)
self.logger.info("deleting %s" % name)
self.manager.servers_client.delete_server(server_id)
- self.manager.servers_client.wait_for_server_termination(server_id)
+ waiters.wait_for_server_termination(self.manager.servers_client,
+ server_id)
self.logger.info("deleted %s" % server_id)
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index 09e6d88..2505a77 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -86,7 +86,8 @@
def _destroy_vm(self):
self.logger.info("deleting %s" % self.server_id)
self.manager.servers_client.delete_server(self.server_id)
- self.manager.servers_client.wait_for_server_termination(self.server_id)
+ waiters.wait_for_server_termination(self.manager.servers_client,
+ self.server_id)
self.logger.info("deleted %s" % self.server_id)
def _create_sec_group(self):
@@ -94,7 +95,7 @@
s_name = data_utils.rand_name('sec_grp')
s_description = data_utils.rand_name('desc')
self.sec_grp = sec_grp_cli.create_security_group(
- name=s_name, description=s_description)
+ name=s_name, description=s_description)['security_group']
create_rule = sec_grp_cli.create_security_group_rule
create_rule(parent_group_id=self.sec_grp['id'], ip_protocol='tcp',
from_port=22, to_port=22)
@@ -107,7 +108,8 @@
def _create_floating_ip(self):
floating_cli = self.manager.floating_ips_client
- self.floating = floating_cli.create_floating_ip(self.floating_pool)
+ self.floating = (floating_cli.create_floating_ip(self.floating_pool)
+ ['floating_ip'])
def _destroy_floating_ip(self):
cli = self.manager.floating_ips_client
@@ -147,7 +149,8 @@
cli = self.manager.floating_ips_client
def func():
- floating = cli.show_floating_ip(self.floating['id'])
+ floating = (cli.show_floating_ip(self.floating['id'])
+ ['floating_ip'])
return floating['instance_id'] is None
if not tempest.test.call_until_true(func, self.check_timeout,
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
index d6965c7..b35f587 100644
--- a/tempest/stress/actions/volume_attach_delete.py
+++ b/tempest/stress/actions/volume_attach_delete.py
@@ -30,7 +30,7 @@
name = data_utils.rand_name("volume")
self.logger.info("creating volume: %s" % name)
volume = self.manager.volumes_client.create_volume(
- display_name=name)
+ display_name=name)['volume']
self.manager.volumes_client.wait_for_volume_status(volume['id'],
'available')
self.logger.info("created volume: %s" % volume['id'])
@@ -49,8 +49,8 @@
self.logger.info("attach volume (%s) to vm %s" %
(volume['id'], server_id))
self.manager.servers_client.attach_volume(server_id,
- volume['id'],
- '/dev/vdc')
+ volumeId=volume['id'],
+ device='/dev/vdc')
self.manager.volumes_client.wait_for_volume_status(volume['id'],
'in-use')
self.logger.info("volume (%s) attached to vm %s" %
@@ -59,7 +59,8 @@
# Step 4: delete vm
self.logger.info("deleting vm: %s" % vm_name)
self.manager.servers_client.delete_server(server_id)
- self.manager.servers_client.wait_for_server_termination(server_id)
+ waiters.wait_for_server_termination(self.manager.servers_client,
+ server_id)
self.logger.info("deleted vm: %s" % server_id)
# Step 5: delete volume
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index 0e0141f..fe481c4 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -26,7 +26,8 @@
def _create_keypair(self):
keyname = data_utils.rand_name("key")
- self.key = self.manager.keypairs_client.create_keypair(name=keyname)
+ self.key = (self.manager.keypairs_client.create_keypair(name=keyname)
+ ['keypair'])
def _delete_keypair(self):
self.manager.keypairs_client.delete_keypair(self.key['name'])
@@ -48,7 +49,8 @@
def _destroy_vm(self):
self.logger.info("deleting server: %s" % self.server_id)
self.manager.servers_client.delete_server(self.server_id)
- self.manager.servers_client.wait_for_server_termination(self.server_id)
+ waiters.wait_for_server_termination(self.manager.servers_client,
+ self.server_id)
self.logger.info("deleted server: %s" % self.server_id)
def _create_sec_group(self):
@@ -56,7 +58,7 @@
s_name = data_utils.rand_name('sec_grp')
s_description = data_utils.rand_name('desc')
self.sec_grp = sec_grp_cli.create_security_group(
- name=s_name, description=s_description)
+ name=s_name, description=s_description)['security_group']
create_rule = sec_grp_cli.create_security_group_rule
create_rule(parent_group_id=self.sec_grp['id'], ip_protocol='tcp',
from_port=22, to_port=22)
@@ -69,7 +71,8 @@
def _create_floating_ip(self):
floating_cli = self.manager.floating_ips_client
- self.floating = floating_cli.create_floating_ip(self.floating_pool)
+ self.floating = (floating_cli.create_floating_ip(self.floating_pool)
+ ['floating_ip'])
def _destroy_floating_ip(self):
cli = self.manager.floating_ips_client
@@ -82,7 +85,7 @@
self.logger.info("creating volume: %s" % name)
volumes_client = self.manager.volumes_client
self.volume = volumes_client.create_volume(
- display_name=name)
+ display_name=name)['volume']
volumes_client.wait_for_volume_status(self.volume['id'],
'available')
self.logger.info("created volume: %s" % self.volume['id'])
@@ -98,7 +101,8 @@
cli = self.manager.floating_ips_client
def func():
- floating = cli.show_floating_ip(self.floating['id'])
+ floating = (cli.show_floating_ip(self.floating['id'])
+ ['floating_ip'])
return floating['instance_id'] is None
if not tempest.test.call_until_true(func, CONF.compute.build_timeout,
@@ -165,7 +169,7 @@
if not self.new_server:
self.new_server_ops()
- # now we just test is number of partition increased or decrised
+ # now we just test that the number of partitions has increased or decreased
def part_wait(self, num_match):
def _part_state():
self.partitions = self.remote_client.get_partitions().split('\n')
@@ -191,8 +195,8 @@
self.logger.info("attach volume (%s) to vm %s" %
(self.volume['id'], self.server_id))
servers_client.attach_volume(self.server_id,
- self.volume['id'],
- self.part_name)
+ volumeId=self.volume['id'],
+ device=self.part_name)
self.manager.volumes_client.wait_for_volume_status(self.volume['id'],
'in-use')
if self.enable_ssh_verify:
@@ -205,7 +209,7 @@
self.manager.volumes_client.wait_for_volume_status(self.volume['id'],
'available')
if self.enable_ssh_verify:
- self.logger.info("Scanning for block device disapperance on %s"
+ self.logger.info("Scanning for block device disappearance on %s"
% self.server_id)
self.part_wait(self.detach_match_count)
if self.new_volume:
diff --git a/tempest/stress/actions/volume_create_delete.py b/tempest/stress/actions/volume_create_delete.py
index 4870055..3986748 100644
--- a/tempest/stress/actions/volume_create_delete.py
+++ b/tempest/stress/actions/volume_create_delete.py
@@ -20,7 +20,7 @@
name = data_utils.rand_name("volume")
self.logger.info("creating %s" % name)
volumes_client = self.manager.volumes_client
- volume = volumes_client.create_volume(display_name=name)
+ volume = volumes_client.create_volume(display_name=name)['volume']
vol_id = volume['id']
volumes_client.wait_for_volume_status(vol_id, 'available')
self.logger.info("created %s" % volume['id'])
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index b785156..9456590 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -17,6 +17,7 @@
from oslo_log import log as logging
from tempest import clients
+from tempest.common import waiters
LOG = logging.getLogger(__name__)
@@ -34,11 +35,12 @@
for s in body['servers']:
try:
- admin_manager.servers_client.wait_for_server_termination(s['id'])
+ waiters.wait_for_server_termination(admin_manager.servers_client,
+ s['id'])
except Exception:
pass
- keypairs = admin_manager.keypairs_client.list_keypairs()
+ keypairs = admin_manager.keypairs_client.list_keypairs()['keypairs']
LOG.info("Cleanup::remove %s keypairs" % len(keypairs))
for k in keypairs:
try:
@@ -47,7 +49,8 @@
pass
secgrp_client = admin_manager.security_groups_client
- secgrp = secgrp_client.list_security_groups(all_tenants=True)
+ secgrp = (secgrp_client.list_security_groups(all_tenants=True)
+ ['security_groups'])
secgrp_del = [grp for grp in secgrp if grp['name'] != 'default']
LOG.info("Cleanup::remove %s Security Group" % len(secgrp_del))
for g in secgrp_del:
@@ -56,7 +59,8 @@
except Exception:
pass
- floating_ips = admin_manager.floating_ips_client.list_floating_ips()
+ floating_ips = (admin_manager.floating_ips_client.list_floating_ips()
+ ['floating_ips'])
LOG.info("Cleanup::remove %s floating ips" % len(floating_ips))
for f in floating_ips:
try:
@@ -70,7 +74,7 @@
if user['name'].startswith("stress_user"):
admin_manager.identity_client.delete_user(user['id'])
- tenants = admin_manager.identity_client.list_tenants()
+ tenants = admin_manager.identity_client.list_tenants()['tenants']
LOG.info("Cleanup::remove %s tenants" % len(tenants))
for tenant in tenants:
if tenant['name'].startswith("stress_tenant"):
@@ -79,8 +83,8 @@
# We have to delete snapshots first or
# volume deletion may block
- _, snaps = admin_manager.snapshots_client.\
- list_snapshots(params={"all_tenants": True})
+ _, snaps = admin_manager.snapshots_client.list_snapshots(
+ params={"all_tenants": True})['snapshots']
LOG.info("Cleanup::remove %s snapshots" % len(snaps))
for v in snaps:
try:
diff --git a/tempest/tests/cmd/test_javelin.py b/tempest/tests/cmd/test_javelin.py
index 3a3e46e..4a8f729 100644
--- a/tempest/tests/cmd/test_javelin.py
+++ b/tempest/tests/cmd/test_javelin.py
@@ -85,7 +85,7 @@
class TestCreateResources(JavelinUnitTest):
def test_create_tenants(self):
- self.fake_client.identity.list_tenants.return_value = []
+ self.fake_client.identity.list_tenants.return_value = {'tenants': []}
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
return_value=self.fake_client))
@@ -95,8 +95,8 @@
mocked_function.assert_called_once_with(self.fake_object['name'])
def test_create_duplicate_tenant(self):
- self.fake_client.identity.list_tenants.return_value = [
- {'name': self.fake_object['name']}]
+ self.fake_client.identity.list_tenants.return_value = {'tenants': [
+ {'name': self.fake_object['name']}]}
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
return_value=self.fake_client))
@@ -227,7 +227,7 @@
display_name=self.fake_object['name'])
mocked_function = self.fake_client.volumes.wait_for_volume_status
mocked_function.assert_called_once_with(
- self.fake_object.body['id'],
+ self.fake_object.body['volume']['id'],
'available')
def test_create_volume_existing(self):
@@ -270,9 +270,10 @@
def test_create_secgroup(self):
self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
return_value=self.fake_client))
- self.fake_client.secgroups.list_security_groups.return_value = []
+ self.fake_client.secgroups.list_security_groups.return_value = (
+ {'security_groups': []})
self.fake_client.secgroups.create_security_group.return_value = \
- {'id': self.fake_object['secgroup_id']}
+ {'security_group': {'id': self.fake_object['secgroup_id']}}
javelin.create_secgroups([self.fake_object])
diff --git a/tempest/tests/common/test_accounts.py b/tempest/tests/common/test_accounts.py
index 8fc3745..1acef8a 100644
--- a/tempest/tests/common/test_accounts.py
+++ b/tempest/tests/common/test_accounts.py
@@ -297,8 +297,9 @@
test_accounts_class = accounts.Accounts('v2', 'test_name')
with mock.patch('tempest.services.compute.json.networks_client.'
'NetworksClient.list_networks',
- return_value=[{'name': 'network-2', 'id': 'fake-id',
- 'label': 'network-2'}]):
+ return_value={'networks': [{'name': 'network-2',
+ 'id': 'fake-id',
+ 'label': 'network-2'}]}):
creds = test_accounts_class.get_creds_by_roles(['role-7'])
self.assertTrue(isinstance(creds, cred_provider.TestResources))
network = creds.network
diff --git a/tempest/tests/test_waiters.py b/tempest/tests/common/test_waiters.py
similarity index 65%
rename from tempest/tests/test_waiters.py
rename to tempest/tests/common/test_waiters.py
index 329d610..68a8295 100644
--- a/tempest/tests/test_waiters.py
+++ b/tempest/tests/common/test_waiters.py
@@ -18,6 +18,7 @@
from tempest.common import waiters
from tempest import exceptions
+from tempest.services.volume.json import volumes_client
from tempest.tests import base
@@ -47,3 +48,21 @@
self.assertRaises(exceptions.AddImageException,
waiters.wait_for_image_status,
self.client, 'fake_image_id', 'active')
+
+ @mock.patch.object(time, 'sleep')
+ def test_wait_for_volume_status_error_restoring(self, mock_sleep):
+ # Tests that the wait method raises VolumeRestoreErrorException if
+ # the volume status is 'error_restoring'.
+ client = mock.Mock(spec=volumes_client.BaseVolumesClient,
+ build_interval=1)
+ volume1 = {'volume': {'status': 'restoring-backup'}}
+ volume2 = {'volume': {'status': 'error_restoring'}}
+ mock_show = mock.Mock(side_effect=(volume1, volume2))
+ client.show_volume = mock_show
+ volume_id = '7532b91e-aa0a-4e06-b3e5-20c0c5ee1caa'
+ self.assertRaises(exceptions.VolumeRestoreErrorException,
+ waiters.wait_for_volume_status,
+ client, volume_id, 'available')
+ mock_show.assert_has_calls([mock.call(volume_id),
+ mock.call(volume_id)])
+ mock_sleep.assert_called_once_with(1)
diff --git a/tempest/tests/services/compute/base.py b/tempest/tests/services/compute/base.py
new file mode 100644
index 0000000..a35a87c
--- /dev/null
+++ b/tempest/tests/services/compute/base.py
@@ -0,0 +1,43 @@
+# Copyright 2015 Deutsche Telekom AG. 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 httplib2
+
+from oslo_serialization import jsonutils as json
+from oslotest import mockpatch
+
+from tempest.tests import base
+
+
+class BaseComputeServiceTest(base.TestCase):
+ def create_response(self, body, to_utf=False, status=200):
+ json_body = {}
+ if body:
+ json_body = json.dumps(body)
+ if to_utf:
+ json_body = json_body.encode('utf-8')
+ response = (httplib2.Response({'status': status}), json_body)
+ return response
+
+ def check_service_client_function(self, function, function2mock,
+ body, to_utf=False, status=200,
+ **kwargs):
+ mocked_response = self.create_response(body, to_utf, status)
+ self.useFixture(mockpatch.Patch(
+ function2mock, return_value=mocked_response))
+ if kwargs:
+ resp = function(**kwargs)
+ else:
+ resp = function()
+ self.assertEqual(body, resp)
diff --git a/tempest/tests/services/compute/test_agents_client.py b/tempest/tests/services/compute/test_agents_client.py
index 8316c90..9493a32 100644
--- a/tempest/tests/services/compute/test_agents_client.py
+++ b/tempest/tests/services/compute/test_agents_client.py
@@ -12,17 +12,37 @@
# License for the specific language governing permissions and limitations
# under the License.
-import httplib2
-
-from oslo_serialization import jsonutils as json
-from oslotest import mockpatch
-
from tempest.services.compute.json import agents_client
-from tempest.tests import base
from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
-class TestAgentsClient(base.TestCase):
+class TestAgentsClient(base.BaseComputeServiceTest):
+ FAKE_CREATE_AGENT = {
+ "agent":
+ {
+ "url": "http://foo.com",
+ "hypervisor": "kvm",
+ "md5hash": "md5",
+ "version": "2",
+ "architecture": "x86_64",
+ "os": "linux",
+ "agent_id": 1
+ }
+ }
+
+ FAKE_UPDATE_AGENT = {
+ "agent":
+ {
+ "url": "http://foo.com",
+ "hypervisor": "kvm",
+ "md5hash": "md5",
+ "version": "2",
+ "architecture": "x86_64",
+ "os": "linux",
+ "agent_id": 1
+ }
+ }
def setUp(self):
super(TestAgentsClient, self).setUp()
@@ -31,56 +51,34 @@
'compute', 'regionOne')
def _test_list_agents(self, bytes_body=False):
- body = '{"agents": []}'
- if bytes_body:
- body = body.encode('utf-8')
- expected = []
- response = (httplib2.Response({'status': 200}), body)
- self.useFixture(mockpatch.Patch(
+ self.check_service_client_function(
+ self.client.list_agents,
'tempest.common.service_client.ServiceClient.get',
- return_value=response))
- self.assertEqual(expected, self.client.list_agents())
+ {"agents": []},
+ bytes_body)
def _test_create_agent(self, bytes_body=False):
- expected = {"url": "http://foo.com", "hypervisor": "kvm",
- "md5hash": "md5", "version": "2", "architecture": "x86_64",
- "os": "linux", "agent_id": 1}
- serialized_body = json.dumps({"agent": expected})
- if bytes_body:
- serialized_body = serialized_body.encode('utf-8')
-
- mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
- self.useFixture(mockpatch.Patch(
+ self.check_service_client_function(
+ self.client.create_agent,
'tempest.common.service_client.ServiceClient.post',
- return_value=mocked_resp))
- resp = self.client.create_agent(
+ self.FAKE_CREATE_AGENT,
+ bytes_body,
url="http://foo.com", hypervisor="kvm", md5hash="md5",
- version="2", architecture="x86_64", os="linux"
- )
- self.assertEqual(expected, resp)
+ version="2", architecture="x86_64", os="linux")
def _test_delete_agent(self):
- mocked_resp = (httplib2.Response({'status': 200}), None)
- self.useFixture(mockpatch.Patch(
+ self.check_service_client_function(
+ self.client.delete_agent,
'tempest.common.service_client.ServiceClient.delete',
- return_value=mocked_resp))
- self.client.delete_agent("1")
+ {}, agent_id="1")
def _test_update_agent(self, bytes_body=False):
- expected = {"url": "http://foo.com", "md5hash": "md5", "version": "2",
- "agent_id": 1}
- serialized_body = json.dumps({"agent": expected})
- if bytes_body:
- serialized_body = serialized_body.encode('utf-8')
-
- mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
- self.useFixture(mockpatch.Patch(
+ self.check_service_client_function(
+ self.client.update_agent,
'tempest.common.service_client.ServiceClient.put',
- return_value=mocked_resp))
- resp = self.client.update_agent(
- "1", url="http://foo.com", md5hash="md5", version="2"
- )
- self.assertEqual(expected, resp)
+ self.FAKE_UPDATE_AGENT,
+ bytes_body,
+ agent_id="1", url="http://foo.com", md5hash="md5", version="2")
def test_list_agents_with_str_body(self):
self._test_list_agents()
diff --git a/tempest/tests/services/compute/test_aggregates_client.py b/tempest/tests/services/compute/test_aggregates_client.py
index eacc251..8184a46 100644
--- a/tempest/tests/services/compute/test_aggregates_client.py
+++ b/tempest/tests/services/compute/test_aggregates_client.py
@@ -12,17 +12,55 @@
# License for the specific language governing permissions and limitations
# under the License.
-import httplib2
-
-from oslo_serialization import jsonutils as json
-from oslotest import mockpatch
-
from tempest.services.compute.json import aggregates_client
-from tempest.tests import base
from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
-class TestAggregatesClient(base.TestCase):
+class TestAggregatesClient(base.BaseComputeServiceTest):
+ FAKE_SHOW_AGGREGATE = {
+ "aggregate":
+ {
+ "name": "hoge",
+ "availability_zone": None,
+ "deleted": False,
+ "created_at":
+ "2015-07-16T03:07:32.000000",
+ "updated_at": None,
+ "hosts": [],
+ "deleted_at": None,
+ "id": 1,
+ "metadata": {}
+ }
+ }
+
+ FAKE_CREATE_AGGREGATE = {
+ "aggregate":
+ {
+ "name": u'\xf4',
+ "availability_zone": None,
+ "deleted": False,
+ "created_at": "2015-07-21T04:11:18.000000",
+ "updated_at": None,
+ "deleted_at": None,
+ "id": 1
+ }
+ }
+
+ FAKE_UPDATE_AGGREGATE = {
+ "aggregate":
+ {
+ "name": u'\xe9',
+ "availability_zone": None,
+ "deleted": False,
+ "created_at": "2015-07-16T03:07:32.000000",
+ "updated_at": "2015-07-23T05:16:29.000000",
+ "hosts": [],
+ "deleted_at": None,
+ "id": 1,
+ "metadata": {}
+ }
+ }
def setUp(self):
super(TestAggregatesClient, self).setUp()
@@ -31,15 +69,11 @@
fake_auth, 'compute', 'regionOne')
def _test_list_aggregates(self, bytes_body=False):
- body = '{"aggregates": []}'
- if bytes_body:
- body = body.encode('utf-8')
- expected = []
- response = (httplib2.Response({'status': 200}), body)
- self.useFixture(mockpatch.Patch(
+ self.check_service_client_function(
+ self.client.list_aggregates,
'tempest.common.service_client.ServiceClient.get',
- return_value=response))
- self.assertEqual(expected, self.client.list_aggregates())
+ {"aggregates": []},
+ bytes_body)
def test_list_aggregates_with_str_body(self):
self._test_list_aggregates()
@@ -48,26 +82,12 @@
self._test_list_aggregates(bytes_body=True)
def _test_show_aggregate(self, bytes_body=False):
- expected = {"name": "hoge",
- "availability_zone": None,
- "deleted": False,
- "created_at":
- "2015-07-16T03:07:32.000000",
- "updated_at": None,
- "hosts": [],
- "deleted_at": None,
- "id": 1,
- "metadata": {}}
- serialized_body = json.dumps({"aggregate": expected})
- if bytes_body:
- serialized_body = serialized_body.encode('utf-8')
-
- mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
- self.useFixture(mockpatch.Patch(
+ self.check_service_client_function(
+ self.client.show_aggregate,
'tempest.common.service_client.ServiceClient.get',
- return_value=mocked_resp))
- resp = self.client.show_aggregate(1)
- self.assertEqual(expected, resp)
+ self.FAKE_SHOW_AGGREGATE,
+ bytes_body,
+ aggregate_id=1)
def test_show_aggregate_with_str_body(self):
self._test_show_aggregate()
@@ -76,23 +96,12 @@
self._test_show_aggregate(bytes_body=True)
def _test_create_aggregate(self, bytes_body=False):
- expected = {"name": u'\xf4',
- "availability_zone": None,
- "deleted": False,
- "created_at": "2015-07-21T04:11:18.000000",
- "updated_at": None,
- "deleted_at": None,
- "id": 1}
- serialized_body = json.dumps({"aggregate": expected})
- if bytes_body:
- serialized_body = serialized_body.encode('utf-8')
-
- mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
- self.useFixture(mockpatch.Patch(
+ self.check_service_client_function(
+ self.client.create_aggregate,
'tempest.common.service_client.ServiceClient.post',
- return_value=mocked_resp))
- resp = self.client.create_aggregate(name='hoge')
- self.assertEqual(expected, resp)
+ self.FAKE_CREATE_AGGREGATE,
+ bytes_body,
+ name='hoge')
def test_create_aggregate_with_str_body(self):
self._test_create_aggregate()
@@ -101,34 +110,18 @@
self._test_create_aggregate(bytes_body=True)
def test_delete_aggregate(self):
- expected = {}
- mocked_resp = (httplib2.Response({'status': 200}), None)
- self.useFixture(mockpatch.Patch(
+ self.check_service_client_function(
+ self.client.delete_aggregate,
'tempest.common.service_client.ServiceClient.delete',
- return_value=mocked_resp))
- resp = self.client.delete_aggregate("1")
- self.assertEqual(expected, resp)
+ {}, aggregate_id="1")
def _test_update_aggregate(self, bytes_body=False):
- expected = {"name": u'\xe9',
- "availability_zone": None,
- "deleted": False,
- "created_at": "2015-07-16T03:07:32.000000",
- "updated_at": "2015-07-23T05:16:29.000000",
- "hosts": [],
- "deleted_at": None,
- "id": 1,
- "metadata": {}}
- serialized_body = json.dumps({"aggregate": expected})
- if bytes_body:
- serialized_body = serialized_body.encode('utf-8')
-
- mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
- self.useFixture(mockpatch.Patch(
+ self.check_service_client_function(
+ self.client.update_aggregate,
'tempest.common.service_client.ServiceClient.put',
- return_value=mocked_resp))
- resp = self.client.update_aggregate(1)
- self.assertEqual(expected, resp)
+ self.FAKE_UPDATE_AGGREGATE,
+ bytes_body,
+ aggregate_id=1)
def test_update_aggregate_with_str_body(self):
self._test_update_aggregate()
diff --git a/tempest/tests/services/compute/test_availability_zone_client.py b/tempest/tests/services/compute/test_availability_zone_client.py
new file mode 100644
index 0000000..715cfd7
--- /dev/null
+++ b/tempest/tests/services/compute/test_availability_zone_client.py
@@ -0,0 +1,51 @@
+# 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 availability_zone_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestAvailabilityZoneClient(base.BaseComputeServiceTest):
+
+ FAKE_AVAILABIRITY_ZONE_INFO = {
+ "availabilityZoneInfo":
+ [
+ {
+ "zoneState": {
+ "available": True
+ },
+ "hosts": None,
+ "zoneName": u'\xf4'
+ }
+ ]
+ }
+
+ def setUp(self):
+ super(TestAvailabilityZoneClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = availability_zone_client.AvailabilityZoneClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def test_list_availability_zones_with_str_body(self):
+ self.check_service_client_function(
+ self.client.list_availability_zones,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_AVAILABIRITY_ZONE_INFO)
+
+ def test_list_availability_zones_with_bytes_body(self):
+ self.check_service_client_function(
+ self.client.list_availability_zones,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_AVAILABIRITY_ZONE_INFO, to_utf=True)
diff --git a/tempest/tests/services/compute/test_certificates_client.py b/tempest/tests/services/compute/test_certificates_client.py
new file mode 100644
index 0000000..c926fce
--- /dev/null
+++ b/tempest/tests/services/compute/test_certificates_client.py
@@ -0,0 +1,64 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import copy
+
+from tempest.services.compute.json import certificates_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestCertificatesClient(base.BaseComputeServiceTest):
+
+ FAKE_CERTIFICATE = {
+ "certificate": {
+ "data": "-----BEGIN----MIICyzCCAjSgAwI----END CERTIFICATE-----\n",
+ "private_key": None
+ }
+ }
+
+ def setUp(self):
+ super(TestCertificatesClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = certificates_client.CertificatesClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_show_certificate(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_certificate,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_CERTIFICATE,
+ bytes_body,
+ certificate_id="fake-id")
+
+ def test_show_certificate_with_str_body(self):
+ self._test_show_certificate()
+
+ def test_show_certificate_with_bytes_body(self):
+ self._test_show_certificate(bytes_body=True)
+
+ def _test_create_certificate(self, bytes_body=False):
+ cert = copy.deepcopy(self.FAKE_CERTIFICATE)
+ cert['certificate']['private_key'] = "my_private_key"
+ self.check_service_client_function(
+ self.client.create_certificate,
+ 'tempest.common.service_client.ServiceClient.post',
+ cert,
+ bytes_body)
+
+ def test_create_certificate_with_str_body(self):
+ self._test_create_certificate()
+
+ def test_create_certificate_with_bytes_body(self):
+ self._test_create_certificate(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_extensions_client.py b/tempest/tests/services/compute/test_extensions_client.py
new file mode 100644
index 0000000..86f81f3
--- /dev/null
+++ b/tempest/tests/services/compute/test_extensions_client.py
@@ -0,0 +1,65 @@
+# 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 extensions_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestExtensionsClient(base.BaseComputeServiceTest):
+
+ FAKE_SHOW_EXTENSION = {
+ "extension": {
+ "updated": "2011-06-09T00:00:00Z",
+ "name": "Multinic",
+ "links": [],
+ "namespace":
+ "http://docs.openstack.org/compute/ext/multinic/api/v1.1",
+ "alias": "NMN",
+ "description": u'\u2740(*\xb4\u25e1`*)\u2740'
+ }
+ }
+
+ def setUp(self):
+ super(TestExtensionsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = extensions_client.ExtensionsClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_list_extensions(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_extensions,
+ 'tempest.common.service_client.ServiceClient.get',
+ {"extensions": []},
+ bytes_body)
+
+ def test_list_extensions_with_str_body(self):
+ self._test_list_extensions()
+
+ def test_list_extensions_with_bytes_body(self):
+ self._test_list_extensions(bytes_body=True)
+
+ def _test_show_extension(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_extension,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_SHOW_EXTENSION,
+ bytes_body,
+ extension_alias="NMN")
+
+ def test_show_extension_with_str_body(self):
+ self._test_show_extension()
+
+ def test_show_extension_with_bytes_body(self):
+ self._test_show_extension(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_fixedIPs_client.py b/tempest/tests/services/compute/test_fixedIPs_client.py
new file mode 100644
index 0000000..d7a9694
--- /dev/null
+++ b/tempest/tests/services/compute/test_fixedIPs_client.py
@@ -0,0 +1,45 @@
+# 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 fixed_ips_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestFixedIPsClient(base.BaseComputeServiceTest):
+ FIXED_IP_INFO = {"fixed_ip": {"address": "10.0.0.1",
+ "cidr": "10.11.12.0/24",
+ "host": "localhost",
+ "hostname": "OpenStack"}}
+
+ def setUp(self):
+ super(TestFixedIPsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.fixedIPsClient = (fixed_ips_client.
+ FixedIPsClient
+ (fake_auth, 'compute',
+ 'regionOne'))
+
+ def _test_show_fixed_ip(self, bytes_body=False):
+ self.check_service_client_function(
+ self.fixedIPsClient.show_fixed_ip,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FIXED_IP_INFO, bytes_body,
+ status=200, fixed_ip='Identifier')
+
+ def test_show_fixed_ip_with_str_body(self):
+ self._test_show_fixed_ip()
+
+ def test_show_fixed_ip_with_bytes_body(self):
+ self._test_show_fixed_ip(True)
diff --git a/tempest/tests/services/compute/test_instance_usage_audit_log_client.py b/tempest/tests/services/compute/test_instance_usage_audit_log_client.py
new file mode 100644
index 0000000..d4bc889
--- /dev/null
+++ b/tempest/tests/services/compute/test_instance_usage_audit_log_client.py
@@ -0,0 +1,73 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import datetime
+
+from tempest.services.compute.json import instance_usage_audit_log_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestInstanceUsagesAuditLogClient(base.BaseComputeServiceTest):
+
+ FAKE_AUDIT_LOG = {
+ "hosts_not_run": [
+ "f4eb7cfd155f4574967f8b55a7faed75"
+ ],
+ "log": {},
+ "num_hosts": 1,
+ "num_hosts_done": 0,
+ "num_hosts_not_run": 1,
+ "num_hosts_running": 0,
+ "overall_status": "0 of 1 hosts done. 0 errors.",
+ "period_beginning": "2012-12-01 00:00:00",
+ "period_ending": "2013-01-01 00:00:00",
+ "total_errors": 0,
+ "total_instances": 0
+ }
+
+ def setUp(self):
+ super(TestInstanceUsagesAuditLogClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = (instance_usage_audit_log_client.
+ InstanceUsagesAuditLogClient(fake_auth, 'compute',
+ 'regionOne'))
+
+ def _test_list_instance_usage_audit_logs(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_instance_usage_audit_logs,
+ 'tempest.common.service_client.ServiceClient.get',
+ {"instance_usage_audit_logs": self.FAKE_AUDIT_LOG},
+ bytes_body)
+
+ def test_list_instance_usage_audit_logs_with_str_body(self):
+ self._test_list_instance_usage_audit_logs()
+
+ def test_list_instance_usage_audit_logs_with_bytes_body(self):
+ self._test_list_instance_usage_audit_logs(bytes_body=True)
+
+ def _test_show_instance_usage_audit_log(self, bytes_body=False):
+ before_time = datetime.datetime(2012, 12, 1, 0, 0)
+ self.check_service_client_function(
+ self.client.show_instance_usage_audit_log,
+ 'tempest.common.service_client.ServiceClient.get',
+ {"instance_usage_audit_log": self.FAKE_AUDIT_LOG},
+ bytes_body,
+ time_before=before_time)
+
+ def test_show_instance_usage_audit_log_with_str_body(self):
+ self._test_show_instance_usage_audit_log()
+
+ def test_show_network_with_bytes_body_with_bytes_body(self):
+ self._test_show_instance_usage_audit_log(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_keypairs_client.py b/tempest/tests/services/compute/test_keypairs_client.py
index e79e411..6ad187b 100644
--- a/tempest/tests/services/compute/test_keypairs_client.py
+++ b/tempest/tests/services/compute/test_keypairs_client.py
@@ -12,16 +12,21 @@
# License for the specific language governing permissions and limitations
# under the License.
-import httplib2
-
-from oslotest import mockpatch
+import copy
from tempest.services.compute.json import keypairs_client
-from tempest.tests import base
from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
-class TestKeyPairsClient(base.TestCase):
+class TestKeyPairsClient(base.BaseComputeServiceTest):
+
+ FAKE_KEYPAIR = {"keypair": {
+ "public_key": "ssh-rsa foo Generated-by-Nova",
+ "name": u'\u2740(*\xb4\u25e1`*)\u2740',
+ "user_id": "525d55f98980415ba98e634972fa4a10",
+ "fingerprint": "76:24:66:49:d7:ca:6e:5c:77:ea:8e:bb:9c:15:5f:98"
+ }}
def setUp(self):
super(TestKeyPairsClient, self).setUp()
@@ -30,18 +35,60 @@
fake_auth, 'compute', 'regionOne')
def _test_list_keypairs(self, bytes_body=False):
- body = '{"keypairs": []}'
- if bytes_body:
- body = body.encode('utf-8')
- expected = []
- response = (httplib2.Response({'status': 200}), body)
- self.useFixture(mockpatch.Patch(
+ self.check_service_client_function(
+ self.client.list_keypairs,
'tempest.common.service_client.ServiceClient.get',
- return_value=response))
- self.assertEqual(expected, self.client.list_keypairs())
+ {"keypairs": []},
+ bytes_body)
def test_list_keypairs_with_str_body(self):
self._test_list_keypairs()
def test_list_keypairs_with_bytes_body(self):
self._test_list_keypairs(bytes_body=True)
+
+ def _test_show_keypair(self, bytes_body=False):
+ fake_keypair = copy.deepcopy(self.FAKE_KEYPAIR)
+ fake_keypair["keypair"].update({
+ "deleted": False,
+ "created_at": "2015-07-22T04:53:52.000000",
+ "updated_at": None,
+ "deleted_at": None,
+ "id": 1
+ })
+
+ self.check_service_client_function(
+ self.client.show_keypair,
+ 'tempest.common.service_client.ServiceClient.get',
+ fake_keypair,
+ bytes_body,
+ keypair_name="test")
+
+ def test_show_keypair_with_str_body(self):
+ self._test_show_keypair()
+
+ def test_show_keypair_with_bytes_body(self):
+ self._test_show_keypair(bytes_body=True)
+
+ def _test_create_keypair(self, bytes_body=False):
+ fake_keypair = copy.deepcopy(self.FAKE_KEYPAIR)
+ fake_keypair["keypair"].update({"private_key": "foo"})
+
+ self.check_service_client_function(
+ self.client.create_keypair,
+ 'tempest.common.service_client.ServiceClient.post',
+ fake_keypair,
+ bytes_body,
+ name="test")
+
+ def test_create_keypair_with_str_body(self):
+ self._test_create_keypair()
+
+ def test_create_keypair_with_bytes_body(self):
+ self._test_create_keypair(bytes_body=True)
+
+ def test_delete_keypair(self):
+ self.check_service_client_function(
+ self.client.delete_keypair,
+ 'tempest.common.service_client.ServiceClient.delete',
+ {}, status=202, keypair_name='test')
diff --git a/tempest/tests/services/compute/test_limits_client.py b/tempest/tests/services/compute/test_limits_client.py
new file mode 100644
index 0000000..0036a3d
--- /dev/null
+++ b/tempest/tests/services/compute/test_limits_client.py
@@ -0,0 +1,66 @@
+# 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 limits_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestLimitsClient(base.BaseComputeServiceTest):
+
+ def setUp(self):
+ super(TestLimitsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = limits_client.LimitsClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_show_limits(self, bytes_body=False):
+ expected = {
+ "limits": {
+ "rate": [],
+ "absolute": {
+ "maxServerMeta": 128,
+ "maxPersonality": 5,
+ "totalServerGroupsUsed": 0,
+ "maxImageMeta": 128,
+ "maxPersonalitySize": 10240,
+ "maxServerGroups": 10,
+ "maxSecurityGroupRules": 20,
+ "maxTotalKeypairs": 100,
+ "totalCoresUsed": 0,
+ "totalRAMUsed": 0,
+ "totalInstancesUsed": 0,
+ "maxSecurityGroups": 10,
+ "totalFloatingIpsUsed": 0,
+ "maxTotalCores": 20,
+ "totalSecurityGroupsUsed": 0,
+ "maxTotalFloatingIps": 10,
+ "maxTotalInstances": 10,
+ "maxTotalRAMSize": 51200,
+ "maxServerGroupMembers": 10
+ }
+ }
+ }
+
+ self.check_service_client_function(
+ self.client.show_limits,
+ 'tempest.common.service_client.ServiceClient.get',
+ expected,
+ bytes_body)
+
+ def test_show_limits_with_str_body(self):
+ self._test_show_limits()
+
+ def test_show_limits_with_bytes_body(self):
+ self._test_show_limits(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_migrations_client.py b/tempest/tests/services/compute/test_migrations_client.py
new file mode 100644
index 0000000..83fe461
--- /dev/null
+++ b/tempest/tests/services/compute/test_migrations_client.py
@@ -0,0 +1,52 @@
+# 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 migrations_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestMigrationsClient(base.BaseComputeServiceTest):
+ FAKE_MIGRATION_INFO = {"migrations": [{
+ "created_at": "2012-10-29T13:42:02",
+ "dest_compute": "compute2",
+ "dest_host": "1.2.3.4",
+ "dest_node": "node2",
+ "id": 1234,
+ "instance_uuid": "e9e4fdd7-f956-44ff-bfeb-d654a96ab3a2",
+ "new_instance_type_id": 2,
+ "old_instance_type_id": 1,
+ "source_compute": "compute1",
+ "source_node": "node1",
+ "status": "finished",
+ "updated_at": "2012-10-29T13:42:02"}]}
+
+ def setUp(self):
+ super(TestMigrationsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.mg_client_obj = migrations_client.MigrationsClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_list_migrations(self, bytes_body=False):
+ self.check_service_client_function(
+ self.mg_client_obj.list_migrations,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_MIGRATION_INFO,
+ bytes_body)
+
+ def test_list_migration_with_str_body(self):
+ self._test_list_migrations()
+
+ def test_list_migration_with_bytes_body(self):
+ self._test_list_migrations(True)
diff --git a/tempest/tests/services/compute/test_networks_client.py b/tempest/tests/services/compute/test_networks_client.py
new file mode 100644
index 0000000..b47430b
--- /dev/null
+++ b/tempest/tests/services/compute/test_networks_client.py
@@ -0,0 +1,94 @@
+# 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 networks_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestNetworksClient(base.BaseComputeServiceTest):
+
+ FAKE_NETWORK = {
+ "bridge": None,
+ "vpn_public_port": None,
+ "dhcp_start": None,
+ "bridge_interface": None,
+ "share_address": None,
+ "updated_at": None,
+ "id": "34d5ae1e-5659-49cf-af80-73bccd7d7ad3",
+ "cidr_v6": None,
+ "deleted_at": None,
+ "gateway": None,
+ "rxtx_base": None,
+ "label": u'30d7',
+ "priority": None,
+ "project_id": None,
+ "vpn_private_address": None,
+ "deleted": None,
+ "vlan": None,
+ "broadcast": None,
+ "netmask": None,
+ "injected": None,
+ "cidr": None,
+ "vpn_public_address": None,
+ "multi_host": None,
+ "enable_dhcp": None,
+ "dns2": None,
+ "created_at": None,
+ "host": None,
+ "mtu": None,
+ "gateway_v6": None,
+ "netmask_v6": None,
+ "dhcp_server": None,
+ "dns1": None
+ }
+
+ network_id = "34d5ae1e-5659-49cf-af80-73bccd7d7ad3"
+
+ FAKE_NETWORKS = [FAKE_NETWORK]
+
+ def setUp(self):
+ super(TestNetworksClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = networks_client.NetworksClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_list_networks(self, bytes_body=False):
+ fake_list = {"networks": self.FAKE_NETWORKS}
+ self.check_service_client_function(
+ self.client.list_networks,
+ 'tempest.common.service_client.ServiceClient.get',
+ fake_list,
+ bytes_body)
+
+ def test_list_networks_with_str_body(self):
+ self._test_list_networks()
+
+ def test_list_networks_with_bytes_body(self):
+ self._test_list_networks(bytes_body=True)
+
+ def _test_show_network(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_network,
+ 'tempest.common.service_client.ServiceClient.get',
+ {"network": self.FAKE_NETWORK},
+ bytes_body,
+ network_id=self.network_id
+ )
+
+ def test_show_network_with_str_body(self):
+ self._test_show_network()
+
+ def test_show_network_with_bytes_body(self):
+ self._test_show_network(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_quota_classes_client.py b/tempest/tests/services/compute/test_quota_classes_client.py
new file mode 100644
index 0000000..f4fc51a
--- /dev/null
+++ b/tempest/tests/services/compute/test_quota_classes_client.py
@@ -0,0 +1,71 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import copy
+
+from tempest.services.compute.json import quota_classes_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestQuotaClassesClient(base.BaseComputeServiceTest):
+
+ FAKE_QUOTA_CLASS_SET = {
+ "injected_file_content_bytes": 10240,
+ "metadata_items": 128,
+ "server_group_members": 10,
+ "server_groups": 10,
+ "ram": 51200,
+ "floating_ips": 10,
+ "key_pairs": 100,
+ "id": u'\u2740(*\xb4\u25e1`*)\u2740',
+ "instances": 10,
+ "security_group_rules": 20,
+ "security_groups": 10,
+ "injected_files": 5,
+ "cores": 20,
+ "fixed_ips": -1,
+ "injected_file_path_bytes": 255,
+ }
+
+ def setUp(self):
+ super(TestQuotaClassesClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = quota_classes_client.QuotaClassesClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_show_quota_class_set(self, bytes_body=False):
+ fake_body = {'quota_class_set': self.FAKE_QUOTA_CLASS_SET}
+ self.check_service_client_function(
+ self.client.show_quota_class_set,
+ 'tempest.common.service_client.ServiceClient.get',
+ fake_body,
+ bytes_body,
+ quota_class_id="test")
+
+ def test_show_quota_class_set_with_str_body(self):
+ self._test_show_quota_class_set()
+
+ def test_show_quota_class_set_with_bytes_body(self):
+ self._test_show_quota_class_set(bytes_body=True)
+
+ def test_update_quota_class_set(self):
+ fake_quota_class_set = copy.deepcopy(self.FAKE_QUOTA_CLASS_SET)
+ fake_quota_class_set.pop("id")
+ fake_body = {'quota_class_set': fake_quota_class_set}
+ self.check_service_client_function(
+ self.client.update_quota_class_set,
+ 'tempest.common.service_client.ServiceClient.put',
+ fake_body,
+ quota_class_id="test")
diff --git a/tempest/tests/services/compute/test_quotas_client.py b/tempest/tests/services/compute/test_quotas_client.py
new file mode 100644
index 0000000..68f74aa
--- /dev/null
+++ b/tempest/tests/services/compute/test_quotas_client.py
@@ -0,0 +1,92 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import copy
+
+from tempest.services.compute.json import quotas_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestQuotasClient(base.BaseComputeServiceTest):
+
+ FAKE_QUOTA_SET = {
+ "quota_set": {
+ "injected_file_content_bytes": 10240,
+ "metadata_items": 128,
+ "server_group_members": 10,
+ "server_groups": 10,
+ "ram": 51200,
+ "floating_ips": 10,
+ "key_pairs": 100,
+ "id": "8421f7be61064f50b680465c07f334af",
+ "instances": 10,
+ "security_group_rules": 20,
+ "injected_files": 5,
+ "cores": 20,
+ "fixed_ips": -1,
+ "injected_file_path_bytes": 255,
+ "security_groups": 10}
+ }
+
+ project_id = "8421f7be61064f50b680465c07f334af"
+
+ def setUp(self):
+ super(TestQuotasClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = quotas_client.QuotasClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_show_quota_set(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_quota_set,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_QUOTA_SET,
+ to_utf=bytes_body,
+ tenant_id=self.project_id)
+
+ def test_show_quota_set_with_str_body(self):
+ self._test_show_quota_set()
+
+ def test_show_quota_set_with_bytes_body(self):
+ self._test_show_quota_set(bytes_body=True)
+
+ def _test_show_default_quota_set(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_default_quota_set,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_QUOTA_SET,
+ to_utf=bytes_body,
+ tenant_id=self.project_id)
+
+ def test_show_default_quota_set_with_str_body(self):
+ self._test_show_quota_set()
+
+ def test_show_default_quota_set_with_bytes_body(self):
+ self._test_show_quota_set(bytes_body=True)
+
+ def test_update_quota_set(self):
+ fake_quota_set = copy.deepcopy(self.FAKE_QUOTA_SET)
+ fake_quota_set['quota_set'].pop("id")
+ self.check_service_client_function(
+ self.client.update_quota_set,
+ 'tempest.common.service_client.ServiceClient.put',
+ fake_quota_set,
+ tenant_id=self.project_id)
+
+ def test_delete_quota_set(self):
+ self.check_service_client_function(
+ self.client.delete_quota_set,
+ 'tempest.common.service_client.ServiceClient.delete',
+ {}, status=202, tenant_id=self.project_id)
diff --git a/tempest/tests/services/compute/test_services_client.py b/tempest/tests/services/compute/test_services_client.py
new file mode 100644
index 0000000..fe63de9
--- /dev/null
+++ b/tempest/tests/services/compute/test_services_client.py
@@ -0,0 +1,94 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import copy
+
+from tempest.services.compute.json import services_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestServicesClient(base.BaseComputeServiceTest):
+
+ FAKE_SERVICES = {
+ "services":
+ [{
+ "status": "enabled",
+ "binary": "nova-conductor",
+ "zone": "internal",
+ "state": "up",
+ "updated_at": "2015-08-19T06:50:55.000000",
+ "host": "controller",
+ "disabled_reason": None,
+ "id": 1
+ }]
+ }
+
+ FAKE_SERVICE = {
+ "service":
+ {
+ "status": "enabled",
+ "binary": "nova-conductor",
+ "host": "controller"
+ }
+ }
+
+ def setUp(self):
+ super(TestServicesClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = services_client.ServicesClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def test_list_services_with_str_body(self):
+ self.check_service_client_function(
+ self.client.list_services,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_SERVICES)
+
+ def test_list_services_with_bytes_body(self):
+ self.check_service_client_function(
+ self.client.list_services,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_SERVICES, to_utf=True)
+
+ def _test_enable_service(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.enable_service,
+ 'tempest.common.service_client.ServiceClient.put',
+ self.FAKE_SERVICE,
+ bytes_body,
+ host_name="nova-conductor", binary="controller")
+
+ def test_enable_service_with_str_body(self):
+ self._test_enable_service()
+
+ def test_enable_service_with_bytes_body(self):
+ self._test_enable_service(bytes_body=True)
+
+ def _test_disable_service(self, bytes_body=False):
+ fake_service = copy.deepcopy(self.FAKE_SERVICE)
+ fake_service["service"]["status"] = "disable"
+
+ self.check_service_client_function(
+ self.client.enable_service,
+ 'tempest.common.service_client.ServiceClient.put',
+ fake_service,
+ bytes_body,
+ host_name="nova-conductor", binary="controller")
+
+ def test_disable_service_with_str_body(self):
+ self._test_enable_service()
+
+ def test_disable_service_with_bytes_body(self):
+ self._test_enable_service(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_tenant_networks_client.py b/tempest/tests/services/compute/test_tenant_networks_client.py
new file mode 100644
index 0000000..dc2de00
--- /dev/null
+++ b/tempest/tests/services/compute/test_tenant_networks_client.py
@@ -0,0 +1,63 @@
+# 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 tenant_networks_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestTenantNetworksClient(base.BaseComputeServiceTest):
+
+ FAKE_NETWORK = {
+ "cidr": "None",
+ "id": "c2329eb4-cc8e-4439-ac4c-932369309e36",
+ "label": u'\u30d7'
+ }
+
+ FAKE_NETWORKS = [FAKE_NETWORK]
+
+ NETWORK_ID = FAKE_NETWORK['id']
+
+ def setUp(self):
+ super(TestTenantNetworksClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = tenant_networks_client.TenantNetworksClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_list_tenant_networks(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_tenant_networks,
+ 'tempest.common.service_client.ServiceClient.get',
+ {"networks": self.FAKE_NETWORKS},
+ bytes_body)
+
+ def test_list_tenant_networks_with_str_body(self):
+ self._test_list_tenant_networks()
+
+ def test_list_tenant_networks_with_bytes_body(self):
+ self._test_list_tenant_networks(bytes_body=True)
+
+ def _test_show_tenant_network(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_tenant_network,
+ 'tempest.common.service_client.ServiceClient.get',
+ {"network": self.FAKE_NETWORK},
+ bytes_body,
+ network_id=self.NETWORK_ID)
+
+ def test_show_tenant_network_with_str_body(self):
+ self._test_show_tenant_network()
+
+ def test_show_tenant_network_with_bytes_body(self):
+ self._test_show_tenant_network(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_tenant_usages_client.py b/tempest/tests/services/compute/test_tenant_usages_client.py
new file mode 100644
index 0000000..8a2c1a4
--- /dev/null
+++ b/tempest/tests/services/compute/test_tenant_usages_client.py
@@ -0,0 +1,79 @@
+# 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 tenant_usages_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestTenantUsagesClient(base.BaseComputeServiceTest):
+
+ FAKE_SERVER_USAGES = [{
+ "ended_at": None,
+ "flavor": "m1.tiny",
+ "hours": 1.0,
+ "instance_id": "1f1deceb-17b5-4c04-84c7-e0d4499c8fe0",
+ "local_gb": 1,
+ "memory_mb": 512,
+ "name": "new-server-test",
+ "started_at": "2012-10-08T20:10:44.541277",
+ "state": "active",
+ "tenant_id": "openstack",
+ "uptime": 3600,
+ "vcpus": 1
+ }]
+
+ FAKE_TENANT_USAGES = [{
+ "server_usages": FAKE_SERVER_USAGES,
+ "start": "2012-10-08T21:10:44.587336",
+ "stop": "2012-10-08T22:10:44.587336",
+ "tenant_id": "openstack",
+ "total_hours": 1,
+ "total_local_gb_usage": 1,
+ "total_memory_mb_usage": 512,
+ "total_vcpus_usage": 1
+ }]
+
+ def setUp(self):
+ super(TestTenantUsagesClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = tenant_usages_client.TenantUsagesClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_list_tenant_usages(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_tenant_usages,
+ 'tempest.common.service_client.ServiceClient.get',
+ {"tenant_usages": self.FAKE_TENANT_USAGES},
+ to_utf=bytes_body)
+
+ def test_list_tenant_usages_with_str_body(self):
+ self._test_list_tenant_usages()
+
+ def test_list_tenant_usages_with_bytes_body(self):
+ self._test_list_tenant_usages(bytes_body=True)
+
+ def _test_show_tenant_usage(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_tenant_usage,
+ 'tempest.common.service_client.ServiceClient.get',
+ {"tenant_usage": self.FAKE_TENANT_USAGES[0]},
+ to_utf=bytes_body,
+ tenant_id='openstack')
+
+ def test_show_tenant_usage_with_str_body(self):
+ self._test_show_tenant_usage()
+
+ def test_show_tenant_usage_with_bytes_body(self):
+ self._test_show_tenant_usage(bytes_body=True)
diff --git a/tempest/tests/test_hacking.py b/tempest/tests/test_hacking.py
index 9bc9cfe..62d2aee 100644
--- a/tempest/tests/test_hacking.py
+++ b/tempest/tests/test_hacking.py
@@ -138,3 +138,11 @@
self.assertEqual(0, len(list(checks.no_mutable_default_args(
"defined, undefined = [], {}"))))
+
+ def test_no_testtools_skip_decorator(self):
+ self.assertEqual(1, len(list(checks.no_testtools_skip_decorator(
+ " @testtools.skip('Bug xxx')"))))
+ self.assertEqual(0, len(list(checks.no_testtools_skip_decorator(
+ " @testtools.skipUnless(CONF.something, 'msg')"))))
+ self.assertEqual(0, len(list(checks.no_testtools_skip_decorator(
+ " @testtools.skipIf(CONF.something, 'msg')"))))
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index 1ff4dee..8c371a7 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -303,7 +303,7 @@
@classmethod
def get_lfunction_gone(cls, obj):
"""If the object is instance of a well know type returns back with
- with the correspoding function otherwise it assumes the obj itself
+ with the corresponding function otherwise it assumes the obj itself
is the function.
"""
ec = cls.ec2_error_code
@@ -377,7 +377,7 @@
state = self.waitSnapshotStatus(lfunction, wait_for)
self.assertIn(state, wait_for)
- def assertAddressDissasociatedWait(self, address):
+ def assertAddressDisassociatedWait(self, address):
def _disassociate():
cli = self.ec2_client
@@ -467,7 +467,7 @@
client.InvalidInstanceID.NotFound.match(exc) is None:
return "_GONE"
# NOTE(afazekas): incorrect code,
- # but the resource must be destoreyd
+ # but the resource must be destroyed
if exc.error_code == "InstanceNotFound":
return "_GONE"
@@ -505,7 +505,7 @@
LOG.critical("%s Volume has %s snapshot(s)", volume.id,
map(snaps.id, snaps))
- # NOTE(afazekas): detaching/attching not valid EC2 status
+ # NOTE(afazekas): detaching/attaching not valid EC2 status
def _volume_state():
volume.update(validate=True)
try:
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index 920f602..49a1854 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -348,7 +348,7 @@
instance.stop()
address.disassociate()
- self.assertAddressDissasociatedWait(address)
+ self.assertAddressDisassociatedWait(address)
self.cancelResourceCleanUp(rcuk_da)
address.release()
self.assertAddressReleasedWait(address)
diff --git a/tempest/thirdparty/boto/test_ec2_security_groups.py b/tempest/thirdparty/boto/test_ec2_security_groups.py
index 88ff154..594dc8b 100644
--- a/tempest/thirdparty/boto/test_ec2_security_groups.py
+++ b/tempest/thirdparty/boto/test_ec2_security_groups.py
@@ -68,5 +68,5 @@
group_get = self.client.get_all_security_groups(
groupnames=(group_name,))[0]
- # all rules shuld be removed now
+ # all rules should be removed now
self.assertEqual(0, len(group_get.rules))
diff --git a/test-requirements.txt b/test-requirements.txt
index 2ea30ec..db2b2ce 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -9,4 +9,4 @@
mox>=0.5.3
mock>=1.2
coverage>=3.6
-oslotest>=1.9.0 # Apache-2.0
+oslotest>=1.10.0 # Apache-2.0
diff --git a/tox.ini b/tox.ini
index eae6fc7..3250344 100644
--- a/tox.ini
+++ b/tox.ini
@@ -108,9 +108,7 @@
commands = {posargs}
[testenv:docs]
-# The sample config file we generate is included in the sphinxdoc, so build that first.
commands =
- oslo-config-generator --config-file tools/config/config-generator.tempest.conf --output-file doc/source/_static/tempest.conf
python setup.py build_sphinx {posargs}
[testenv:pep8]