Merge "Removes vim headers 5th round"
diff --git a/etc/schemas/compute/flavors/flavor_details_v3.json b/etc/schemas/compute/flavors/flavor_details_v3.json
new file mode 100644
index 0000000..d1c1077
--- /dev/null
+++ b/etc/schemas/compute/flavors/flavor_details_v3.json
@@ -0,0 +1,6 @@
+{
+ "name": "get-flavor-details",
+ "http-method": "GET",
+ "url": "flavors/%s",
+ "resources": ["flavor"]
+}
diff --git a/etc/schemas/compute/flavors/flavors_list_v3.json b/etc/schemas/compute/flavors/flavors_list_v3.json
new file mode 100644
index 0000000..d5388b3
--- /dev/null
+++ b/etc/schemas/compute/flavors/flavors_list_v3.json
@@ -0,0 +1,24 @@
+{
+ "name": "list-flavors-with-detail",
+ "http-method": "GET",
+ "url": "flavors/detail",
+ "json-schema": {
+ "type": "object",
+ "properties": {
+ "min_ram": {
+ "type": "integer",
+ "results": {
+ "gen_none": 400,
+ "gen_string": 400
+ }
+ },
+ "min_disk": {
+ "type": "integer",
+ "results": {
+ "gen_none": 400,
+ "gen_string": 400
+ }
+ }
+ }
+ }
+}
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 27e0c60..025d0f3 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -453,6 +453,12 @@
# enabled (boolean value)
#trust=true
+# Is the v2 identity API enabled (boolean value)
+#api_v2=true
+
+# Is the v3 identity API enabled (boolean value)
+#api_v3=true
+
[image]
diff --git a/requirements.txt b/requirements.txt
index 8c0f872..8573a2e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,6 +14,7 @@
python-neutronclient>=2.3.3,<3
python-cinderclient>=1.0.6
python-heatclient>=0.2.3
+python-savannaclient>=0.4.1
python-swiftclient>=1.5
testresources>=0.2.4
keyring>=1.6.1,<2.0,>=2.1
diff --git a/setup.cfg b/setup.cfg
index 23a97ff..79f538f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -21,3 +21,6 @@
all_files = 1
build-dir = doc/build
source-dir = doc/source
+
+[wheel]
+universal = 1
diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py
index 252f4be..3e13bf8 100644
--- a/tempest/api/compute/admin/test_flavors.py
+++ b/tempest/api/compute/admin/test_flavors.py
@@ -172,7 +172,6 @@
flag = True
self.assertTrue(flag)
- @test.skip_because(bug="1209101")
@test.attr(type='gate')
def test_list_non_public_flavor(self):
# Create a flavor with os-flavor-access:is_public false should
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index 08df616..1078847 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -172,7 +172,7 @@
# The server in error state should be rebuilt using the provided
# image and changed to ACTIVE state
- # resetting vm state require admin priviledge
+ # resetting vm state require admin privilege
resp, server = self.client.reset_state(self.s1_id, state='error')
self.assertEqual(202, resp.status)
resp, rebuilt_server = self.non_admin_client.rebuild(
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index e6ddf1c..72bb723 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -51,6 +51,7 @@
cls.servers = []
cls.images = []
cls.multi_user = cls.get_multi_user()
+ cls.security_groups = []
@classmethod
def get_multi_user(cls):
@@ -102,9 +103,25 @@
pass
@classmethod
+ def clear_security_groups(cls):
+ for sg in cls.security_groups:
+ try:
+ resp, body =\
+ cls.security_groups_client.delete_security_group(sg['id'])
+ except exceptions.NotFound:
+ # The security group may have already been deleted which is OK.
+ pass
+ except Exception as exc:
+ LOG.info('Exception raised deleting security group %s',
+ sg['id'])
+ LOG.exception(exc)
+ pass
+
+ @classmethod
def tearDownClass(cls):
cls.clear_images()
cls.clear_servers()
+ cls.clear_security_groups()
cls.clear_isolated_creds()
super(BaseComputeTest, cls).tearDownClass()
@@ -146,6 +163,19 @@
return resp, body
+ @classmethod
+ def create_security_group(cls, name=None, description=None):
+ if name is None:
+ name = data_utils.rand_name(cls.__name__ + "-securitygroup")
+ if description is None:
+ description = data_utils.rand_name('description-')
+ resp, body = \
+ cls.security_groups_client.create_security_group(name,
+ description)
+ cls.security_groups.append(body)
+
+ return resp, body
+
def wait_for(self, condition):
"""Repeatedly calls condition() until a timeout."""
start_time = int(time.time())
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index f82143e..6cbf18d 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -15,7 +15,6 @@
from tempest.api.compute import base
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.test import attr
@@ -64,12 +63,6 @@
cls.tearDownClass()
raise
- @attr(type=['negative', 'gate'])
- def test_get_image_not_existing(self):
- # Check raises a NotFound
- self.assertRaises(exceptions.NotFound, self.client.get_image,
- "nonexistingimageid")
-
@attr(type='gate')
def test_list_images_filter_by_status(self):
# The list of images should contain only images with the
@@ -221,11 +214,6 @@
resp, images = self.client.list_images_with_detail(params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
- @attr(type=['negative', 'gate'])
- def test_get_nonexistent_image(self):
- # Negative test: GET on non-existent image should fail
- self.assertRaises(exceptions.NotFound, self.client.get_image, 999)
-
class ListImageFiltersTestXML(ListImageFiltersTestJSON):
_interface = 'xml'
diff --git a/tempest/api/compute/images/test_list_image_filters_negative.py b/tempest/api/compute/images/test_list_image_filters_negative.py
new file mode 100644
index 0000000..3b19d3c
--- /dev/null
+++ b/tempest/api/compute/images/test_list_image_filters_negative.py
@@ -0,0 +1,44 @@
+# Copyright 2014 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import config
+from tempest import exceptions
+from tempest import test
+
+CONF = config.CONF
+
+
+class ListImageFiltersNegativeTestJSON(base.BaseV2ComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(ListImageFiltersNegativeTestJSON, cls).setUpClass()
+ if not CONF.service_available.glance:
+ skip_msg = ("%s skipped as glance is not available" % cls.__name__)
+ raise cls.skipException(skip_msg)
+ cls.client = cls.images_client
+
+ @test.attr(type=['negative', 'gate'])
+ def test_get_nonexistent_image(self):
+ # Check raises a NotFound
+ nonexistent_image = data_utils.rand_uuid()
+ self.assertRaises(exceptions.NotFound, self.client.get_image,
+ nonexistent_image)
+
+
+class ListImageFiltersNegativeTestXML(ListImageFiltersNegativeTestJSON):
+ _interface = 'xml'
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 375105e..17bb489 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -14,9 +14,8 @@
# under the License.
from tempest.api.compute.security_groups import base
-from tempest.common.utils import data_utils
from tempest import config
-from tempest.test import attr
+from tempest import test
CONF = config.CONF
@@ -30,17 +29,13 @@
cls.client = cls.security_groups_client
cls.neutron_available = CONF.service_available.neutron
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_security_group_rules_create(self):
# Positive test: Creation of Security Group rule
# should be successful
# Creating a Security Group to add rules to it
- s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = \
- self.client.create_security_group(s_name, s_description)
- securitygroup_id = securitygroup['id']
- self.addCleanup(self.client.delete_security_group, securitygroup_id)
+ resp, security_group = self.create_security_group()
+ securitygroup_id = security_group['id']
# Adding rules to the created Security Group
ip_protocol = 'tcp'
from_port = 22
@@ -53,7 +48,7 @@
self.addCleanup(self.client.delete_security_group_rule, rule['id'])
self.assertEqual(200, resp.status)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_security_group_rules_create_with_optional_arguments(self):
# Positive test: Creation of Security Group rule
# with optional arguments
@@ -62,19 +57,11 @@
secgroup1 = None
secgroup2 = None
# Creating a Security Group to add rules to it
- s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = \
- self.client.create_security_group(s_name, s_description)
- secgroup1 = securitygroup['id']
- self.addCleanup(self.client.delete_security_group, secgroup1)
+ resp, security_group = self.create_security_group()
+ secgroup1 = security_group['id']
# Creating a Security Group so as to assign group_id to the rule
- s_name2 = data_utils.rand_name('securitygroup-')
- s_description2 = data_utils.rand_name('description-')
- resp, securitygroup = \
- self.client.create_security_group(s_name2, s_description2)
- secgroup2 = securitygroup['id']
- self.addCleanup(self.client.delete_security_group, secgroup2)
+ resp, security_group = self.create_security_group()
+ secgroup2 = security_group['id']
# Adding rules to the created Security Group with optional arguments
parent_group_id = secgroup1
ip_protocol = 'tcp'
@@ -92,18 +79,13 @@
self.addCleanup(self.client.delete_security_group_rule, rule['id'])
self.assertEqual(200, resp.status)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_security_group_rules_list(self):
# Positive test: Created Security Group rules should be
# in the list of all rules
# Creating a Security Group to add rules to it
- s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = \
- self.client.create_security_group(s_name, s_description)
- securitygroup_id = securitygroup['id']
- # Delete the Security Group at the end of this method
- self.addCleanup(self.client.delete_security_group, securitygroup_id)
+ resp, security_group = self.create_security_group()
+ securitygroup_id = security_group['id']
# Add a first rule to the created Security Group
ip_protocol1 = 'tcp'
@@ -135,29 +117,21 @@
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]))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_security_group_rules_delete_when_peer_group_deleted(self):
# Positive test:rule will delete when peer group deleting
# Creating a Security Group to add rules to it
- s1_name = data_utils.rand_name('securitygroup1-')
- s1_description = data_utils.rand_name('description1-')
- resp, sg1 = \
- self.client.create_security_group(s1_name, s1_description)
- self.addCleanup(self.client.delete_security_group, sg1['id'])
- self.assertEqual(200, resp.status)
+ resp, security_group = self.create_security_group()
+ sg1_id = security_group['id']
# Creating other Security Group to access to group1
- s2_name = data_utils.rand_name('securitygroup2-')
- s2_description = data_utils.rand_name('description2-')
- resp, sg2 = \
- self.client.create_security_group(s2_name, s2_description)
- self.assertEqual(200, resp.status)
- sg2_id = sg2['id']
+ resp, security_group = self.create_security_group()
+ sg2_id = security_group['id']
# Adding rules to the Group1
ip_protocol = 'tcp'
from_port = 22
to_port = 22
resp, rule = \
- self.client.create_security_group_rule(sg1['id'],
+ self.client.create_security_group_rule(sg1_id,
ip_protocol,
from_port,
to_port,
@@ -169,7 +143,7 @@
self.assertEqual(202, resp.status)
# Get rules of the Group1
resp, rules = \
- self.client.list_security_group_rules(sg1['id'])
+ self.client.list_security_group_rules(sg1_id)
# 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 4831939..680bc2f 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
@@ -19,8 +19,7 @@
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
-from tempest.test import attr
-from tempest.test import skip_because
+from tempest import test
CONF = config.CONF
@@ -33,9 +32,9 @@
super(SecurityGroupRulesNegativeTestJSON, cls).setUpClass()
cls.client = cls.security_groups_client
- @skip_because(bug="1182384",
- condition=CONF.service_available.neutron)
- @attr(type=['negative', 'smoke'])
+ @test.skip_because(bug="1182384",
+ condition=CONF.service_available.neutron)
+ @test.attr(type=['negative', 'smoke'])
def test_create_security_group_rule_with_non_existent_id(self):
# Negative test: Creation of Security Group rule should FAIL
# with non existent Parent group id
@@ -50,7 +49,7 @@
@testtools.skipIf(CONF.service_available.neutron,
"Neutron not check the security_group_id")
- @attr(type=['negative', 'smoke'])
+ @test.attr(type=['negative', 'smoke'])
def test_create_security_group_rule_with_invalid_id(self):
# Negative test: Creation of Security Group rule should FAIL
# with Parent group id which is not integer
@@ -63,21 +62,17 @@
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
- @attr(type=['negative', 'smoke'])
+ @test.attr(type=['negative', 'smoke'])
def test_create_security_group_rule_duplicate(self):
# Negative test: Create Security Group rule duplicate should fail
# Creating a Security Group to add rule to it
- s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, sg = self.client.create_security_group(s_name, s_description)
- self.assertEqual(200, resp.status)
+ resp, sg = self.create_security_group()
# Adding rules to the created Security Group
parent_group_id = sg['id']
ip_protocol = 'tcp'
from_port = 22
to_port = 22
- self.addCleanup(self.client.delete_security_group, sg['id'])
resp, rule = \
self.client.create_security_group_rule(parent_group_id,
ip_protocol,
@@ -90,86 +85,70 @@
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
- @attr(type=['negative', 'smoke'])
+ @test.attr(type=['negative', 'smoke'])
def test_create_security_group_rule_with_invalid_ip_protocol(self):
# Negative test: Creation of Security Group rule should FAIL
# with invalid ip_protocol
# Creating a Security Group to add rule to it
- s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = self.client.create_security_group(s_name,
- s_description)
+ resp, sg = self.create_security_group()
# Adding rules to the created Security Group
- parent_group_id = securitygroup['id']
+ parent_group_id = sg['id']
ip_protocol = data_utils.rand_name('999')
from_port = 22
to_port = 22
- self.addCleanup(self.client.delete_security_group, securitygroup['id'])
self.assertRaises(exceptions.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
- @attr(type=['negative', 'smoke'])
+ @test.attr(type=['negative', 'smoke'])
def test_create_security_group_rule_with_invalid_from_port(self):
# Negative test: Creation of Security Group rule should FAIL
# with invalid from_port
# Creating a Security Group to add rule to it
- s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = self.client.create_security_group(s_name,
- s_description)
+ resp, sg = self.create_security_group()
# Adding rules to the created Security Group
- parent_group_id = securitygroup['id']
+ parent_group_id = sg['id']
ip_protocol = 'tcp'
from_port = data_utils.rand_int_id(start=65536)
to_port = 22
- self.addCleanup(self.client.delete_security_group, securitygroup['id'])
self.assertRaises(exceptions.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
- @attr(type=['negative', 'smoke'])
+ @test.attr(type=['negative', 'smoke'])
def test_create_security_group_rule_with_invalid_to_port(self):
# Negative test: Creation of Security Group rule should FAIL
# with invalid to_port
# Creating a Security Group to add rule to it
- s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = self.client.create_security_group(s_name,
- s_description)
+ resp, sg = self.create_security_group()
# Adding rules to the created Security Group
- parent_group_id = securitygroup['id']
+ parent_group_id = sg['id']
ip_protocol = 'tcp'
from_port = 22
to_port = data_utils.rand_int_id(start=65536)
- self.addCleanup(self.client.delete_security_group, securitygroup['id'])
self.assertRaises(exceptions.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
- @attr(type=['negative', 'smoke'])
+ @test.attr(type=['negative', 'smoke'])
def test_create_security_group_rule_with_invalid_port_range(self):
# Negative test: Creation of Security Group rule should FAIL
# with invalid port range.
# Creating a Security Group to add rule to it.
- s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = self.client.create_security_group(s_name,
- s_description)
+ resp, sg = self.create_security_group()
# Adding a rule to the created Security Group
- secgroup_id = securitygroup['id']
+ secgroup_id = sg['id']
ip_protocol = 'tcp'
from_port = 22
to_port = 21
- self.addCleanup(self.client.delete_security_group, securitygroup['id'])
self.assertRaises(exceptions.BadRequest,
self.client.create_security_group_rule,
secgroup_id, ip_protocol, from_port, to_port)
- @skip_because(bug="1182384",
- condition=CONF.service_available.neutron)
- @attr(type=['negative', 'smoke'])
+ @test.skip_because(bug="1182384",
+ condition=CONF.service_available.neutron)
+ @test.attr(type=['negative', 'smoke'])
def test_delete_security_group_rule_with_non_existent_id(self):
# Negative test: Deletion of Security Group rule should be FAIL
# with non existent id
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 2c67581..b376edc 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -27,68 +27,43 @@
super(SecurityGroupsTestJSON, cls).setUpClass()
cls.client = cls.security_groups_client
- def _delete_security_group(self, securitygroup_id):
- resp, _ = self.client.delete_security_group(securitygroup_id)
- self.assertEqual(202, resp.status)
-
@test.attr(type='gate')
def test_security_groups_create_list_delete(self):
# Positive test:Should return the list of Security Groups
# Create 3 Security Groups
- security_group_list = list()
for i in range(3):
- s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = \
- self.client.create_security_group(s_name, s_description)
+ resp, securitygroup = self.create_security_group()
self.assertEqual(200, resp.status)
- self.addCleanup(self._delete_security_group,
- securitygroup['id'])
- security_group_list.append(securitygroup)
# Fetch all Security Groups and verify the list
# has all created Security Groups
resp, fetched_list = self.client.list_security_groups()
self.assertEqual(200, resp.status)
# 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]
+ [sg for sg in self.security_groups if sg not in fetched_list]
self.assertFalse(missing_sgs,
"Failed to find Security Group %s in fetched "
"list" % ', '.join(m_group['name']
for m_group in missing_sgs))
-
- # TODO(afazekas): scheduled for delete,
- # test_security_group_create_get_delete covers it
- @test.attr(type='gate')
- def test_security_group_create_delete(self):
- # Security Group should be created, verified and deleted
- s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = \
- self.client.create_security_group(s_name, s_description)
- self.assertIn('id', securitygroup)
- securitygroup_id = securitygroup['id']
- self.addCleanup(self._delete_security_group,
- securitygroup_id)
- self.assertEqual(200, resp.status)
- self.assertFalse(securitygroup_id is None)
- self.assertIn('name', securitygroup)
- securitygroup_name = securitygroup['name']
- self.assertEqual(securitygroup_name, s_name,
- "The created Security Group name is "
- "not equal to the requested name")
+ # Delete all security groups
+ for sg in self.security_groups:
+ resp, _ = self.client.delete_security_group(sg['id'])
+ self.assertEqual(202, resp.status)
+ self.client.wait_for_resource_deletion(sg['id'])
+ # Now check if all the created Security Groups are deleted
+ resp, fetched_list = self.client.list_security_groups()
+ deleted_sgs = \
+ [sg for sg in self.security_groups if sg in fetched_list]
+ self.assertFalse(deleted_sgs,
+ "Failed to delete Security Group %s "
+ "list" % ', '.join(m_group['name']
+ for m_group in deleted_sgs))
@test.attr(type='gate')
def test_security_group_create_get_delete(self):
# Security Group should be created, fetched and deleted
s_name = data_utils.rand_name('securitygroup-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = \
- self.client.create_security_group(s_name, s_description)
- self.addCleanup(self._delete_security_group,
- securitygroup['id'])
-
- self.assertEqual(200, resp.status)
+ resp, securitygroup = self.create_security_group(name=s_name)
self.assertIn('name', securitygroup)
securitygroup_name = securitygroup['name']
self.assertEqual(securitygroup_name, s_name,
@@ -108,15 +83,8 @@
# and not deleted if the server is active.
# Create a couple security groups that we will use
# for the server resource this test creates
- sg_name = data_utils.rand_name('sg')
- sg_desc = data_utils.rand_name('sg-desc')
- resp, sg = self.client.create_security_group(sg_name, sg_desc)
- sg_id = sg['id']
-
- sg2_name = data_utils.rand_name('sg')
- sg2_desc = data_utils.rand_name('sg-desc')
- resp, sg2 = self.client.create_security_group(sg2_name, sg2_desc)
- sg2_id = sg2['id']
+ resp, sg = self.create_security_group()
+ resp, sg2 = self.create_security_group()
# Create server and add the security group created
# above to the server we just created
@@ -125,50 +93,44 @@
server_id = server['id']
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
resp, body = self.servers_client.add_security_group(server_id,
- sg_name)
+ sg['name'])
# Check that we are not able to delete the security
# group since it is in use by an active server
self.assertRaises(exceptions.BadRequest,
self.client.delete_security_group,
- sg_id)
+ sg['id'])
# Reboot and add the other security group
resp, body = self.servers_client.reboot(server_id, 'HARD')
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
resp, body = self.servers_client.add_security_group(server_id,
- sg2_name)
+ sg2['name'])
# Check that we are not able to delete the other security
# group since it is in use by an active server
self.assertRaises(exceptions.BadRequest,
self.client.delete_security_group,
- sg2_id)
+ sg2['id'])
# 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)
- self.client.delete_security_group(sg_id)
+ self.client.delete_security_group(sg['id'])
self.assertEqual(202, resp.status)
-
- self.client.delete_security_group(sg2_id)
+ self.client.delete_security_group(sg2['id'])
self.assertEqual(202, resp.status)
@test.attr(type='gate')
def test_update_security_groups(self):
# Update security group name and description
# Create a security group
- s_name = data_utils.rand_name('sg-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = \
- self.client.create_security_group(s_name, s_description)
+ resp, securitygroup = self.create_security_group()
self.assertEqual(200, resp.status)
self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
- self.addCleanup(self._delete_security_group,
- securitygroup_id)
# Update the name and description
s_new_name = data_utils.rand_name('sg-hth-')
s_new_des = data_utils.rand_name('description-hth-')
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 ce1eada..edf38e9 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -33,10 +33,6 @@
cls.client = cls.security_groups_client
cls.neutron_available = CONF.service_available.neutron
- def _delete_security_group(self, securitygroup_id):
- resp, _ = self.client.delete_security_group(securitygroup_id)
- self.assertEqual(202, resp.status)
-
def _generate_a_non_existent_security_group_id(self):
security_group_id = []
resp, body = self.client.list_security_groups()
@@ -107,11 +103,8 @@
s_name = data_utils.rand_name('securitygroup-')
s_description = data_utils.rand_name('description-')
resp, security_group =\
- self.client.create_security_group(s_name, s_description)
+ self.create_security_group(s_name, s_description)
self.assertEqual(200, resp.status)
-
- self.addCleanup(self.client.delete_security_group,
- security_group['id'])
# Now try the Security Group with the same 'Name'
self.assertRaises(exceptions.BadRequest,
self.client.create_security_group, s_name,
@@ -163,15 +156,10 @@
@test.attr(type=['negative', 'gate'])
def test_update_security_group_with_invalid_sg_name(self):
# Update security_group with invalid sg_name should fail
- s_name = data_utils.rand_name('sg-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = \
- self.client.create_security_group(s_name, s_description)
+ resp, securitygroup = self.create_security_group()
self.assertEqual(200, resp.status)
self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
- self.addCleanup(self._delete_security_group,
- securitygroup_id)
# Update Security Group with group name longer than 255 chars
s_new_name = 'securitygroup-'.ljust(260, '0')
self.assertRaises(exceptions.BadRequest,
@@ -183,15 +171,10 @@
@test.attr(type=['negative', 'gate'])
def test_update_security_group_with_invalid_sg_des(self):
# Update security_group with invalid sg_des should fail
- s_name = data_utils.rand_name('sg-')
- s_description = data_utils.rand_name('description-')
- resp, securitygroup = \
- self.client.create_security_group(s_name, s_description)
+ resp, securitygroup = self.create_security_group()
self.assertEqual(200, resp.status)
self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
- self.addCleanup(self._delete_security_group,
- securitygroup_id)
# Update Security Group with group description longer than 255 chars
s_new_des = 'des-'.ljust(260, '0')
self.assertRaises(exceptions.BadRequest,
diff --git a/tempest/api/compute/servers/test_server_addresses.py b/tempest/api/compute/servers/test_server_addresses.py
index 8e432c4..d5528c4 100644
--- a/tempest/api/compute/servers/test_server_addresses.py
+++ b/tempest/api/compute/servers/test_server_addresses.py
@@ -14,8 +14,11 @@
# under the License.
from tempest.api.compute import base
+from tempest import config
from tempest import test
+CONF = config.CONF
+
class ServerAddressesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@@ -29,6 +32,8 @@
resp, cls.server = cls.create_test_server(wait_until='ACTIVE')
+ @test.skip_because(bug="1210483",
+ condition=CONF.service_available.neutron)
@test.attr(type='smoke')
def test_list_server_addresses(self):
# All public and private addresses for
diff --git a/tempest/api/compute/v3/admin/test_flavors.py b/tempest/api/compute/v3/admin/test_flavors.py
new file mode 100644
index 0000000..597c99b
--- /dev/null
+++ b/tempest/api/compute/v3/admin/test_flavors.py
@@ -0,0 +1,311 @@
+# Copyright 2012 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import uuid
+
+from tempest.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest import test
+
+
+class FlavorsAdminV3Test(base.BaseV3ComputeAdminTest):
+
+ """
+ Tests Flavors API Create and Delete that require admin privileges
+ """
+
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(FlavorsAdminV3Test, cls).setUpClass()
+
+ cls.client = cls.flavors_admin_client
+ cls.user_client = cls.flavors_client
+ cls.flavor_name_prefix = 'test_flavor_'
+ cls.ram = 512
+ cls.vcpus = 1
+ cls.disk = 10
+ cls.ephemeral = 10
+ cls.swap = 1024
+ cls.rxtx = 2
+
+ def flavor_clean_up(self, flavor_id):
+ resp, body = self.client.delete_flavor(flavor_id)
+ self.assertEqual(resp.status, 204)
+ self.client.wait_for_resource_deletion(flavor_id)
+
+ def _create_flavor(self, flavor_id):
+ # Create a flavor and ensure it is listed
+ # This operation requires the user to have 'admin' role
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+
+ # Create the flavor
+ resp, flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx)
+ self.addCleanup(self.flavor_clean_up, flavor['id'])
+ self.assertEqual(201, resp.status)
+ self.assertEqual(flavor['name'], flavor_name)
+ self.assertEqual(flavor['vcpus'], self.vcpus)
+ self.assertEqual(flavor['disk'], self.disk)
+ self.assertEqual(flavor['ram'], self.ram)
+ self.assertEqual(flavor['swap'], self.swap)
+ if test.is_extension_enabled("os-flavor-rxtx", "compute_v3"):
+ self.assertEqual(flavor['os-flavor-rxtx:rxtx_factor'], self.rxtx)
+ self.assertEqual(flavor['ephemeral'],
+ self.ephemeral)
+ self.assertEqual(flavor['flavor-access:is_public'], True)
+
+ # Verify flavor is retrieved
+ resp, flavor = self.client.get_flavor_details(flavor['id'])
+ self.assertEqual(resp.status, 200)
+ self.assertEqual(flavor['name'], flavor_name)
+
+ return flavor['id']
+
+ @test.attr(type='gate')
+ def test_create_flavor_with_int_id(self):
+ flavor_id = data_utils.rand_int_id(start=1000)
+ new_flavor_id = self._create_flavor(flavor_id)
+ self.assertEqual(new_flavor_id, str(flavor_id))
+
+ @test.attr(type='gate')
+ def test_create_flavor_with_uuid_id(self):
+ flavor_id = str(uuid.uuid4())
+ new_flavor_id = self._create_flavor(flavor_id)
+ self.assertEqual(new_flavor_id, flavor_id)
+
+ @test.attr(type='gate')
+ def test_create_flavor_with_none_id(self):
+ # If nova receives a request with None as flavor_id,
+ # nova generates flavor_id of uuid.
+ flavor_id = None
+ new_flavor_id = self._create_flavor(flavor_id)
+ self.assertEqual(new_flavor_id, str(uuid.UUID(new_flavor_id)))
+
+ @test.attr(type='gate')
+ def test_create_flavor_verify_entry_in_list_details(self):
+ # Create a flavor and ensure it's details are listed
+ # This operation requires the user to have 'admin' role
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = data_utils.rand_int_id(start=1000)
+
+ # Create the flavor
+ resp, flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx)
+ self.addCleanup(self.flavor_clean_up, flavor['id'])
+ flag = False
+ # Verify flavor is retrieved
+ resp, flavors = self.client.list_flavors_with_detail()
+ self.assertEqual(resp.status, 200)
+ for flavor in flavors:
+ if flavor['name'] == flavor_name:
+ flag = True
+ self.assertTrue(flag)
+
+ @test.attr(type='gate')
+ def test_create_list_flavor_without_extra_data(self):
+ # Create a flavor and ensure it is listed
+ # This operation requires the user to have 'admin' role
+
+ def verify_flavor_response_extension(flavor):
+ # check some extensions for the flavor create/show/detail response
+ self.assertEqual(flavor['swap'], 0)
+ if test.is_extension_enabled("os-flavor-rxtx", "compute_v3"):
+ self.assertEqual(int(flavor['os-flavor-rxtx:rxtx_factor']), 1)
+ self.assertEqual(int(flavor['ephemeral']), 0)
+ self.assertEqual(flavor['flavor-access:is_public'], True)
+
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = data_utils.rand_int_id(start=1000)
+
+ # Create the flavor
+ resp, flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id)
+ self.addCleanup(self.flavor_clean_up, flavor['id'])
+ self.assertEqual(201, resp.status)
+ self.assertEqual(flavor['name'], flavor_name)
+ self.assertEqual(flavor['ram'], self.ram)
+ self.assertEqual(flavor['vcpus'], self.vcpus)
+ self.assertEqual(flavor['disk'], self.disk)
+ self.assertEqual(int(flavor['id']), new_flavor_id)
+ verify_flavor_response_extension(flavor)
+
+ # Verify flavor is retrieved
+ resp, flavor = self.client.get_flavor_details(new_flavor_id)
+ self.assertEqual(resp.status, 200)
+ self.assertEqual(flavor['name'], flavor_name)
+ verify_flavor_response_extension(flavor)
+
+ # Check if flavor is present in list
+ resp, flavors = self.user_client.list_flavors_with_detail()
+ self.assertEqual(resp.status, 200)
+ for flavor in flavors:
+ if flavor['name'] == flavor_name:
+ verify_flavor_response_extension(flavor)
+ flag = True
+ self.assertTrue(flag)
+
+ @test.skip_because(bug="1209101")
+ @test.attr(type='gate')
+ def test_list_non_public_flavor(self):
+ # Create a flavor with os-flavor-access:is_public false should
+ # be present in list_details.
+ # This operation requires the user to have 'admin' role
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = data_utils.rand_int_id(start=1000)
+
+ # Create the flavor
+ resp, flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public="False")
+ self.addCleanup(self.flavor_clean_up, flavor['id'])
+ # Verify flavor is retrieved
+ flag = False
+ resp, flavors = self.client.list_flavors_with_detail()
+ self.assertEqual(resp.status, 200)
+ for flavor in flavors:
+ if flavor['name'] == flavor_name:
+ flag = True
+ self.assertTrue(flag)
+
+ # Verify flavor is not retrieved with other user
+ flag = False
+ resp, flavors = self.user_client.list_flavors_with_detail()
+ self.assertEqual(resp.status, 200)
+ for flavor in flavors:
+ if flavor['name'] == flavor_name:
+ flag = True
+ self.assertFalse(flag)
+
+ @test.attr(type='gate')
+ def test_create_server_with_non_public_flavor(self):
+ # Create a flavor with os-flavor-access:is_public false
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = data_utils.rand_int_id(start=1000)
+
+ # Create the flavor
+ resp, flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public="False")
+ self.addCleanup(self.flavor_clean_up, flavor['id'])
+ self.assertEqual(201, resp.status)
+
+ # Verify flavor is not used by other user
+ self.assertRaises(exceptions.BadRequest,
+ self.servers_client.create_server,
+ 'test', self.image_ref, flavor['id'])
+
+ @test.attr(type='gate')
+ def test_list_public_flavor_with_other_user(self):
+ # Create a Flavor with public access.
+ # Try to List/Get flavor with another user
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = data_utils.rand_int_id(start=1000)
+
+ # Create the flavor
+ resp, flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public="True")
+ self.addCleanup(self.flavor_clean_up, flavor['id'])
+ flag = False
+ self.new_client = self.flavors_client
+ # Verify flavor is retrieved with new user
+ resp, flavors = self.new_client.list_flavors_with_detail()
+ self.assertEqual(resp.status, 200)
+ for flavor in flavors:
+ if flavor['name'] == flavor_name:
+ flag = True
+ self.assertTrue(flag)
+
+ @test.attr(type='gate')
+ def test_is_public_string_variations(self):
+ flavor_id_not_public = data_utils.rand_int_id(start=1000)
+ flavor_name_not_public = data_utils.rand_name(self.flavor_name_prefix)
+ flavor_id_public = data_utils.rand_int_id(start=1000)
+ flavor_name_public = data_utils.rand_name(self.flavor_name_prefix)
+
+ # Create a non public flavor
+ resp, flavor = self.client.create_flavor(flavor_name_not_public,
+ self.ram, self.vcpus,
+ self.disk,
+ flavor_id_not_public,
+ is_public="False")
+ self.addCleanup(self.flavor_clean_up, flavor['id'])
+
+ # Create a public flavor
+ resp, flavor = self.client.create_flavor(flavor_name_public,
+ self.ram, self.vcpus,
+ self.disk,
+ flavor_id_public,
+ is_public="True")
+ self.addCleanup(self.flavor_clean_up, flavor['id'])
+
+ def _flavor_lookup(flavors, flavor_name):
+ for flavor in flavors:
+ if flavor['name'] == flavor_name:
+ return flavor
+ return None
+
+ def _test_string_variations(variations, flavor_name):
+ for string in variations:
+ params = {'is_public': string}
+ r, flavors = self.client.list_flavors_with_detail(params)
+ self.assertEqual(r.status, 200)
+ flavor = _flavor_lookup(flavors, flavor_name)
+ self.assertIsNotNone(flavor)
+
+ _test_string_variations(['f', 'false', 'no', '0'],
+ flavor_name_not_public)
+
+ _test_string_variations(['t', 'true', 'yes', '1'],
+ flavor_name_public)
+
+ @test.attr(type='gate')
+ def test_create_flavor_using_string_ram(self):
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = data_utils.rand_int_id(start=1000)
+
+ ram = " 1024 "
+ resp, flavor = self.client.create_flavor(flavor_name,
+ ram, self.vcpus,
+ self.disk,
+ new_flavor_id)
+ self.addCleanup(self.flavor_clean_up, flavor['id'])
+ self.assertEqual(201, resp.status)
+ self.assertEqual(flavor['name'], flavor_name)
+ self.assertEqual(flavor['vcpus'], self.vcpus)
+ self.assertEqual(flavor['disk'], self.disk)
+ self.assertEqual(flavor['ram'], int(ram))
+ self.assertEqual(int(flavor['id']), new_flavor_id)
diff --git a/tempest/api/compute/v3/admin/test_flavors_negative.py b/tempest/api/compute/v3/admin/test_flavors_negative.py
new file mode 100644
index 0000000..f54de79
--- /dev/null
+++ b/tempest/api/compute/v3/admin/test_flavors_negative.py
@@ -0,0 +1,335 @@
+# Copyright 2012 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import uuid
+
+from tempest.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest import test
+
+
+class FlavorsAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
+
+ """
+ Tests Flavors API Create and Delete that require admin privileges
+ """
+
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(FlavorsAdminNegativeV3Test, cls).setUpClass()
+
+ cls.client = cls.flavors_admin_client
+ cls.user_client = cls.flavors_client
+ cls.flavor_name_prefix = 'test_flavor_'
+ cls.ram = 512
+ cls.vcpus = 1
+ cls.disk = 10
+ cls.ephemeral = 10
+ cls.swap = 1024
+ cls.rxtx = 2
+
+ def flavor_clean_up(self, flavor_id):
+ resp, body = self.client.delete_flavor(flavor_id)
+ self.assertEqual(resp.status, 204)
+ self.client.wait_for_resource_deletion(flavor_id)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_get_flavor_details_for_deleted_flavor(self):
+ # Delete a flavor and ensure it is not listed
+ # Create a test flavor
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+
+ # no need to specify flavor_id, we can get the flavor_id from a
+ # response of create_flavor() call.
+ resp, flavor = self.client.create_flavor(flavor_name,
+ self.ram,
+ self.vcpus, self.disk,
+ '',
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx)
+ # Delete the flavor
+ new_flavor_id = flavor['id']
+ resp_delete, body = self.client.delete_flavor(new_flavor_id)
+ self.assertEqual(201, resp.status)
+ self.assertEqual(204, resp_delete.status)
+
+ # Deleted flavors can be seen via detailed GET
+ resp, flavor = self.client.get_flavor_details(new_flavor_id)
+ self.assertEqual(resp.status, 200)
+ self.assertEqual(flavor['name'], flavor_name)
+
+ # Deleted flavors should not show up in a list however
+ resp, flavors = self.client.list_flavors_with_detail()
+ self.assertEqual(resp.status, 200)
+ flag = True
+ for flavor in flavors:
+ if flavor['name'] == flavor_name:
+ flag = False
+ self.assertTrue(flag)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_invalid_is_public_string(self):
+ # the 'is_public' parameter can be 'none/true/false' if it exists
+ self.assertRaises(exceptions.BadRequest,
+ self.client.list_flavors_with_detail,
+ {'is_public': 'invalid'})
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_as_user(self):
+ # only admin user can create a flavor
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.Unauthorized,
+ self.user_client.create_flavor,
+ flavor_name, self.ram, self.vcpus, self.disk,
+ new_flavor_id, ephemeral=self.ephemeral,
+ swap=self.swap, rxtx=self.rxtx)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_delete_flavor_as_user(self):
+ # only admin user can delete a flavor
+ self.assertRaises(exceptions.Unauthorized,
+ self.user_client.delete_flavor,
+ self.flavor_ref_alt)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_using_invalid_ram(self):
+ # the 'ram' attribute must be positive integer
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ flavor_name, -1, self.vcpus,
+ self.disk, new_flavor_id)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_using_invalid_vcpus(self):
+ # the 'vcpu' attribute must be positive integer
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ flavor_name, self.ram, -1,
+ self.disk, new_flavor_id)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_with_name_length_less_than_1(self):
+ # ensure name length >= 1
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ '',
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx,
+ is_public='False')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_with_name_length_exceeds_255(self):
+ # ensure name do not exceed 255 characters
+ new_flavor_name = 'a' * 256
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ new_flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx,
+ is_public='False')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_with_invalid_name(self):
+ # the regex of flavor_name is '^[\w\.\- ]*$'
+ invalid_flavor_name = data_utils.rand_name('invalid-!@#$%-')
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ invalid_flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx,
+ is_public='False')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_with_invalid_flavor_id(self):
+ # the regex of flavor_id is '^[\w\.\- ]*$', and it cannot contain
+ # leading and/or trailing whitespace
+ new_flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ invalid_flavor_id = '!@#$%'
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ new_flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ invalid_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx,
+ is_public='False')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_with_id_length_exceeds_255(self):
+ # the length of flavor_id should not exceed 255 characters
+ new_flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ invalid_flavor_id = 'a' * 256
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ new_flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ invalid_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx,
+ is_public='False')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_with_invalid_root_gb(self):
+ # root_gb attribute should be non-negative ( >= 0) integer
+ new_flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ new_flavor_name,
+ self.ram, self.vcpus,
+ -1,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx,
+ is_public='False')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_with_invalid_ephemeral_gb(self):
+ # ephemeral_gb attribute should be non-negative ( >= 0) integer
+ new_flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ new_flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=-1,
+ swap=self.swap,
+ rxtx=self.rxtx,
+ is_public='False')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_with_invalid_swap(self):
+ # swap attribute should be non-negative ( >= 0) integer
+ new_flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ new_flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=-1,
+ rxtx=self.rxtx,
+ is_public='False')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_with_invalid_rxtx_factor(self):
+ # rxtx_factor attribute should be a positive float
+ new_flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ new_flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=-1.5,
+ is_public='False')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_with_invalid_is_public(self):
+ # is_public attribute should be boolean
+ new_flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_flavor,
+ new_flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx,
+ is_public='Invalid')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_flavor_already_exists(self):
+ flavor_name = data_utils.rand_name(self.flavor_name_prefix)
+ new_flavor_id = str(uuid.uuid4())
+
+ resp, flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx)
+ self.assertEqual(201, resp.status)
+ self.addCleanup(self.flavor_clean_up, flavor['id'])
+
+ self.assertRaises(exceptions.Conflict,
+ self.client.create_flavor,
+ flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_delete_nonexistent_flavor(self):
+ nonexistent_flavor_id = str(uuid.uuid4())
+
+ self.assertRaises(exceptions.NotFound,
+ self.client.delete_flavor,
+ nonexistent_flavor_id)
diff --git a/tempest/api/compute/v3/admin/test_servers.py b/tempest/api/compute/v3/admin/test_servers.py
index aaa4d7f..653eaf0 100644
--- a/tempest/api/compute/v3/admin/test_servers.py
+++ b/tempest/api/compute/v3/admin/test_servers.py
@@ -173,7 +173,7 @@
# The server in error state should be rebuilt using the provided
# image and changed to ACTIVE state
- # resetting vm state require admin priviledge
+ # resetting vm state require admin privilege
resp, server = self.client.reset_state(self.s1_id, state='error')
self.assertEqual(202, resp.status)
resp, rebuilt_server = self.non_admin_client.rebuild(
diff --git a/tempest/api/compute/v3/flavors/__init__.py b/tempest/api/compute/v3/flavors/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/api/compute/v3/flavors/__init__.py
diff --git a/tempest/api/compute/v3/flavors/test_flavors.py b/tempest/api/compute/v3/flavors/test_flavors.py
new file mode 100644
index 0000000..812358f
--- /dev/null
+++ b/tempest/api/compute/v3/flavors/test_flavors.py
@@ -0,0 +1,128 @@
+# Copyright 2012 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.compute import base
+from tempest import test
+
+
+class FlavorsV3Test(base.BaseV3ComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(FlavorsV3Test, cls).setUpClass()
+ cls.client = cls.flavors_client
+
+ @test.attr(type='smoke')
+ def test_list_flavors(self):
+ # List of all flavors should contain the expected flavor
+ resp, flavors = self.client.list_flavors()
+ resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ flavor_min_detail = {'id': flavor['id'], 'links': flavor['links'],
+ 'name': flavor['name']}
+ self.assertIn(flavor_min_detail, flavors)
+
+ @test.attr(type='smoke')
+ def test_list_flavors_with_detail(self):
+ # Detailed list of all flavors should contain the expected flavor
+ resp, flavors = self.client.list_flavors_with_detail()
+ resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ self.assertIn(flavor, flavors)
+
+ @test.attr(type='smoke')
+ def test_get_flavor(self):
+ # The expected flavor details should be returned
+ resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ self.assertEqual(self.flavor_ref, flavor['id'])
+
+ @test.attr(type='gate')
+ def test_list_flavors_limit_results(self):
+ # Only the expected number of flavors should be returned
+ params = {'limit': 1}
+ resp, flavors = self.client.list_flavors(params)
+ self.assertEqual(1, len(flavors))
+
+ @test.attr(type='gate')
+ def test_list_flavors_detailed_limit_results(self):
+ # Only the expected number of flavors (detailed) should be returned
+ params = {'limit': 1}
+ resp, flavors = self.client.list_flavors_with_detail(params)
+ self.assertEqual(1, len(flavors))
+
+ @test.attr(type='gate')
+ def test_list_flavors_using_marker(self):
+ # The list of flavors should start from the provided marker
+ resp, flavors = self.client.list_flavors()
+ flavor_id = flavors[0]['id']
+
+ params = {'marker': flavor_id}
+ resp, flavors = self.client.list_flavors(params)
+ self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]),
+ 'The list of flavors did not start after the marker.')
+
+ @test.attr(type='gate')
+ def test_list_flavors_detailed_using_marker(self):
+ # The list of flavors should start from the provided marker
+ resp, flavors = self.client.list_flavors_with_detail()
+ flavor_id = flavors[0]['id']
+
+ params = {'marker': flavor_id}
+ resp, flavors = self.client.list_flavors_with_detail(params)
+ self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]),
+ 'The list of flavors did not start after the marker.')
+
+ @test.attr(type='gate')
+ def test_list_flavors_detailed_filter_by_min_disk(self):
+ # The detailed list of flavors should be filtered by disk space
+ resp, flavors = self.client.list_flavors_with_detail()
+ flavors = sorted(flavors, key=lambda k: k['disk'])
+ flavor_id = flavors[0]['id']
+
+ params = {'min_disk': flavors[0]['disk'] + 1}
+ resp, flavors = self.client.list_flavors_with_detail(params)
+ self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
+
+ @test.attr(type='gate')
+ def test_list_flavors_detailed_filter_by_min_ram(self):
+ # The detailed list of flavors should be filtered by RAM
+ resp, flavors = self.client.list_flavors_with_detail()
+ flavors = sorted(flavors, key=lambda k: k['ram'])
+ flavor_id = flavors[0]['id']
+
+ params = {'min_ram': flavors[0]['ram'] + 1}
+ resp, flavors = self.client.list_flavors_with_detail(params)
+ self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
+
+ @test.attr(type='gate')
+ def test_list_flavors_filter_by_min_disk(self):
+ # The list of flavors should be filtered by disk space
+ resp, flavors = self.client.list_flavors_with_detail()
+ flavors = sorted(flavors, key=lambda k: k['disk'])
+ flavor_id = flavors[0]['id']
+
+ params = {'min_disk': flavors[0]['disk'] + 1}
+ resp, flavors = self.client.list_flavors(params)
+ self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
+
+ @test.attr(type='gate')
+ def test_list_flavors_filter_by_min_ram(self):
+ # The list of flavors should be filtered by RAM
+ resp, flavors = self.client.list_flavors_with_detail()
+ flavors = sorted(flavors, key=lambda k: k['ram'])
+ flavor_id = flavors[0]['id']
+
+ params = {'min_ram': flavors[0]['ram'] + 1}
+ resp, flavors = self.client.list_flavors(params)
+ self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
diff --git a/tempest/api/compute/v3/flavors/test_flavors_negative.py b/tempest/api/compute/v3/flavors/test_flavors_negative.py
new file mode 100644
index 0000000..3d4100a
--- /dev/null
+++ b/tempest/api/compute/v3/flavors/test_flavors_negative.py
@@ -0,0 +1,54 @@
+# Copyright 2013 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 testscenarios
+
+from tempest.api.compute import base
+from tempest import test
+
+
+load_tests = testscenarios.load_tests_apply_scenarios
+
+
+class FlavorsListNegativeV3Test(base.BaseV3ComputeTest,
+ test.NegativeAutoTest):
+ _interface = 'json'
+ _service = 'computev3'
+ _schema_file = 'compute/flavors/flavors_list_v3.json'
+
+ scenarios = test.NegativeAutoTest.generate_scenario(_schema_file)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_list_flavors_with_detail(self):
+ self.execute(self._schema_file)
+
+
+class FlavorDetailsNegativeV3Test(base.BaseV3ComputeTest,
+ test.NegativeAutoTest):
+ _interface = 'json'
+ _service = 'computev3'
+ _schema_file = 'compute/flavors/flavor_details_v3.json'
+
+ scenarios = test.NegativeAutoTest.generate_scenario(_schema_file)
+
+ @classmethod
+ def setUpClass(cls):
+ super(FlavorDetailsNegativeV3Test, cls).setUpClass()
+ cls.set_resource("flavor", cls.flavor_ref)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_get_flavor_details(self):
+ # flavor details are not returned for non-existent flavors
+ self.execute(self._schema_file)
diff --git a/tempest/api/compute/v3/servers/test_server_addresses.py b/tempest/api/compute/v3/servers/test_server_addresses.py
index bffa7c4..038e254 100644
--- a/tempest/api/compute/v3/servers/test_server_addresses.py
+++ b/tempest/api/compute/v3/servers/test_server_addresses.py
@@ -14,8 +14,11 @@
# under the License.
from tempest.api.compute import base
+from tempest import config
from tempest import exceptions
-from tempest.test import attr
+from tempest import test
+
+CONF = config.CONF
class ServerAddressesV3Test(base.BaseV3ComputeTest):
@@ -30,20 +33,22 @@
resp, cls.server = cls.create_test_server(wait_until='ACTIVE')
- @attr(type=['negative', 'gate'])
+ @test.attr(type=['negative', 'gate'])
def test_list_server_addresses_invalid_server_id(self):
# List addresses request should fail if server id not in system
self.assertRaises(exceptions.NotFound, self.client.list_addresses,
'999')
- @attr(type=['negative', 'gate'])
+ @test.attr(type=['negative', 'gate'])
def test_list_server_addresses_by_network_neg(self):
# List addresses by network should fail if network name not valid
self.assertRaises(exceptions.NotFound,
self.client.list_addresses_by_network,
self.server['id'], 'invalid')
- @attr(type='smoke')
+ @test.skip_because(bug="1210483",
+ condition=CONF.service_available.neutron)
+ @test.attr(type='smoke')
def test_list_server_addresses(self):
# All public and private addresses for
# a server should be returned
@@ -60,7 +65,7 @@
self.assertTrue(address['addr'])
self.assertTrue(address['version'])
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_server_addresses_by_network(self):
# Providing a network type should filter
# the addresses return by that type
diff --git a/tempest/api/compute/v3/servers/test_server_password.py b/tempest/api/compute/v3/servers/test_server_password.py
new file mode 100644
index 0000000..579a8a5
--- /dev/null
+++ b/tempest/api/compute/v3/servers/test_server_password.py
@@ -0,0 +1,38 @@
+# Copyright 2013 IBM Corporation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from tempest.api.compute import base
+from tempest import test
+
+
+class ServerPasswordV3Test(base.BaseV3ComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(ServerPasswordV3Test, cls).setUpClass()
+ cls.client = cls.servers_client
+ resp, cls.server = cls.create_test_server(wait_until="ACTIVE")
+
+ @test.attr(type='gate')
+ def test_get_server_password(self):
+ resp, body = self.client.get_password(self.server['id'])
+ self.assertEqual(200, resp.status)
+
+ @test.attr(type='gate')
+ def test_delete_server_password(self):
+ resp, body = self.client.delete_password(self.server['id'])
+ self.assertEqual(204, resp.status)
diff --git a/tempest/api/identity/admin/test_roles.py b/tempest/api/identity/admin/test_roles.py
index f1124e4..aa64969 100644
--- a/tempest/api/identity/admin/test_roles.py
+++ b/tempest/api/identity/admin/test_roles.py
@@ -18,7 +18,7 @@
from tempest.test import attr
-class RolesTestJSON(base.BaseIdentityAdminTest):
+class RolesTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/identity/admin/test_roles_negative.py b/tempest/api/identity/admin/test_roles_negative.py
index e5c04de..7a0bdea 100644
--- a/tempest/api/identity/admin/test_roles_negative.py
+++ b/tempest/api/identity/admin/test_roles_negative.py
@@ -21,7 +21,7 @@
from tempest.test import attr
-class RolesNegativeTestJSON(base.BaseIdentityAdminTest):
+class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
def _get_role_params(self):
diff --git a/tempest/api/identity/admin/test_services.py b/tempest/api/identity/admin/test_services.py
index 8ba333f..cbf6b58 100644
--- a/tempest/api/identity/admin/test_services.py
+++ b/tempest/api/identity/admin/test_services.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class ServicesTestJSON(base.BaseIdentityAdminTest):
+class ServicesTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
def _del_service(self, service_id):
diff --git a/tempest/api/identity/admin/test_tenant_negative.py b/tempest/api/identity/admin/test_tenant_negative.py
index e9eddc8..44b54b8 100644
--- a/tempest/api/identity/admin/test_tenant_negative.py
+++ b/tempest/api/identity/admin/test_tenant_negative.py
@@ -21,7 +21,7 @@
from tempest.test import attr
-class TenantsNegativeTestJSON(base.BaseIdentityAdminTest):
+class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
@attr(type=['negative', 'gate'])
diff --git a/tempest/api/identity/admin/test_tenants.py b/tempest/api/identity/admin/test_tenants.py
index 46fa7a9..c7cacb4 100644
--- a/tempest/api/identity/admin/test_tenants.py
+++ b/tempest/api/identity/admin/test_tenants.py
@@ -18,7 +18,7 @@
from tempest.test import attr
-class TenantsTestJSON(base.BaseIdentityAdminTest):
+class TenantsTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
@attr(type='gate')
diff --git a/tempest/api/identity/admin/test_tokens.py b/tempest/api/identity/admin/test_tokens.py
index 620e293..239433b 100644
--- a/tempest/api/identity/admin/test_tokens.py
+++ b/tempest/api/identity/admin/test_tokens.py
@@ -18,7 +18,7 @@
from tempest.test import attr
-class TokensTestJSON(base.BaseIdentityAdminTest):
+class TokensTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
@attr(type='gate')
diff --git a/tempest/api/identity/admin/test_users.py b/tempest/api/identity/admin/test_users.py
index 39ef947..898cccc 100644
--- a/tempest/api/identity/admin/test_users.py
+++ b/tempest/api/identity/admin/test_users.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class UsersTestJSON(base.BaseIdentityAdminTest):
+class UsersTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/identity/admin/test_users_negative.py b/tempest/api/identity/admin/test_users_negative.py
index 060f24a..1188325 100644
--- a/tempest/api/identity/admin/test_users_negative.py
+++ b/tempest/api/identity/admin/test_users_negative.py
@@ -20,7 +20,7 @@
import uuid
-class UsersNegativeTestJSON(base.BaseIdentityAdminTest):
+class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
index 753eaa6..5f22d43 100644
--- a/tempest/api/identity/admin/v3/test_credentials.py
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -18,7 +18,7 @@
from tempest.test import attr
-class CredentialsTestJSON(base.BaseIdentityAdminTest):
+class CredentialsTestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@classmethod
@@ -32,23 +32,23 @@
u_email = '%s@testmail.tm' % u_name
u_password = data_utils.rand_name('pass-')
for i in range(2):
- resp, cls.project = cls.v3_client.create_project(
+ resp, cls.project = cls.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
assert resp['status'] == '201', "Expected %s" % resp['status']
cls.projects.append(cls.project['id'])
- resp, cls.user_body = cls.v3_client.create_user(
+ resp, cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, project_id=cls.projects[0])
assert resp['status'] == '201', "Expected: %s" % resp['status']
@classmethod
def tearDownClass(cls):
- resp, _ = cls.v3_client.delete_user(cls.user_body['id'])
+ resp, _ = cls.client.delete_user(cls.user_body['id'])
assert resp['status'] == '204', "Expected: %s" % resp['status']
for p in cls.projects:
- resp, _ = cls.v3_client.delete_project(p)
+ resp, _ = cls.client.delete_project(p)
assert resp['status'] == '204', "Expected: %s" % resp['status']
super(CredentialsTestJSON, cls).tearDownClass()
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index 4017b62..086d235 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -19,14 +19,14 @@
from tempest.test import attr
-class DomainsTestJSON(base.BaseIdentityAdminTest):
+class DomainsTestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
def _delete_domain(self, domain_id):
# It is necessary to disable the domain before deleting,
# or else it would result in unauthorized error
- _, body = self.v3_client.update_domain(domain_id, enabled=False)
- resp, _ = self.v3_client.delete_domain(domain_id)
+ _, body = self.client.update_domain(domain_id, enabled=False)
+ resp, _ = self.client.delete_domain(domain_id)
self.assertEqual(204, resp.status)
@attr(type='smoke')
@@ -35,14 +35,14 @@
domain_ids = list()
fetched_ids = list()
for _ in range(3):
- _, domain = self.v3_client.create_domain(
+ _, domain = self.client.create_domain(
data_utils.rand_name('domain-'),
description=data_utils.rand_name('domain-desc-'))
# 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
- resp, body = self.v3_client.list_domains()
+ resp, body = self.client.list_domains()
self.assertEqual(resp['status'], '200')
for d in body:
fetched_ids.append(d['id'])
@@ -53,7 +53,7 @@
def test_create_update_delete_domain(self):
d_name = data_utils.rand_name('domain-')
d_desc = data_utils.rand_name('domain-desc-')
- resp_1, domain = self.v3_client.create_domain(
+ resp_1, domain = self.client.create_domain(
d_name, description=d_desc)
self.assertEqual(resp_1['status'], '201')
self.addCleanup(self._delete_domain, domain['id'])
@@ -72,7 +72,7 @@
new_desc = data_utils.rand_name('new-desc-')
new_name = data_utils.rand_name('new-name-')
- resp_2, updated_domain = self.v3_client.update_domain(
+ resp_2, updated_domain = self.client.update_domain(
domain['id'], name=new_name, description=new_desc)
self.assertEqual(resp_2['status'], '200')
self.assertIn('id', updated_domain)
@@ -85,7 +85,7 @@
self.assertEqual(new_desc, updated_domain['description'])
self.assertEqual('true', str(updated_domain['enabled']).lower())
- resp_3, fetched_domain = self.v3_client.get_domain(domain['id'])
+ resp_3, fetched_domain = self.client.get_domain(domain['id'])
self.assertEqual(resp_3['status'], '200')
self.assertEqual(new_name, fetched_domain['name'])
self.assertEqual(new_desc, fetched_domain['description'])
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 4ae7884..78ecf93 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -18,7 +18,7 @@
from tempest.test import attr
-class EndPointsTestJSON(base.BaseIdentityAdminTest):
+class EndPointsTestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@classmethod
@@ -31,8 +31,8 @@
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
resp, cls.service_data =\
- cls.identity_client.create_service(s_name, s_type,
- description=s_description)
+ cls.service_client.create_service(s_name, s_type,
+ description=s_description)
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
@@ -50,7 +50,7 @@
for e in cls.setup_endpoints:
cls.client.delete_endpoint(e['id'])
for s in cls.service_ids:
- cls.identity_client.delete_service(s)
+ cls.service_client.delete_service(s)
super(EndPointsTestJSON, cls).tearDownClass()
@attr(type='gate')
@@ -107,8 +107,8 @@
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
resp, self.service2 =\
- self.identity_client.create_service(s_name, s_type,
- description=s_description)
+ self.service_client.create_service(s_name, s_type,
+ description=s_description)
self.service_ids.append(self.service2['id'])
# Updating endpoint with new values
region2 = data_utils.rand_name('region')
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index 70afec7..6e898b2 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -18,7 +18,7 @@
from tempest import test
-class GroupsV3TestJSON(base.BaseIdentityAdminTest):
+class GroupsV3TestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@classmethod
@@ -29,23 +29,23 @@
def test_group_create_update_get(self):
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
- resp, group = self.v3_client.create_group(name,
- description=description)
- self.addCleanup(self.v3_client.delete_group, group['id'])
+ resp, group = self.client.create_group(name,
+ description=description)
+ self.addCleanup(self.client.delete_group, group['id'])
self.assertEqual(resp['status'], '201')
self.assertEqual(group['name'], name)
self.assertEqual(group['description'], description)
new_name = data_utils.rand_name('UpdateGroup')
new_desc = data_utils.rand_name('UpdateDescription')
- resp, updated_group = self.v3_client.update_group(group['id'],
- name=new_name,
- description=new_desc)
+ resp, updated_group = self.client.update_group(group['id'],
+ name=new_name,
+ description=new_desc)
self.assertEqual(resp['status'], '200')
self.assertEqual(updated_group['name'], new_name)
self.assertEqual(updated_group['description'], new_desc)
- resp, new_group = self.v3_client.get_group(group['id'])
+ resp, new_group = self.client.get_group(group['id'])
self.assertEqual(resp['status'], '200')
self.assertEqual(group['id'], new_group['id'])
self.assertEqual(new_name, new_group['name'])
@@ -54,27 +54,27 @@
@test.attr(type='smoke')
def test_group_users_add_list_delete(self):
name = data_utils.rand_name('Group')
- resp, group = self.v3_client.create_group(name)
- self.addCleanup(self.v3_client.delete_group, group['id'])
+ resp, group = self.client.create_group(name)
+ self.addCleanup(self.client.delete_group, group['id'])
# add user into group
users = []
for i in range(3):
name = data_utils.rand_name('User')
- resp, user = self.v3_client.create_user(name)
+ resp, user = self.client.create_user(name)
users.append(user)
- self.addCleanup(self.v3_client.delete_user, user['id'])
- self.v3_client.add_group_user(group['id'], user['id'])
+ self.addCleanup(self.client.delete_user, user['id'])
+ self.client.add_group_user(group['id'], user['id'])
# list users in group
- resp, group_users = self.v3_client.list_group_users(group['id'])
+ resp, group_users = self.client.list_group_users(group['id'])
self.assertEqual(resp['status'], '200')
self.assertEqual(users.sort(), group_users.sort())
# delete user in group
for user in users:
- resp, body = self.v3_client.delete_group_user(group['id'],
- user['id'])
+ resp, body = self.client.delete_group_user(group['id'],
+ user['id'])
self.assertEqual(resp['status'], '204')
- resp, group_users = self.v3_client.list_group_users(group['id'])
+ resp, group_users = self.client.list_group_users(group['id'])
self.assertEqual(len(group_users), 0)
diff --git a/tempest/api/identity/admin/v3/test_policies.py b/tempest/api/identity/admin/v3/test_policies.py
index 0e8e4c3..3e04b5f 100644
--- a/tempest/api/identity/admin/v3/test_policies.py
+++ b/tempest/api/identity/admin/v3/test_policies.py
@@ -18,7 +18,7 @@
from tempest.test import attr
-class PoliciesTestJSON(base.BaseIdentityAdminTest):
+class PoliciesTestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
def _delete_policy(self, policy_id):
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index 1fc5a6a..f309897 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -19,27 +19,27 @@
from tempest.test import attr
-class ProjectsTestJSON(base.BaseIdentityAdminTest):
+class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
def _delete_project(self, project_id):
- resp, _ = self.v3_client.delete_project(project_id)
+ resp, _ = self.client.delete_project(project_id)
self.assertEqual(resp['status'], '204')
self.assertRaises(
- exceptions.NotFound, self.v3_client.get_project, project_id)
+ exceptions.NotFound, self.client.get_project, project_id)
@attr(type='gate')
def test_project_list_delete(self):
# Create several projects and delete them
for _ in xrange(3):
- resp, project = self.v3_client.create_project(
+ resp, project = self.client.create_project(
data_utils.rand_name('project-new'))
self.addCleanup(self._delete_project, project['id'])
- resp, list_projects = self.v3_client.list_projects()
+ resp, list_projects = self.client.list_projects()
self.assertEqual(resp['status'], '200')
- resp, get_project = self.v3_client.get_project(project['id'])
+ resp, get_project = self.client.get_project(project['id'])
self.assertIn(get_project, list_projects)
@attr(type='gate')
@@ -47,16 +47,16 @@
# Create project with a description
project_name = data_utils.rand_name('project-')
project_desc = data_utils.rand_name('desc-')
- resp, project = self.v3_client.create_project(
+ resp, project = self.client.create_project(
project_name, description=project_desc)
- self.v3data.projects.append(project)
+ self.data.projects.append(project)
st1 = resp['status']
project_id = project['id']
desc1 = project['description']
self.assertEqual(st1, '201')
self.assertEqual(desc1, project_desc, 'Description should have '
'been sent in response for create')
- resp, body = self.v3_client.get_project(project_id)
+ resp, body = self.client.get_project(project_id)
desc2 = body['description']
self.assertEqual(desc2, project_desc, 'Description does not appear'
'to be set')
@@ -65,15 +65,15 @@
def test_project_create_enabled(self):
# Create a project that is enabled
project_name = data_utils.rand_name('project-')
- resp, project = self.v3_client.create_project(
+ resp, project = self.client.create_project(
project_name, enabled=True)
- self.v3data.projects.append(project)
+ self.data.projects.append(project)
project_id = project['id']
st1 = resp['status']
en1 = project['enabled']
self.assertEqual(st1, '201')
self.assertTrue(en1, 'Enable should be True in response')
- resp, body = self.v3_client.get_project(project_id)
+ resp, body = self.client.get_project(project_id)
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
@@ -81,15 +81,15 @@
def test_project_create_not_enabled(self):
# Create a project that is not enabled
project_name = data_utils.rand_name('project-')
- resp, project = self.v3_client.create_project(
+ resp, project = self.client.create_project(
project_name, enabled=False)
- self.v3data.projects.append(project)
+ self.data.projects.append(project)
st1 = resp['status']
en1 = project['enabled']
self.assertEqual(st1, '201')
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
- resp, body = self.v3_client.get_project(project['id'])
+ resp, body = self.client.get_project(project['id'])
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
@@ -98,19 +98,19 @@
def test_project_update_name(self):
# Update name attribute of a project
p_name1 = data_utils.rand_name('project-')
- resp, project = self.v3_client.create_project(p_name1)
- self.v3data.projects.append(project)
+ resp, project = self.client.create_project(p_name1)
+ self.data.projects.append(project)
resp1_name = project['name']
p_name2 = data_utils.rand_name('project2-')
- resp, body = self.v3_client.update_project(project['id'], name=p_name2)
+ resp, body = self.client.update_project(project['id'], name=p_name2)
st2 = resp['status']
resp2_name = body['name']
self.assertEqual(st2, '200')
self.assertNotEqual(resp1_name, resp2_name)
- resp, body = self.v3_client.get_project(project['id'])
+ resp, body = self.client.get_project(project['id'])
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
@@ -122,20 +122,20 @@
# Update description attribute of a project
p_name = data_utils.rand_name('project-')
p_desc = data_utils.rand_name('desc-')
- resp, project = self.v3_client.create_project(
+ resp, project = self.client.create_project(
p_name, description=p_desc)
- self.v3data.projects.append(project)
+ self.data.projects.append(project)
resp1_desc = project['description']
p_desc2 = data_utils.rand_name('desc2-')
- resp, body = self.v3_client.update_project(
+ resp, body = self.client.update_project(
project['id'], description=p_desc2)
st2 = resp['status']
resp2_desc = body['description']
self.assertEqual(st2, '200')
self.assertNotEqual(resp1_desc, resp2_desc)
- resp, body = self.v3_client.get_project(project['id'])
+ resp, body = self.client.get_project(project['id'])
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
@@ -147,20 +147,20 @@
# Update the enabled attribute of a project
p_name = data_utils.rand_name('project-')
p_en = False
- resp, project = self.v3_client.create_project(p_name, enabled=p_en)
- self.v3data.projects.append(project)
+ resp, project = self.client.create_project(p_name, enabled=p_en)
+ self.data.projects.append(project)
resp1_en = project['enabled']
p_en2 = True
- resp, body = self.v3_client.update_project(
+ resp, body = self.client.update_project(
project['id'], enabled=p_en2)
st2 = resp['status']
resp2_en = body['enabled']
self.assertEqual(st2, '200')
self.assertNotEqual(resp1_en, resp2_en)
- resp, body = self.v3_client.get_project(project['id'])
+ resp, body = self.client.get_project(project['id'])
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)
@@ -172,23 +172,23 @@
#Associate a user to a project
#Create a Project
p_name = data_utils.rand_name('project-')
- resp, project = self.v3_client.create_project(p_name)
- self.v3data.projects.append(project)
+ resp, project = self.client.create_project(p_name)
+ self.data.projects.append(project)
#Create a User
u_name = data_utils.rand_name('user-')
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = data_utils.rand_name('pass-')
- resp, user = self.v3_client.create_user(
+ resp, user = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, project_id=project['id'])
self.assertEqual(resp['status'], '201')
# Delete the User at the end of this method
- self.addCleanup(self.v3_client.delete_user, user['id'])
+ self.addCleanup(self.client.delete_user, user['id'])
# Get User To validate the user details
- resp, new_user_get = self.v3_client.get_user(user['id'])
+ resp, new_user_get = self.client.get_user(user['id'])
#Assert response body of GET
self.assertEqual(u_name, new_user_get['name'])
self.assertEqual(u_desc, new_user_get['description'])
@@ -200,53 +200,53 @@
def test_list_projects_by_unauthorized_user(self):
# Non-admin user should not be able to list projects
self.assertRaises(exceptions.Unauthorized,
- self.v3_non_admin_client.list_projects)
+ self.non_admin_client.list_projects)
@attr(type=['negative', 'gate'])
def test_project_create_duplicate(self):
# Project names should be unique
project_name = data_utils.rand_name('project-dup-')
- resp, project = self.v3_client.create_project(project_name)
- self.v3data.projects.append(project)
+ resp, project = self.client.create_project(project_name)
+ self.data.projects.append(project)
self.assertRaises(
- exceptions.Conflict, self.v3_client.create_project, project_name)
+ exceptions.Conflict, self.client.create_project, project_name)
@attr(type=['negative', 'gate'])
def test_create_project_by_unauthorized_user(self):
# Non-admin user should not be authorized to create a project
project_name = data_utils.rand_name('project-')
self.assertRaises(
- exceptions.Unauthorized, self.v3_non_admin_client.create_project,
+ exceptions.Unauthorized, self.non_admin_client.create_project,
project_name)
@attr(type=['negative', 'gate'])
def test_create_project_with_empty_name(self):
# Project name should not be empty
- self.assertRaises(exceptions.BadRequest, self.v3_client.create_project,
+ self.assertRaises(exceptions.BadRequest, self.client.create_project,
name='')
@attr(type=['negative', 'gate'])
def test_create_projects_name_length_over_64(self):
# Project name length should not be greater than 64 characters
project_name = 'a' * 65
- self.assertRaises(exceptions.BadRequest, self.v3_client.create_project,
+ self.assertRaises(exceptions.BadRequest, self.client.create_project,
project_name)
@attr(type=['negative', 'gate'])
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-')
- resp, project = self.v3_client.create_project(project_name)
- self.v3data.projects.append(project)
+ resp, project = self.client.create_project(project_name)
+ self.data.projects.append(project)
self.assertRaises(
- exceptions.Unauthorized, self.v3_non_admin_client.delete_project,
+ exceptions.Unauthorized, self.non_admin_client.delete_project,
project['id'])
@attr(type=['negative', 'gate'])
def test_delete_non_existent_project(self):
# Attempt to delete a non existent project should fail
- self.assertRaises(exceptions.NotFound, self.v3_client.delete_project,
+ self.assertRaises(exceptions.NotFound, self.client.delete_project,
'junk_Project_123456abc')
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index efaed39..467d28b 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -18,7 +18,7 @@
from tempest.test import attr
-class RolesV3TestJSON(base.BaseIdentityAdminTest):
+class RolesV3TestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@classmethod
@@ -30,20 +30,20 @@
u_email = '%s@testmail.tm' % u_name
u_password = data_utils.rand_name('pass-')
resp = [None] * 5
- resp[0], cls.project = cls.v3_client.create_project(
+ resp[0], cls.project = cls.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
- resp[1], cls.domain = cls.v3_client.create_domain(
+ resp[1], cls.domain = cls.client.create_domain(
data_utils.rand_name('domain-'),
description=data_utils.rand_name('domain-desc-'))
- resp[2], cls.group_body = cls.v3_client.create_group(
+ resp[2], cls.group_body = cls.client.create_group(
data_utils.rand_name('Group-'), project_id=cls.project['id'],
domain_id=cls.domain['id'])
- resp[3], cls.user_body = cls.v3_client.create_user(
+ resp[3], cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, project_id=cls.project['id'],
domain_id=cls.domain['id'])
- resp[4], cls.role = cls.v3_client.create_role(
+ resp[4], cls.role = cls.client.create_role(
data_utils.rand_name('Role-'))
for r in resp:
assert r['status'] == '201', "Expected: %s" % r['status']
@@ -51,14 +51,14 @@
@classmethod
def tearDownClass(cls):
resp = [None] * 5
- resp[0], _ = cls.v3_client.delete_role(cls.role['id'])
- resp[1], _ = cls.v3_client.delete_group(cls.group_body['id'])
- resp[2], _ = cls.v3_client.delete_user(cls.user_body['id'])
- resp[3], _ = cls.v3_client.delete_project(cls.project['id'])
+ resp[0], _ = cls.client.delete_role(cls.role['id'])
+ resp[1], _ = cls.client.delete_group(cls.group_body['id'])
+ resp[2], _ = cls.client.delete_user(cls.user_body['id'])
+ resp[3], _ = cls.client.delete_project(cls.project['id'])
# NOTE(harika-vakadi): It is necessary to disable the domain
# before deleting,or else it would result in unauthorized error
- cls.v3_client.update_domain(cls.domain['id'], enabled=False)
- resp[4], _ = cls.v3_client.delete_domain(cls.domain['id'])
+ cls.client.update_domain(cls.domain['id'], enabled=False)
+ resp[4], _ = cls.client.delete_domain(cls.domain['id'])
for r in resp:
assert r['status'] == '204', "Expected: %s" % r['status']
super(RolesV3TestJSON, cls).tearDownClass()
@@ -71,32 +71,32 @@
@attr(type='smoke')
def test_role_create_update_get(self):
r_name = data_utils.rand_name('Role-')
- resp, role = self.v3_client.create_role(r_name)
- self.addCleanup(self.v3_client.delete_role, role['id'])
+ resp, role = self.client.create_role(r_name)
+ self.addCleanup(self.client.delete_role, role['id'])
self.assertEqual(resp['status'], '201')
self.assertIn('name', role)
self.assertEqual(role['name'], r_name)
new_name = data_utils.rand_name('NewRole-')
- resp, updated_role = self.v3_client.update_role(new_name, role['id'])
+ resp, updated_role = self.client.update_role(new_name, role['id'])
self.assertEqual(resp['status'], '200')
self.assertIn('name', updated_role)
self.assertIn('id', updated_role)
self.assertIn('links', updated_role)
self.assertNotEqual(r_name, updated_role['name'])
- resp, new_role = self.v3_client.get_role(role['id'])
+ resp, new_role = self.client.get_role(role['id'])
self.assertEqual(resp['status'], '200')
self.assertEqual(new_name, new_role['name'])
self.assertEqual(updated_role['id'], new_role['id'])
@attr(type='smoke')
def test_grant_list_revoke_role_to_user_on_project(self):
- resp, _ = self.v3_client.assign_user_role_on_project(
+ resp, _ = self.client.assign_user_role_on_project(
self.project['id'], self.user_body['id'], self.role['id'])
self.assertEqual(resp['status'], '204')
- resp, roles = self.v3_client.list_user_roles_on_project(
+ resp, roles = self.client.list_user_roles_on_project(
self.project['id'], self.user_body['id'])
for i in roles:
@@ -105,17 +105,17 @@
self._list_assertions(resp, roles, self.fetched_role_ids,
self.role['id'])
- resp, _ = self.v3_client.revoke_role_from_user_on_project(
+ resp, _ = self.client.revoke_role_from_user_on_project(
self.project['id'], self.user_body['id'], self.role['id'])
self.assertEqual(resp['status'], '204')
@attr(type='smoke')
def test_grant_list_revoke_role_to_user_on_domain(self):
- resp, _ = self.v3_client.assign_user_role_on_domain(
+ resp, _ = self.client.assign_user_role_on_domain(
self.domain['id'], self.user_body['id'], self.role['id'])
self.assertEqual(resp['status'], '204')
- resp, roles = self.v3_client.list_user_roles_on_domain(
+ resp, roles = self.client.list_user_roles_on_domain(
self.domain['id'], self.user_body['id'])
for i in roles:
@@ -124,17 +124,17 @@
self._list_assertions(resp, roles, self.fetched_role_ids,
self.role['id'])
- resp, _ = self.v3_client.revoke_role_from_user_on_domain(
+ resp, _ = self.client.revoke_role_from_user_on_domain(
self.domain['id'], self.user_body['id'], self.role['id'])
self.assertEqual(resp['status'], '204')
@attr(type='smoke')
def test_grant_list_revoke_role_to_group_on_project(self):
- resp, _ = self.v3_client.assign_group_role_on_project(
+ resp, _ = self.client.assign_group_role_on_project(
self.project['id'], self.group_body['id'], self.role['id'])
self.assertEqual(resp['status'], '204')
- resp, roles = self.v3_client.list_group_roles_on_project(
+ resp, roles = self.client.list_group_roles_on_project(
self.project['id'], self.group_body['id'])
for i in roles:
@@ -143,17 +143,17 @@
self._list_assertions(resp, roles, self.fetched_role_ids,
self.role['id'])
- resp, _ = self.v3_client.revoke_role_from_group_on_project(
+ resp, _ = self.client.revoke_role_from_group_on_project(
self.project['id'], self.group_body['id'], self.role['id'])
self.assertEqual(resp['status'], '204')
@attr(type='smoke')
def test_grant_list_revoke_role_to_group_on_domain(self):
- resp, _ = self.v3_client.assign_group_role_on_domain(
+ resp, _ = self.client.assign_group_role_on_domain(
self.domain['id'], self.group_body['id'], self.role['id'])
self.assertEqual(resp['status'], '204')
- resp, roles = self.v3_client.list_group_roles_on_domain(
+ resp, roles = self.client.list_group_roles_on_domain(
self.domain['id'], self.group_body['id'])
for i in roles:
@@ -162,7 +162,7 @@
self._list_assertions(resp, roles, self.fetched_role_ids,
self.role['id'])
- resp, _ = self.v3_client.revoke_role_from_group_on_domain(
+ resp, _ = self.client.revoke_role_from_group_on_domain(
self.domain['id'], self.group_body['id'], self.role['id'])
self.assertEqual(resp['status'], '204')
diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py
index 4d6c22f..c5d4ddf 100644
--- a/tempest/api/identity/admin/v3/test_services.py
+++ b/tempest/api/identity/admin/v3/test_services.py
@@ -19,20 +19,20 @@
from tempest.test import attr
-class ServicesTestJSON(base.BaseIdentityAdminTest):
+class ServicesTestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@attr(type='gate')
def test_update_service(self):
# Update description attribute of service
name = data_utils.rand_name('service-')
- type = data_utils.rand_name('type--')
- description = data_utils.rand_name('description-')
- resp, body = self.client.create_service(
- name, type, description=description)
- self.assertEqual('200', resp['status'])
+ serv_type = data_utils.rand_name('type--')
+ desc = data_utils.rand_name('description-')
+ resp, body = self.service_client.create_service(name, serv_type,
+ description=desc)
+ self.assertEqual('201', resp['status'])
# Deleting the service created in this method
- self.addCleanup(self.client.delete_service, body['id'])
+ self.addCleanup(self.service_client.delete_service, body['id'])
s_id = body['id']
resp1_desc = body['description']
@@ -45,7 +45,7 @@
self.assertNotEqual(resp1_desc, resp2_desc)
# Get service
- resp, body = self.client.get_service(s_id)
+ resp, body = self.service_client.get_service(s_id)
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index d17dc4a..802113a 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -19,7 +19,7 @@
from tempest.test import attr
-class UsersTestJSON(base.BaseIdentityAdminTest):
+class UsersTestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@attr(type='smoke')
@@ -30,24 +30,24 @@
u_desc = '%s-description' % u_name
u_email = '%s@testmail.tm' % u_name
u_password = data_utils.rand_name('pass-')
- resp, user = self.v3_client.create_user(
+ resp, user = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email)
self.assertTrue(resp['status'].startswith('2'))
- self.addCleanup(self.v3_client.delete_user, user['id'])
+ self.addCleanup(self.client.delete_user, user['id'])
# Perform Authentication
- resp, body = self.v3_token.auth(user['id'], u_password)
+ resp, body = self.token.auth(user['id'], u_password)
self.assertEqual(resp['status'], '201')
subject_token = resp['x-subject-token']
# Perform GET Token
- resp, token_details = self.v3_client.get_token(subject_token)
+ resp, token_details = self.client.get_token(subject_token)
self.assertEqual(resp['status'], '200')
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
# Perform Delete Token
- resp, _ = self.v3_client.delete_token(subject_token)
- self.assertRaises(exceptions.NotFound, self.v3_client.get_token,
+ resp, _ = self.client.delete_token(subject_token)
+ self.assertRaises(exceptions.NotFound, self.client.get_token,
subject_token)
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 1bebad4..c2eef36 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -23,7 +23,7 @@
CONF = config.CONF
-class BaseTrustsV3Test(base.BaseIdentityAdminTest):
+class BaseTrustsV3Test(base.BaseIdentityV3AdminTest):
def setUp(self):
super(BaseTrustsV3Test, self).setUp()
@@ -43,7 +43,7 @@
def create_trustor_and_roles(self):
# Get trustor project ID, use the admin project
- self.trustor_project_name = self.v3_client.tenant_name
+ self.trustor_project_name = self.client.tenant_name
self.trustor_project_id = self.get_tenant_by_name(
self.trustor_project_name)['id']
self.assertIsNotNone(self.trustor_project_id)
@@ -53,7 +53,7 @@
u_desc = self.trustor_username + 'description'
u_email = self.trustor_username + '@testmail.xx'
self.trustor_password = rand_name('pass-')
- resp, user = self.v3_client.create_user(
+ resp, user = self.client.create_user(
self.trustor_username,
description=u_desc,
password=self.trustor_password,
@@ -66,24 +66,24 @@
self.delegated_role = rand_name('DelegatedRole-')
self.not_delegated_role = rand_name('NotDelegatedRole-')
- resp, role = self.v3_client.create_role(self.delegated_role)
+ resp, role = self.client.create_role(self.delegated_role)
self.assertEqual(resp['status'], '201')
self.delegated_role_id = role['id']
- resp, role = self.v3_client.create_role(self.not_delegated_role)
+ resp, role = self.client.create_role(self.not_delegated_role)
self.assertEqual(resp['status'], '201')
self.not_delegated_role_id = role['id']
# Assign roles to trustor
- self.v3_client.assign_user_role(self.trustor_project_id,
- self.trustor_user_id,
- self.delegated_role_id)
- self.v3_client.assign_user_role(self.trustor_project_id,
- self.trustor_user_id,
- self.not_delegated_role_id)
+ self.client.assign_user_role(self.trustor_project_id,
+ self.trustor_user_id,
+ self.delegated_role_id)
+ self.client.assign_user_role(self.trustor_project_id,
+ self.trustor_user_id,
+ self.not_delegated_role_id)
# Get trustee user ID, use the demo user
- trustee_username = self.v3_non_admin_client.user
+ trustee_username = self.non_admin_client.user
self.trustee_user_id = self.get_user_by_name(trustee_username)['id']
self.assertIsNotNone(self.trustee_user_id)
@@ -92,19 +92,19 @@
password=self.trustor_password,
tenant_name=self.trustor_project_name,
interface=self._interface)
- self.trustor_v3_client = os.identity_v3_client
+ self.trustor_client = os.identity_v3_client
def cleanup_user_and_roles(self):
if self.trustor_user_id:
- self.v3_client.delete_user(self.trustor_user_id)
+ self.client.delete_user(self.trustor_user_id)
if self.delegated_role_id:
- self.v3_client.delete_role(self.delegated_role_id)
+ self.client.delete_role(self.delegated_role_id)
if self.not_delegated_role_id:
- self.v3_client.delete_role(self.not_delegated_role_id)
+ self.client.delete_role(self.not_delegated_role_id)
def create_trust(self, impersonate=True, expires=None):
- resp, trust_create = self.trustor_v3_client.create_trust(
+ resp, trust_create = self.trustor_client.create_trust(
trustor_user_id=self.trustor_user_id,
trustee_user_id=self.trustee_user_id,
project_id=self.trustor_project_id,
@@ -137,7 +137,7 @@
self.assertEqual(1, len(trust['roles']))
def get_trust(self):
- resp, trust_get = self.trustor_v3_client.get_trust(self.trust_id)
+ resp, trust_get = self.trustor_client.get_trust(self.trust_id)
self.assertEqual('200', resp['status'])
return trust_get
@@ -153,37 +153,37 @@
def check_trust_roles(self):
# Check we find the delegated role
- resp, roles_get = self.trustor_v3_client.get_trust_roles(
+ resp, roles_get = self.trustor_client.get_trust_roles(
self.trust_id)
self.assertEqual('200', resp['status'])
self.assertEqual(1, len(roles_get))
self.validate_role(roles_get[0])
- resp, role_get = self.trustor_v3_client.get_trust_role(
+ resp, role_get = self.trustor_client.get_trust_role(
self.trust_id, self.delegated_role_id)
self.assertEqual('200', resp['status'])
self.validate_role(role_get)
- resp, role_get = self.trustor_v3_client.check_trust_role(
+ resp, role_get = self.trustor_client.check_trust_role(
self.trust_id, self.delegated_role_id)
self.assertEqual('204', resp['status'])
# And that we don't find not_delegated_role
self.assertRaises(exceptions.NotFound,
- self.trustor_v3_client.get_trust_role,
+ self.trustor_client.get_trust_role,
self.trust_id,
self.not_delegated_role_id)
self.assertRaises(exceptions.NotFound,
- self.trustor_v3_client.check_trust_role,
+ self.trustor_client.check_trust_role,
self.trust_id,
self.not_delegated_role_id)
def delete_trust(self):
- resp, trust_delete = self.trustor_v3_client.delete_trust(self.trust_id)
+ resp, trust_delete = self.trustor_client.delete_trust(self.trust_id)
self.assertEqual('204', resp['status'])
self.assertRaises(exceptions.NotFound,
- self.trustor_v3_client.get_trust,
+ self.trustor_client.get_trust,
self.trust_id)
self.trust_id = None
@@ -249,7 +249,7 @@
@attr(type='smoke')
def test_get_trusts_query(self):
self.create_trust()
- resp, trusts_get = self.trustor_v3_client.get_trusts(
+ resp, trusts_get = self.trustor_client.get_trusts(
trustor_user_id=self.trustor_user_id)
self.assertEqual('200', resp['status'])
self.assertEqual(1, len(trusts_get))
@@ -258,7 +258,7 @@
@attr(type='smoke')
def test_get_trusts_all(self):
self.create_trust()
- resp, trusts_get = self.v3_client.get_trusts()
+ resp, trusts_get = self.client.get_trusts()
self.assertEqual('200', resp['status'])
trusts = [t for t in trusts_get
if t['id'] == self.trust_id]
diff --git a/tempest/api/identity/admin/v3/test_users.py b/tempest/api/identity/admin/v3/test_users.py
index 7cae856..a78d542 100644
--- a/tempest/api/identity/admin/v3/test_users.py
+++ b/tempest/api/identity/admin/v3/test_users.py
@@ -18,7 +18,7 @@
from tempest.test import attr
-class UsersV3TestJSON(base.BaseIdentityAdminTest):
+class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@attr(type='gate')
@@ -29,22 +29,22 @@
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = data_utils.rand_name('pass-')
- resp, user = self.v3_client.create_user(
+ resp, user = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, enabled=False)
# Delete the User at the end of this method
- self.addCleanup(self.v3_client.delete_user, user['id'])
+ self.addCleanup(self.client.delete_user, user['id'])
# Creating second project for updation
- resp, project = self.v3_client.create_project(
+ resp, project = self.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
# Delete the Project at the end of this method
- self.addCleanup(self.v3_client.delete_project, project['id'])
+ self.addCleanup(self.client.delete_project, project['id'])
# Updating user details with new values
u_name2 = data_utils.rand_name('user2-')
u_email2 = u_name2 + '@testmail.tm'
u_description2 = u_name2 + ' description'
- resp, update_user = self.v3_client.update_user(
+ resp, update_user = self.client.update_user(
user['id'], name=u_name2, description=u_description2,
project_id=project['id'],
email=u_email2, enabled=False)
@@ -57,7 +57,7 @@
self.assertEqual(u_email2, update_user['email'])
self.assertEqual('false', str(update_user['enabled']).lower())
# GET by id after updation
- resp, new_user_get = self.v3_client.get_user(user['id'])
+ resp, new_user_get = self.client.get_user(user['id'])
# Assert response body of GET after updation
self.assertEqual(u_name2, new_user_get['name'])
self.assertEqual(u_description2, new_user_get['description'])
@@ -71,43 +71,43 @@
# List the projects that a user has access upon
assigned_project_ids = list()
fetched_project_ids = list()
- _, u_project = self.v3_client.create_project(
+ _, u_project = self.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
# Delete the Project at the end of this method
- self.addCleanup(self.v3_client.delete_project, u_project['id'])
+ self.addCleanup(self.client.delete_project, u_project['id'])
# Create a user.
u_name = data_utils.rand_name('user-')
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = data_utils.rand_name('pass-')
- _, user_body = self.v3_client.create_user(
+ _, user_body = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, enabled=False, project_id=u_project['id'])
# Delete the User at the end of this method
- self.addCleanup(self.v3_client.delete_user, user_body['id'])
+ self.addCleanup(self.client.delete_user, user_body['id'])
# Creating Role
- _, role_body = self.v3_client.create_role(
+ _, role_body = self.client.create_role(
data_utils.rand_name('role-'))
# Delete the Role at the end of this method
- self.addCleanup(self.v3_client.delete_role, role_body['id'])
+ self.addCleanup(self.client.delete_role, role_body['id'])
- _, user = self.v3_client.get_user(user_body['id'])
- _, role = self.v3_client.get_role(role_body['id'])
+ _, user = self.client.get_user(user_body['id'])
+ _, role = self.client.get_role(role_body['id'])
for i in range(2):
# Creating project so as to assign role
- _, project_body = self.v3_client.create_project(
+ _, project_body = self.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
- _, project = self.v3_client.get_project(project_body['id'])
+ _, project = self.client.get_project(project_body['id'])
# Delete the Project at the end of this method
- self.addCleanup(self.v3_client.delete_project, project_body['id'])
+ self.addCleanup(self.client.delete_project, project_body['id'])
# Assigning roles to user on project
- self.v3_client.assign_user_role(project['id'],
- user['id'],
- role['id'])
+ self.client.assign_user_role(project['id'],
+ user['id'],
+ role['id'])
assigned_project_ids.append(project['id'])
- resp, body = self.v3_client.list_user_projects(user['id'])
+ resp, body = self.client.list_user_projects(user['id'])
self.assertEqual(200, resp.status)
for i in body:
fetched_project_ids.append(i['id'])
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index a3fc65a..10f5217 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -16,67 +16,98 @@
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
import tempest.test
+CONF = config.CONF
+
class BaseIdentityAdminTest(tempest.test.BaseTestCase):
@classmethod
def setUpClass(cls):
super(BaseIdentityAdminTest, cls).setUpClass()
- os = clients.AdminManager(interface=cls._interface)
- cls.client = os.identity_client
- cls.token_client = os.token_client
- cls.endpoints_client = os.endpoints_client
- cls.v3_client = os.identity_v3_client
- cls.service_client = os.service_client
- cls.policy_client = os.policy_client
- cls.v3_token = os.token_v3_client
- cls.creds_client = os.credentials_client
-
- if not cls.client.has_admin_extensions():
- raise cls.skipException("Admin extensions disabled")
-
- cls.data = DataGenerator(cls.client)
- cls.v3data = DataGenerator(cls.v3_client)
-
- os = clients.Manager(interface=cls._interface)
- cls.non_admin_client = os.identity_client
- cls.v3_non_admin_client = os.identity_v3_client
+ cls.os_adm = clients.AdminManager(interface=cls._interface)
+ cls.os = clients.Manager(interface=cls._interface)
@classmethod
- def tearDownClass(cls):
- cls.data.teardown_all()
- cls.v3data.teardown_all()
- super(BaseIdentityAdminTest, cls).tearDownClass()
+ def disable_user(cls, user_name):
+ user = cls.get_user_by_name(user_name)
+ cls.client.enable_disable_user(user['id'], False)
- def disable_user(self, user_name):
- user = self.get_user_by_name(user_name)
- self.client.enable_disable_user(user['id'], False)
+ @classmethod
+ def disable_tenant(cls, tenant_name):
+ tenant = cls.get_tenant_by_name(tenant_name)
+ cls.client.update_tenant(tenant['id'], enabled=False)
- def disable_tenant(self, tenant_name):
- tenant = self.get_tenant_by_name(tenant_name)
- self.client.update_tenant(tenant['id'], enabled=False)
-
- def get_user_by_name(self, name):
- _, users = self.client.get_users()
+ @classmethod
+ def get_user_by_name(cls, name):
+ _, users = cls.client.get_users()
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]
- def get_tenant_by_name(self, name):
- _, tenants = self.client.list_tenants()
+ @classmethod
+ def get_tenant_by_name(cls, name):
+ try:
+ _, tenants = cls.client.list_tenants()
+ except AttributeError:
+ _, tenants = cls.client.list_projects()
tenant = [t for t in tenants if t['name'] == name]
if len(tenant) > 0:
return tenant[0]
- def get_role_by_name(self, name):
- _, roles = self.client.list_roles()
+ @classmethod
+ def get_role_by_name(cls, name):
+ _, roles = cls.client.list_roles()
role = [r for r in roles if r['name'] == name]
if len(role) > 0:
return role[0]
+class BaseIdentityV2AdminTest(BaseIdentityAdminTest):
+
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.identity_feature_enabled.api_v2:
+ raise cls.skipException("Identity api v2 is not enabled")
+ super(BaseIdentityV2AdminTest, cls).setUpClass()
+ cls.client = cls.os_adm.identity_client
+ cls.token_client = cls.os_adm.token_client
+ if not cls.client.has_admin_extensions():
+ raise cls.skipException("Admin extensions disabled")
+ cls.data = DataGenerator(cls.client)
+ cls.non_admin_client = cls.os.identity_client
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.data.teardown_all()
+ super(BaseIdentityV2AdminTest, cls).tearDownClass()
+
+
+class BaseIdentityV3AdminTest(BaseIdentityAdminTest):
+
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.identity_feature_enabled.api_v3:
+ raise cls.skipException("Identity api v3 is not enabled")
+ super(BaseIdentityV3AdminTest, cls).setUpClass()
+ cls.client = cls.os_adm.identity_v3_client
+ cls.token = cls.os_adm.token_v3_client
+ cls.endpoints_client = cls.os_adm.endpoints_client
+ cls.data = DataGenerator(cls.client)
+ cls.non_admin_client = cls.os.identity_v3_client
+ cls.service_client = cls.os_adm.service_client
+ cls.policy_client = cls.os_adm.policy_client
+ cls.creds_client = cls.os_adm.credentials_client
+ cls.non_admin_client = cls.os.identity_v3_client
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.data.teardown_all()
+ super(BaseIdentityV3AdminTest, cls).tearDownClass()
+
+
class DataGenerator(object):
def __init__(self, client):
diff --git a/tempest/api/network/admin/test_lbaas_agent_scheduler.py b/tempest/api/network/admin/test_lbaas_agent_scheduler.py
new file mode 100644
index 0000000..a5ba90f
--- /dev/null
+++ b/tempest/api/network/admin/test_lbaas_agent_scheduler.py
@@ -0,0 +1,78 @@
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.network import base
+from tempest.common.utils import data_utils
+from tempest import test
+
+
+class LBaaSAgentSchedulerTestJSON(base.BaseAdminNetworkTest):
+ _interface = 'json'
+
+ """
+ Tests the following operations in the Neutron API using the REST client for
+ Neutron:
+
+ List pools the given LBaaS agent is hosting.
+ Show a LBaaS agent hosting the given pool.
+
+ v2.0 of the Neutron API is assumed. It is also assumed that the following
+ options are defined in the [networki-feature-enabled] section of
+ etc/tempest.conf:
+
+ api_extensions
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ super(LBaaSAgentSchedulerTestJSON, cls).setUpClass()
+ if not test.is_extension_enabled('lbaas_agent_scheduler', 'network'):
+ msg = "LBaaS Agent Scheduler Extension not enabled."
+ raise cls.skipException(msg)
+ cls.network = cls.create_network()
+ cls.subnet = cls.create_subnet(cls.network)
+ pool_name = data_utils.rand_name('pool-')
+ cls.pool = cls.create_pool(pool_name, "ROUND_ROBIN",
+ "HTTP", cls.subnet)
+
+ @test.attr(type='smoke')
+ def test_list_pools_on_lbaas_agent(self):
+ found = False
+ resp, body = self.admin_client.list_agents(
+ agent_type="Loadbalancer agent")
+ self.assertEqual('200', resp['status'])
+ agents = body['agents']
+ for a in agents:
+ msg = 'Load Balancer agent expected'
+ self.assertEqual(a['agent_type'], 'Loadbalancer agent', msg)
+ resp, body = (
+ self.admin_client.list_pools_hosted_by_one_lbaas_agent(
+ a['id']))
+ self.assertEqual('200', resp['status'])
+ pools = body['pools']
+ if self.pool['id'] in [p['id'] for p in pools]:
+ found = True
+ msg = 'Unable to find Load Balancer agent hosting pool'
+ self.assertTrue(found, msg)
+
+ @test.attr(type='smoke')
+ def test_show_lbaas_agent_hosting_pool(self):
+ resp, body = self.admin_client.show_lbaas_agent_hosting_pool(
+ self.pool['id'])
+ self.assertEqual('200', resp['status'])
+ self.assertEqual('Loadbalancer agent', body['agent']['agent_type'])
+
+
+class LBaaSAgentSchedulerTestXML(LBaaSAgentSchedulerTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 4cbb7be..dd888a6 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -228,13 +228,22 @@
@classmethod
def create_vip(cls, name, protocol, protocol_port, subnet, pool):
"""Wrapper utility that returns a test vip."""
- resp, body = cls.client.create_vip(name, protocol, protocol_port,
- subnet['id'], pool['id'])
+ resp, body = cls.client.create_vip(name=name,
+ protocol=protocol,
+ protocol_port=protocol_port,
+ subnet_id=subnet['id'],
+ pool_id=pool['id'])
vip = body['vip']
cls.vips.append(vip)
return vip
@classmethod
+ def update_vip(cls, name):
+ resp, body = cls.client.update_vip(name=name)
+ vip = body['vip']
+ return vip
+
+ @classmethod
def create_member(cls, protocol_port, pool):
"""Wrapper utility that returns a test member."""
resp, body = cls.client.create_member("10.0.9.46",
@@ -247,14 +256,21 @@
@classmethod
def create_health_monitor(cls, delay, max_retries, Type, timeout):
"""Wrapper utility that returns a test health monitor."""
- resp, body = cls.client.create_health_monitor(delay,
- max_retries,
- Type, timeout)
+ resp, body = cls.client.create_health_monitor(delay=delay,
+ max_retries=max_retries,
+ type=Type,
+ timeout=timeout)
health_monitor = body['health_monitor']
cls.health_monitors.append(health_monitor)
return health_monitor
@classmethod
+ def update_health_monitor(cls, admin_state_up):
+ resp, body = cls.client.update_vip(admin_state_up=admin_state_up)
+ health_monitor = body['health_monitor']
+ return health_monitor
+
+ @classmethod
def create_router_interface(cls, router_id, subnet_id):
"""Wrapper utility that returns a router interface."""
resp, interface = cls.client.add_router_interface_with_subnet_id(
diff --git a/tempest/api/network/test_load_balancer.py b/tempest/api/network/test_load_balancer.py
index d5f2b5b..53541ed 100644
--- a/tempest/api/network/test_load_balancer.py
+++ b/tempest/api/network/test_load_balancer.py
@@ -50,9 +50,16 @@
vip_name = data_utils.rand_name('vip-')
cls.pool = cls.create_pool(pool_name, "ROUND_ROBIN",
"HTTP", cls.subnet)
- cls.vip = cls.create_vip(vip_name, "HTTP", 80, cls.subnet, cls.pool)
+ cls.vip = cls.create_vip(name=vip_name,
+ protocol="HTTP",
+ protocol_port=80,
+ subnet=cls.subnet,
+ pool=cls.pool)
cls.member = cls.create_member(80, cls.pool)
- cls.health_monitor = cls.create_health_monitor(4, 3, "TCP", 1)
+ cls.health_monitor = cls.create_health_monitor(delay=4,
+ max_retries=3,
+ Type="TCP",
+ timeout=1)
@test.attr(type='smoke')
def test_list_vips(self):
@@ -76,14 +83,17 @@
protocol='HTTP',
subnet_id=self.subnet['id'])
pool = body['pool']
- resp, body = self.client.create_vip(name, "HTTP", 80,
- self.subnet['id'], pool['id'])
+ resp, body = self.client.create_vip(name=name,
+ protocol="HTTP",
+ protocol_port=80,
+ subnet_id=self.subnet['id'],
+ pool_id=pool['id'])
self.assertEqual('201', resp['status'])
vip = body['vip']
vip_id = vip['id']
# Verification of vip update
new_name = "New_vip"
- resp, body = self.client.update_vip(vip_id, new_name)
+ resp, body = self.client.update_vip(vip_id, name=new_name)
self.assertEqual('200', resp['status'])
updated_vip = body['vip']
self.assertEqual(updated_vip['name'], new_name)
@@ -143,11 +153,10 @@
self.assertEqual('201', resp['status'])
member = body['member']
# Verification of member update
- admin_state = [False, 'False']
- resp, body = self.client.update_member(admin_state[0], member['id'])
+ resp, body = self.client.update_member(False, member['id'])
self.assertEqual('200', resp['status'])
updated_member = body['member']
- self.assertIn(updated_member['admin_state_up'], admin_state)
+ self.assertFalse(updated_member['admin_state_up'])
# Verification of member delete
resp, body = self.client.delete_member(member['id'])
self.assertEqual('204', resp['status'])
@@ -174,16 +183,19 @@
@test.attr(type='smoke')
def test_create_update_delete_health_monitor(self):
# Creates a health_monitor
- resp, body = self.client.create_health_monitor(4, 3, "TCP", 1)
+ resp, body = self.client.create_health_monitor(delay=4,
+ max_retries=3,
+ type="TCP",
+ timeout=1)
self.assertEqual('201', resp['status'])
health_monitor = body['health_monitor']
# Verification of health_monitor update
- admin_state = [False, 'False']
- resp, body = self.client.update_health_monitor(admin_state[0],
- health_monitor['id'])
+ resp, body = (self.client.update_health_monitor
+ (health_monitor['id'],
+ admin_state_up=False))
self.assertEqual('200', resp['status'])
updated_health_monitor = body['health_monitor']
- self.assertIn(updated_health_monitor['admin_state_up'], admin_state)
+ self.assertFalse(updated_health_monitor['admin_state_up'])
# Verification of health_monitor delete
resp, body = self.client.delete_health_monitor(health_monitor['id'])
self.assertEqual('204', resp['status'])
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index 4cc007f..9029b1f 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -266,6 +266,28 @@
self.assertIsNotNone(found, "Port list doesn't contain created port")
@attr(type='smoke')
+ def test_port_list_filter_by_router_id(self):
+ # Create a router
+ network = self.create_network()
+ self.create_subnet(network)
+ router = self.create_router(data_utils.rand_name('router-'))
+ resp, port = self.client.create_port(
+ network_id=network['id'])
+ # Add router interface to port created above
+ resp, interface = self.client.add_router_interface_with_port_id(
+ router['id'], port['port']['id'])
+ self.addCleanup(self.client.remove_router_interface_with_port_id,
+ router['id'], port['port']['id'])
+ # list ports filtered by router_id
+ resp, port_list = self.client.list_ports(
+ device_id=router['id'])
+ self.assertEqual('200', resp['status'])
+ # Verify if only corresponding port is listed and assert router_id
+ self.assertEqual(len(port_list['ports']), 1)
+ self.assertEqual(port['port']['id'], port_list['ports'][0]['id'])
+ self.assertEqual(router['id'], port_list['ports'][0]['device_id'])
+
+ @attr(type='smoke')
def test_list_ports_fields(self):
# Verify listing some fields of the ports
resp, body = self.client.list_ports(fields='id')
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index ef36c3d..d08dc34 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -14,7 +14,7 @@
# under the License.
-from tempest.api.identity.base import DataGenerator
+from tempest.api.identity import base
from tempest import clients
from tempest.common import custom_matchers
from tempest.common import isolated_creds
@@ -83,7 +83,7 @@
cls.object_client_alt.auth_provider.clear_auth()
cls.container_client_alt.auth_provider.clear_auth()
- cls.data = DataGenerator(cls.identity_admin_client)
+ cls.data = base.DataGenerator(cls.identity_admin_client)
@classmethod
def tearDownClass(cls):
diff --git a/tempest/api/object_storage/test_account_services.py b/tempest/api/object_storage/test_account_services.py
index 79fd99d..5456768 100644
--- a/tempest/api/object_storage/test_account_services.py
+++ b/tempest/api/object_storage/test_account_services.py
@@ -18,8 +18,7 @@
from tempest.api.object_storage import base
from tempest.common import custom_matchers
from tempest.common.utils import data_utils
-from tempest.test import attr
-from tempest.test import HTTP_SUCCESS
+from tempest import test
class AccountTest(base.BaseObjectTest):
@@ -38,7 +37,7 @@
cls.delete_containers(cls.containers)
super(AccountTest, cls).tearDownClass()
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_containers(self):
# list of all containers should not be empty
params = {'format': 'json'}
@@ -51,14 +50,14 @@
for container_name in self.containers:
self.assertIn(container_name, container_names)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_extensions(self):
resp, extensions = self.account_client.list_extensions()
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertThat(resp, custom_matchers.AreAllWellFormatted())
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_containers_with_limit(self):
# list containers one of them, half of them then all of them
for limit in (1, self.containers_count / 2, self.containers_count):
@@ -69,7 +68,7 @@
self.assertEqual(len(container_list), limit)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_containers_with_marker(self):
# list containers using marker param
# first expect to get 0 container as we specified last
@@ -89,7 +88,7 @@
self.assertEqual(len(container_list), self.containers_count / 2 - 1)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_containers_with_end_marker(self):
# list containers using end_marker param
# first expect to get 0 container as we specified first container as
@@ -107,7 +106,7 @@
self.assertHeaders(resp, 'Account', 'GET')
self.assertEqual(len(container_list), self.containers_count / 2)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_containers_with_limit_and_marker(self):
# list containers combining marker and limit param
# result are always limitated by the limit whatever the marker
@@ -121,21 +120,21 @@
self.assertTrue(len(container_list) <= limit, str(container_list))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_account_metadata(self):
# list all account metadata
resp, metadata = self.account_client.list_account_metadata()
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Account', 'HEAD')
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_and_delete_account_metadata(self):
header = 'test-account-meta'
data = 'Meta!'
# add metadata to account
resp, _ = self.account_client.create_account_metadata(
metadata={header: data})
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Account', 'POST')
resp, _ = self.account_client.list_account_metadata()
@@ -147,7 +146,7 @@
# delete metadata from account
resp, _ = \
self.account_client.delete_account_metadata(metadata=[header])
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Account', 'POST')
resp, _ = self.account_client.list_account_metadata()
diff --git a/tempest/api/object_storage/test_container_acl.py b/tempest/api/object_storage/test_container_acl.py
index aae6b4d..085ef51 100644
--- a/tempest/api/object_storage/test_container_acl.py
+++ b/tempest/api/object_storage/test_container_acl.py
@@ -16,8 +16,7 @@
from tempest.api.object_storage import base
from tempest import clients
from tempest.common.utils import data_utils
-from tempest.test import attr
-from tempest.test import HTTP_SUCCESS
+from tempest import test
class ObjectTestACLs(base.BaseObjectTest):
@@ -44,7 +43,7 @@
self.delete_containers([self.container_name])
super(ObjectTestACLs, self).tearDown()
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_read_object_with_rights(self):
# attempt to read object using authorized user
# update X-Container-Read metadata ACL
@@ -53,7 +52,7 @@
resp_meta, body = self.container_client.update_container_metadata(
self.container_name, metadata=cont_headers,
metadata_prefix='')
- self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp_meta['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp_meta, 'Container', 'POST')
# create object
object_name = data_utils.rand_name(name='Object')
@@ -68,10 +67,10 @@
)
resp, _ = self.custom_object_client.get_object(
self.container_name, object_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Object', 'GET')
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_write_object_with_rights(self):
# attempt to write object using authorized user
# update X-Container-Write metadata ACL
@@ -80,7 +79,7 @@
resp_meta, body = self.container_client.update_container_metadata(
self.container_name, metadata=cont_headers,
metadata_prefix='')
- self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp_meta['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp_meta, 'Container', 'POST')
# Trying to write the object with rights
self.custom_object_client.auth_provider.set_alt_auth_data(
@@ -91,5 +90,5 @@
resp, _ = self.custom_object_client.create_object(
self.container_name,
object_name, 'data')
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Object', 'PUT')
diff --git a/tempest/api/object_storage/test_container_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py
index 1dc9bb5..a5a0950 100644
--- a/tempest/api/object_storage/test_container_acl_negative.py
+++ b/tempest/api/object_storage/test_container_acl_negative.py
@@ -18,8 +18,7 @@
from tempest import clients
from tempest.common.utils import data_utils
from tempest import exceptions
-from tempest.test import attr
-from tempest.test import HTTP_SUCCESS
+from tempest import test
class ObjectACLsNegativeTest(base.BaseObjectTest):
@@ -46,7 +45,7 @@
self.delete_containers([self.container_name])
super(ObjectACLsNegativeTest, self).tearDown()
- @attr(type=['negative', 'gate'])
+ @test.attr(type=['negative', 'gate'])
def test_write_object_without_using_creds(self):
# trying to create object with empty headers
# X-Auth-Token is not provided
@@ -59,7 +58,7 @@
self.custom_object_client.create_object,
self.container_name, object_name, 'data')
- @attr(type=['negative', 'gate'])
+ @test.attr(type=['negative', 'gate'])
def test_delete_object_without_using_creds(self):
# create object
object_name = data_utils.rand_name(name='Object')
@@ -75,7 +74,7 @@
self.custom_object_client.delete_object,
self.container_name, object_name)
- @attr(type=['negative', 'gate'])
+ @test.attr(type=['negative', 'gate'])
def test_write_object_with_non_authorized_user(self):
# attempt to upload another file using non-authorized user
# User provided token is forbidden. ACL are not set
@@ -89,7 +88,7 @@
self.custom_object_client.create_object,
self.container_name, object_name, 'data')
- @attr(type=['negative', 'gate'])
+ @test.attr(type=['negative', 'gate'])
def test_read_object_with_non_authorized_user(self):
# attempt to read object using non-authorized user
# User provided token is forbidden. ACL are not set
@@ -107,7 +106,7 @@
self.custom_object_client.get_object,
self.container_name, object_name)
- @attr(type=['negative', 'gate'])
+ @test.attr(type=['negative', 'gate'])
def test_delete_object_with_non_authorized_user(self):
# attempt to delete object using non-authorized user
# User provided token is forbidden. ACL are not set
@@ -125,7 +124,7 @@
self.custom_object_client.delete_object,
self.container_name, object_name)
- @attr(type=['negative', 'smoke'])
+ @test.attr(type=['negative', 'smoke'])
def test_read_object_without_rights(self):
# attempt to read object using non-authorized user
# update X-Container-Read metadata ACL
@@ -133,7 +132,7 @@
resp_meta, body = self.container_client.update_container_metadata(
self.container_name, metadata=cont_headers,
metadata_prefix='')
- self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp_meta['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp_meta, 'Container', 'POST')
# create object
object_name = data_utils.rand_name(name='Object')
@@ -150,7 +149,7 @@
self.custom_object_client.get_object,
self.container_name, object_name)
- @attr(type=['negative', 'smoke'])
+ @test.attr(type=['negative', 'smoke'])
def test_write_object_without_rights(self):
# attempt to write object using non-authorized user
# update X-Container-Write metadata ACL
@@ -158,7 +157,7 @@
resp_meta, body = self.container_client.update_container_metadata(
self.container_name, metadata=cont_headers,
metadata_prefix='')
- self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp_meta['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp_meta, 'Container', 'POST')
# Trying to write the object without rights
self.custom_object_client.auth_provider.set_alt_auth_data(
@@ -171,7 +170,7 @@
self.container_name,
object_name, 'data')
- @attr(type=['negative', 'smoke'])
+ @test.attr(type=['negative', 'smoke'])
def test_write_object_without_write_rights(self):
# attempt to write object using non-authorized user
# update X-Container-Read and X-Container-Write metadata ACL
@@ -181,7 +180,7 @@
resp_meta, body = self.container_client.update_container_metadata(
self.container_name, metadata=cont_headers,
metadata_prefix='')
- self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp_meta['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp_meta, 'Container', 'POST')
# Trying to write the object without write rights
self.custom_object_client.auth_provider.set_alt_auth_data(
@@ -194,7 +193,7 @@
self.container_name,
object_name, 'data')
- @attr(type=['negative', 'smoke'])
+ @test.attr(type=['negative', 'smoke'])
def test_delete_object_without_write_rights(self):
# attempt to delete object using non-authorized user
# update X-Container-Read and X-Container-Write metadata ACL
@@ -204,7 +203,7 @@
resp_meta, body = self.container_client.update_container_metadata(
self.container_name, metadata=cont_headers,
metadata_prefix='')
- self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp_meta['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp_meta, 'Container', 'POST')
# create object
object_name = data_utils.rand_name(name='Object')
diff --git a/tempest/api/object_storage/test_container_services.py b/tempest/api/object_storage/test_container_services.py
index 84cc91e..8689d10 100644
--- a/tempest/api/object_storage/test_container_services.py
+++ b/tempest/api/object_storage/test_container_services.py
@@ -15,8 +15,7 @@
from tempest.api.object_storage import base
from tempest.common.utils import data_utils
-from tempest.test import attr
-from tempest.test import HTTP_SUCCESS
+from tempest import test
class ContainerTest(base.BaseObjectTest):
@@ -47,7 +46,7 @@
return object_name
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_container(self):
container_name = data_utils.rand_name(name='TestContainer')
resp, body = self.container_client.create_container(container_name)
@@ -55,7 +54,7 @@
self.assertIn(resp['status'], ('202', '201'))
self.assertHeaders(resp, 'Container', 'PUT')
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_container_overwrite(self):
# overwrite container with the same name
container_name = data_utils.rand_name(name='TestContainer')
@@ -66,7 +65,7 @@
self.assertIn(resp['status'], ('202', '201'))
self.assertHeaders(resp, 'Container', 'PUT')
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_container_with_metadata_key(self):
# create container with the blank value of metadata
container_name = data_utils.rand_name(name='TestContainer')
@@ -84,7 +83,7 @@
# in the server
self.assertNotIn('x-container-meta-test-container-meta', resp)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_container_with_metadata_value(self):
# create container with metadata value
container_name = data_utils.rand_name(name='TestContainer')
@@ -103,7 +102,7 @@
self.assertEqual(resp['x-container-meta-test-container-meta'],
metadata['test-container-meta'])
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_container_with_remove_metadata_key(self):
# create container with the blank value of remove metadata
container_name = data_utils.rand_name(name='TestContainer')
@@ -124,7 +123,7 @@
container_name)
self.assertNotIn('x-container-meta-test-container-meta', resp)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_container_with_remove_metadata_value(self):
# create container with remove metadata
container_name = data_utils.rand_name(name='TestContainer')
@@ -143,18 +142,18 @@
container_name)
self.assertNotIn('x-container-meta-test-container-meta', resp)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_delete_container(self):
# create a container
container_name = self._create_container()
# delete container
resp, _ = self.container_client.delete_container(container_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'DELETE')
self.containers.remove(container_name)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_contents(self):
# get container contents list
container_name = self._create_container()
@@ -162,22 +161,22 @@
resp, object_list = self.container_client.list_container_contents(
container_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_contents_with_no_object(self):
# get empty container contents list
container_name = self._create_container()
resp, object_list = self.container_client.list_container_contents(
container_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual('', object_list.strip('\n'))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_contents_with_delimiter(self):
# get container contents list using delimiter param
container_name = self._create_container()
@@ -188,11 +187,11 @@
resp, object_list = self.container_client.list_container_contents(
container_name,
params=params)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name.split('/')[0], object_list.strip('/\n'))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_contents_with_end_marker(self):
# get container contents list using end_marker param
container_name = self._create_container()
@@ -202,11 +201,11 @@
resp, object_list = self.container_client.list_container_contents(
container_name,
params=params)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_contents_with_format_json(self):
# get container contents list using format_json param
container_name = self._create_container()
@@ -216,7 +215,7 @@
resp, object_list = self.container_client.list_container_contents(
container_name,
params=params)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'GET')
self.assertIsNotNone(object_list)
@@ -226,7 +225,7 @@
self.assertTrue([c['content_type'] for c in object_list])
self.assertTrue([c['last_modified'] for c in object_list])
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_contents_with_format_xml(self):
# get container contents list using format_xml param
container_name = self._create_container()
@@ -236,7 +235,7 @@
resp, object_list = self.container_client.list_container_contents(
container_name,
params=params)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'GET')
self.assertIsNotNone(object_list)
@@ -251,7 +250,7 @@
self.assertEqual(object_list.find(".//last_modified").tag,
'last_modified')
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_contents_with_limit(self):
# get container contents list using limit param
container_name = self._create_container()
@@ -261,11 +260,11 @@
resp, object_list = self.container_client.list_container_contents(
container_name,
params=params)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_contents_with_marker(self):
# get container contents list using marker param
container_name = self._create_container()
@@ -275,11 +274,11 @@
resp, object_list = self.container_client.list_container_contents(
container_name,
params=params)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_contents_with_path(self):
# get container contents list using path param
container_name = self._create_container()
@@ -290,11 +289,11 @@
resp, object_list = self.container_client.list_container_contents(
container_name,
params=params)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_contents_with_prefix(self):
# get container contents list using prefix param
container_name = self._create_container()
@@ -305,11 +304,11 @@
resp, object_list = self.container_client.list_container_contents(
container_name,
params=params)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_container_metadata(self):
# List container metadata
container_name = self._create_container()
@@ -321,23 +320,23 @@
resp, _ = self.container_client.list_container_metadata(
container_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'HEAD')
self.assertIn('x-container-meta-name', resp)
self.assertEqual(resp['x-container-meta-name'], metadata['name'])
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_no_container_metadata(self):
# HEAD container without metadata
container_name = self._create_container()
resp, _ = self.container_client.list_container_metadata(
container_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'HEAD')
self.assertNotIn('x-container-meta-', str(resp))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_update_container_metadata_with_create_and_delete_matadata(self):
# Send one request of adding and deleting metadata
container_name = data_utils.rand_name(name='TestContainer')
@@ -351,7 +350,7 @@
container_name,
metadata=metadata_2,
remove_metadata=metadata_1)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'POST')
resp, _ = self.container_client.list_container_metadata(
@@ -361,7 +360,7 @@
self.assertEqual(resp['x-container-meta-test-container-meta2'],
metadata_2['test-container-meta2'])
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_update_container_metadata_with_create_metadata(self):
# update container metadata using add metadata
container_name = self._create_container()
@@ -370,7 +369,7 @@
resp, _ = self.container_client.update_container_metadata(
container_name,
metadata=metadata)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'POST')
resp, _ = self.container_client.list_container_metadata(
@@ -379,7 +378,7 @@
self.assertEqual(resp['x-container-meta-test-container-meta1'],
metadata['test-container-meta1'])
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_update_container_metadata_with_delete_metadata(self):
# update container metadata using delete metadata
container_name = data_utils.rand_name(name='TestContainer')
@@ -391,14 +390,14 @@
resp, _ = self.container_client.delete_container_metadata(
container_name,
metadata=metadata)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'POST')
resp, _ = self.container_client.list_container_metadata(
container_name)
self.assertNotIn('x-container-meta-test-container-meta1', resp)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_update_container_metadata_with_create_matadata_key(self):
# update container metadata with a blenk value of metadata
container_name = self._create_container()
@@ -407,14 +406,14 @@
resp, _ = self.container_client.update_container_metadata(
container_name,
metadata=metadata)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'POST')
resp, _ = self.container_client.list_container_metadata(
container_name)
self.assertNotIn('x-container-meta-test-container-meta1', resp)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_update_container_metadata_with_delete_metadata_key(self):
# update container metadata with a blank value of matadata
container_name = data_utils.rand_name(name='TestContainer')
@@ -427,7 +426,7 @@
resp, _ = self.container_client.delete_container_metadata(
container_name,
metadata=metadata)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'POST')
resp, _ = self.container_client.list_container_metadata(container_name)
diff --git a/tempest/api/object_storage/test_container_sync.py b/tempest/api/object_storage/test_container_sync.py
index 207fced..9bd986f 100644
--- a/tempest/api/object_storage/test_container_sync.py
+++ b/tempest/api/object_storage/test_container_sync.py
@@ -19,8 +19,7 @@
from tempest.api.object_storage import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest.test import attr
-from tempest.test import HTTP_SUCCESS
+from tempest import test
CONF = config.CONF
@@ -66,7 +65,7 @@
cls.delete_containers(cls.containers, client[0], client[1])
super(ContainerSyncTest, cls).tearDownClass()
- @attr(type='slow')
+ @test.attr(type='slow')
def test_container_synchronization(self):
# container to container synchronization
# to allow/accept sync requests to/from other accounts
@@ -86,12 +85,12 @@
(client_base_url, str(cont[1]))}
resp, body = \
cont_client[0].put(str(cont[0]), body=None, headers=headers)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
# create object in container
object_name = data_utils.rand_name(name='TestSyncObject')
data = object_name[::-1] # data_utils.arbitrary_string()
resp, _ = obj_client[0].create_object(cont[0], object_name, data)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.objects.append(object_name)
# wait until container contents list is not empty
@@ -104,7 +103,7 @@
cont_client[client_index].\
list_container_contents(self.containers[client_index],
params=params)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
object_lists.append(dict(
(obj['name'], obj) for obj in object_list))
# check that containers are not empty and have equal keys()
@@ -124,5 +123,5 @@
for obj_client, cont in obj_clients:
for obj_name in object_lists[0]:
resp, object_content = obj_client.get_object(cont, obj_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertEqual(object_content, obj_name[::-1])
diff --git a/tempest/api/object_storage/test_healthcheck.py b/tempest/api/object_storage/test_healthcheck.py
index 35aee2a..e27c7ef 100644
--- a/tempest/api/object_storage/test_healthcheck.py
+++ b/tempest/api/object_storage/test_healthcheck.py
@@ -17,8 +17,7 @@
from tempest.api.object_storage import base
from tempest.common import custom_matchers
-from tempest.test import attr
-from tempest.test import HTTP_SUCCESS
+from tempest import test
class HealthcheckTest(base.BaseObjectTest):
@@ -32,13 +31,13 @@
# Turning http://.../v1/foobar into http://.../
self.account_client.skip_path()
- @attr('gate')
+ @test.attr('gate')
def test_get_healthcheck(self):
resp, _ = self.account_client.get("healthcheck", {})
# The status is expected to be 200
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
# The target of the request is not any Swift resource. Therefore, the
# existence of response header is checked without a custom matcher.
diff --git a/tempest/api/object_storage/test_object_expiry.py b/tempest/api/object_storage/test_object_expiry.py
index 3aae0a1..53ca20d 100644
--- a/tempest/api/object_storage/test_object_expiry.py
+++ b/tempest/api/object_storage/test_object_expiry.py
@@ -18,7 +18,7 @@
from tempest.api.object_storage import base
from tempest.common.utils import data_utils
from tempest import exceptions
-from tempest.test import attr
+from tempest import test
class ObjectExpiryTest(base.BaseObjectTest):
@@ -67,12 +67,12 @@
self.assertRaises(exceptions.NotFound, self.object_client.get_object,
self.container_name, self.object_name)
- @attr(type='gate')
+ @test.attr(type='gate')
def test_get_object_after_expiry_time(self):
metadata = {'X-Delete-After': '3'}
self._test_object_expiry(metadata)
- @attr(type='gate')
+ @test.attr(type='gate')
def test_get_object_at_expiry_time(self):
metadata = {'X-Delete-At': str(int(time.time()) + 3)}
self._test_object_expiry(metadata)
diff --git a/tempest/api/object_storage/test_object_formpost.py b/tempest/api/object_storage/test_object_formpost.py
index 6f46ec9..98e36b5 100644
--- a/tempest/api/object_storage/test_object_formpost.py
+++ b/tempest/api/object_storage/test_object_formpost.py
@@ -21,8 +21,7 @@
from tempest.api.object_storage import base
from tempest.common.utils import data_utils
-from tempest.test import attr
-from tempest.test import HTTP_SUCCESS
+from tempest import test
class ObjectFormPostTest(base.BaseObjectTest):
@@ -93,7 +92,7 @@
content_type = 'multipart/form-data; boundary=%s' % boundary
return body, content_type
- @attr(type='gate')
+ @test.attr(type='gate')
def test_post_object_using_form(self):
body, content_type = self.get_multipart_form()
@@ -107,12 +106,12 @@
# Use a raw request, otherwise authentication headers are used
resp, body = self.object_client.http_obj.request(url, "POST",
body, headers=headers)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, "Object", "POST")
# Ensure object is available
resp, body = self.object_client.get("%s/%s%s" % (
self.container_name, self.object_name, "testfile"))
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, "Object", "GET")
self.assertEqual(body, "hello world")
diff --git a/tempest/api/object_storage/test_object_services.py b/tempest/api/object_storage/test_object_services.py
index 6f349b6..33f3299 100644
--- a/tempest/api/object_storage/test_object_services.py
+++ b/tempest/api/object_storage/test_object_services.py
@@ -18,8 +18,7 @@
from tempest.api.object_storage import base
from tempest.common import custom_matchers
from tempest.common.utils import data_utils
-from tempest.test import attr
-from tempest.test import HTTP_SUCCESS
+from tempest import test
class ObjectTest(base.BaseObjectTest):
@@ -35,7 +34,7 @@
cls.delete_containers(cls.containers)
super(ObjectTest, cls).tearDownClass()
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_object(self):
# create object
object_name = data_utils.rand_name(name='TestObject')
@@ -50,7 +49,7 @@
self.assertEqual(resp['status'], '201')
self.assertHeaders(resp, 'Object', 'PUT')
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_delete_object(self):
# create object
object_name = data_utils.rand_name(name='TestObject')
@@ -60,10 +59,10 @@
# delete object
resp, _ = self.object_client.delete_object(self.container_name,
object_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Object', 'DELETE')
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_object_metadata(self):
# add metadata to storage object, test if metadata is retrievable
@@ -78,20 +77,20 @@
orig_metadata = {meta_key: meta_value}
resp, _ = self.object_client.update_object_metadata(
self.container_name, object_name, orig_metadata)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Object', 'POST')
# get object metadata
resp, resp_metadata = self.object_client.list_object_metadata(
self.container_name, object_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Object', 'HEAD')
actual_meta_key = 'x-object-meta-' + meta_key
self.assertIn(actual_meta_key, resp)
self.assertEqual(resp[actual_meta_key], meta_value)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_get_object(self):
# retrieve object's data (in response body)
@@ -103,12 +102,12 @@
# get object
resp, body = self.object_client.get_object(self.container_name,
object_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Object', 'GET')
self.assertEqual(body, data)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_copy_object_in_same_container(self):
# create source object
src_object_name = data_utils.rand_name(name='SrcObject')
@@ -135,7 +134,7 @@
dst_object_name)
self.assertEqual(body, src_data)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_copy_object_to_itself(self):
# change the content type of an existing object
@@ -160,7 +159,7 @@
object_name)
self.assertEqual(resp['content-type'], metadata['content-type'])
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_copy_object_2d_way(self):
# create source object
src_object_name = data_utils.rand_name(name='SrcObject')
@@ -195,7 +194,7 @@
dst_object_name)
self.assertEqual(body, src_data)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_copy_object_across_containers(self):
# create a container to use as asource container
src_container_name = data_utils.rand_name(name='TestSourceContainer')
@@ -219,7 +218,7 @@
resp, _ = self.object_client.update_object_metadata(src_container_name,
object_name,
orig_metadata)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Object', 'POST')
# copy object from source container to destination container
@@ -237,7 +236,7 @@
self.assertIn(actual_meta_key, resp)
self.assertEqual(resp[actual_meta_key], meta_value)
- @attr(type='gate')
+ @test.attr(type='gate')
def test_object_upload_in_segments(self):
# create object
object_name = data_utils.rand_name(name='LObject')
@@ -280,7 +279,7 @@
self.container_name, object_name)
self.assertEqual(''.join(data_segments), body)
- @attr(type='gate')
+ @test.attr(type='gate')
def test_get_object_if_different(self):
# http://en.wikipedia.org/wiki/HTTP_ETag
# Make a conditional request for an object using the If-None-Match
@@ -312,7 +311,7 @@
md5 = hashlib.md5(local_data).hexdigest()
headers = {'If-None-Match': md5}
resp, body = self.object_client.get(url, headers=headers)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Object', 'GET')
@@ -326,7 +325,7 @@
self.delete_containers([self.container_name])
super(PublicObjectTest, self).tearDown()
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_access_public_container_object_without_using_creds(self):
# make container public-readable and access an object in it object
# anonymously, without using credentials
@@ -335,7 +334,7 @@
cont_headers = {'X-Container-Read': '.r:*,.rlistings'}
resp_meta, body = self.container_client.update_container_metadata(
self.container_name, metadata=cont_headers, metadata_prefix='')
- self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp_meta['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp_meta, 'Container', 'POST')
# create object
@@ -350,7 +349,7 @@
# list container metadata
resp_meta, _ = self.container_client.list_container_metadata(
self.container_name)
- self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp_meta['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp_meta, 'Container', 'HEAD')
self.assertIn('x-container-read', resp_meta)
@@ -367,7 +366,7 @@
self.assertEqual(body, data)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_access_public_object_with_another_user_creds(self):
# make container public-readable and access an object in it using
# another user's credentials
@@ -375,7 +374,7 @@
resp_meta, body = self.container_client.update_container_metadata(
self.container_name, metadata=cont_headers,
metadata_prefix='')
- self.assertIn(int(resp_meta['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp_meta['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp_meta, 'Container', 'POST')
# create object
@@ -390,7 +389,7 @@
# list container metadata
resp, _ = self.container_client.list_container_metadata(
self.container_name)
- self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertIn(int(resp['status']), test.HTTP_SUCCESS)
self.assertHeaders(resp, 'Container', 'HEAD')
self.assertIn('x-container-read', resp)
diff --git a/tempest/api/object_storage/test_object_version.py b/tempest/api/object_storage/test_object_version.py
index 75293d2..8d2ff9b 100644
--- a/tempest/api/object_storage/test_object_version.py
+++ b/tempest/api/object_storage/test_object_version.py
@@ -15,7 +15,7 @@
from tempest.api.object_storage import base
from tempest.common.utils import data_utils
-from tempest.test import attr
+from tempest import test
class ContainerTest(base.BaseObjectTest):
@@ -40,7 +40,7 @@
header_value = resp.get('x-versions-location', 'Missing Header')
self.assertEqual(header_value, versioned)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_versioned_container(self):
# create container
vers_container_name = data_utils.rand_name(name='TestVersionContainer')
diff --git a/tempest/api/volume/test_volume_metadata.py b/tempest/api/volume/test_volume_metadata.py
index ec732d1..7d2216d 100644
--- a/tempest/api/volume/test_volume_metadata.py
+++ b/tempest/api/volume/test_volume_metadata.py
@@ -43,7 +43,8 @@
# Create metadata for the volume
metadata = {"key1": "value1",
"key2": "value2",
- "key3": "value3"}
+ "key3": "value3",
+ "key4": "<value&special_chars>"}
rsp, body = self.volumes_client.create_volume_metadata(self.volume_id,
metadata)
@@ -59,6 +60,8 @@
self.assertEqual(200, rsp.status)
resp, body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertNotIn("key1", body)
+ del metadata["key1"]
+ self.assertThat(body.items(), ContainsAll(metadata.items()))
@test.attr(type='gate')
def test_update_volume_metadata(self):
diff --git a/tempest/cli/__init__.py b/tempest/cli/__init__.py
index a5e0447..8c4ec45 100644
--- a/tempest/cli/__init__.py
+++ b/tempest/cli/__init__.py
@@ -83,6 +83,11 @@
return self.cmd_with_auth(
'neutron', action, flags, params, admin, fail_ok)
+ def savanna(self, action, flags='', params='', admin=True, fail_ok=False):
+ """Executes savanna command for the given action."""
+ return self.cmd_with_auth(
+ 'savanna', action, flags, params, admin, fail_ok)
+
def cmd_with_auth(self, cmd, action, flags='', params='',
admin=True, fail_ok=False):
"""Executes given command with auth attributes appended."""
diff --git a/tempest/cli/simple_read_only/test_neutron.py b/tempest/cli/simple_read_only/test_neutron.py
index cd81378..c1d58b5 100644
--- a/tempest/cli/simple_read_only/test_neutron.py
+++ b/tempest/cli/simple_read_only/test_neutron.py
@@ -74,13 +74,11 @@
def test_neutron_floatingip_list(self):
self.neutron('floatingip-list')
- @test.skip_because(bug="1240694")
@test.attr(type='smoke')
@test.requires_ext(extension='metering', service='network')
def test_neutron_meter_label_list(self):
self.neutron('meter-label-list')
- @test.skip_because(bug="1240694")
@test.attr(type='smoke')
@test.requires_ext(extension='metering', service='network')
def test_neutron_meter_label_rule_list(self):
diff --git a/tempest/cli/simple_read_only/test_savanna.py b/tempest/cli/simple_read_only/test_savanna.py
new file mode 100644
index 0000000..1e30978
--- /dev/null
+++ b/tempest/cli/simple_read_only/test_savanna.py
@@ -0,0 +1,70 @@
+# Copyright (c) 2013 Mirantis Inc.
+#
+# 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 logging
+import subprocess
+
+from tempest import cli
+from tempest import config
+from tempest import test
+
+CONF = config.CONF
+
+LOG = logging.getLogger(__name__)
+
+
+class SimpleReadOnlySavannaClientTest(cli.ClientTestBase):
+ """Basic, read-only tests for Savanna CLI client.
+
+ Checks return values and output of read-only commands.
+ These tests do not presume any content, nor do they create
+ their own. They only verify the structure of output if present.
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.service_available.savanna:
+ msg = "Skipping all Savanna cli tests because it is not available"
+ raise cls.skipException(msg)
+ super(SimpleReadOnlySavannaClientTest, cls).setUpClass()
+
+ @test.attr(type='negative')
+ def test_savanna_fake_action(self):
+ self.assertRaises(subprocess.CalledProcessError,
+ self.savanna,
+ 'this-does-not-exist')
+
+ def test_savanna_plugins_list(self):
+ plugins = self.parser.listing(self.savanna('plugin-list'))
+ self.assertTableStruct(plugins, ['name', 'versions', 'title'])
+
+ def test_savanna_plugins_show(self):
+ plugin = self.parser.listing(self.savanna('plugin-show',
+ params='--name vanilla'))
+ self.assertTableStruct(plugin, ['Property', 'Value'])
+
+ def test_savanna_node_group_template_list(self):
+ plugins = self.parser.listing(self.savanna('node-group-template-list'))
+ self.assertTableStruct(plugins, ['name', 'id', 'plugin_name',
+ 'node_processes', 'description'])
+
+ def test_savanna_cluster_template_list(self):
+ plugins = self.parser.listing(self.savanna('cluster-template-list'))
+ self.assertTableStruct(plugins, ['name', 'id', 'plugin_name',
+ 'node_groups', 'description'])
+
+ def test_savanna_cluster_list(self):
+ plugins = self.parser.listing(self.savanna('cluster-list'))
+ self.assertTableStruct(plugins, ['name', 'id', 'status', 'node_count'])
diff --git a/tempest/clients.py b/tempest/clients.py
index c262a20..d0eb1cc 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -439,8 +439,12 @@
"""
def __init__(self, interface='json', service=None):
base = super(OrchestrationManager, self)
+ # heat currently needs an admin user so that stacks can create users
+ # however the tests need the demo tenant so that the neutron
+ # private network is the default. DO NOT change this auth combination
+ # until heat can run with the demo user.
base.__init__(CONF.identity.admin_username,
CONF.identity.admin_password,
- CONF.identity.admin_tenant_name,
+ CONF.identity.tenant_name,
interface=interface,
service=service)
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 212d41d..af5045a 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -63,11 +63,6 @@
# The version of the API this client implements
self.api_version = None
self._skip_path = False
- # NOTE(vponomaryov): self.headers is deprecated now.
- # should be removed after excluding it from all use places.
- # Insted of this should be used 'get_headers' method
- self.headers = {'Content-Type': 'application/%s' % self.TYPE,
- 'Accept': 'application/%s' % self.TYPE}
self.build_interval = CONF.compute.build_interval
self.build_timeout = CONF.compute.build_timeout
self.general_header_lc = set(('cache-control', 'connection',
@@ -86,8 +81,6 @@
return self.TYPE
def get_headers(self, accept_type=None, send_type=None):
- # This method should be used instead of
- # deprecated 'self.headers'
if accept_type is None:
accept_type = self._get_type()
if send_type is None:
@@ -204,7 +197,6 @@
def get_versions(self):
resp, body = self.get('')
body = self._parse_resp(body)
- body = body['versions']
versions = map(lambda x: x['id'], body)
return resp, versions
diff --git a/tempest/common/ssh.py b/tempest/common/ssh.py
index c772ce9..b6fa0a0 100644
--- a/tempest/common/ssh.py
+++ b/tempest/common/ssh.py
@@ -72,7 +72,7 @@
look_for_keys=self.look_for_keys,
key_filename=self.key_filename,
timeout=self.channel_timeout, pkey=self.pkey)
- LOG.info("ssh connection to %s@%s sucessfuly created",
+ LOG.info("ssh connection to %s@%s successfuly created",
self.username, self.host)
return ssh
except (socket.error,
diff --git a/tempest/config.py b/tempest/config.py
index 292a9ef..210c857 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -99,7 +99,13 @@
cfg.BoolOpt('trust',
default=True,
help='Does the identity service have delegation and '
- 'impersonation enabled')
+ 'impersonation enabled'),
+ cfg.BoolOpt('api_v2',
+ default=True,
+ help='Is the v2 identity API enabled'),
+ cfg.BoolOpt('api_v3',
+ default=True,
+ help='Is the v3 identity API enabled'),
]
compute_group = cfg.OptGroup(name='compute',
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 846e0cc..e868075 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -130,6 +130,7 @@
def ssh_to_server(self):
try:
self.linux_client = self.get_remote_client(self.floating_ip.ip)
+ self.linux_client.validate_authentication()
except Exception:
LOG.exception('ssh to server failed')
self._log_console_output()
@@ -160,10 +161,11 @@
self.nova_volume_attach()
self.addCleanup(self.nova_volume_detach)
self.cinder_show()
- self.nova_reboot()
self.nova_floating_ip_create()
self.nova_floating_ip_add()
self._create_loginable_secgroup_rule_nova()
self.ssh_to_server()
+ self.nova_reboot()
+ self.ssh_to_server()
self.check_partitions()
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index 8d043ae..841f9e1 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -114,7 +114,7 @@
detach_volume_client(server.id, volume.id)
self._wait_for_volume_status(volume, 'available')
- def _wait_for_volume_availible_on_the_system(self, server_or_ip):
+ def _wait_for_volume_available_on_the_system(self, server_or_ip):
ssh = self.get_remote_client(server_or_ip)
def _func():
@@ -161,7 +161,7 @@
ip_for_server = server
self._attach_volume(server, volume)
- self._wait_for_volume_availible_on_the_system(ip_for_server)
+ self._wait_for_volume_available_on_the_system(ip_for_server)
self._create_timestamp(ip_for_server)
self._detach_volume(server, volume)
@@ -189,7 +189,7 @@
# attach volume2 to instance2
self._attach_volume(server_from_snapshot, volume_from_snapshot)
- self._wait_for_volume_availible_on_the_system(ip_for_snapshot)
+ self._wait_for_volume_available_on_the_system(ip_for_snapshot)
# check the existence of the timestamp file in the volume2
self._check_timestamp(ip_for_snapshot)
diff --git a/tempest/services/compute/json/aggregates_client.py b/tempest/services/compute/json/aggregates_client.py
index aa52081..e26f570 100644
--- a/tempest/services/compute/json/aggregates_client.py
+++ b/tempest/services/compute/json/aggregates_client.py
@@ -43,7 +43,7 @@
def create_aggregate(self, **kwargs):
"""Creates a new aggregate."""
post_body = json.dumps({'aggregate': kwargs})
- resp, body = self.post('os-aggregates', post_body, self.headers)
+ resp, body = self.post('os-aggregates', post_body)
body = json.loads(body)
return resp, body['aggregate']
@@ -55,8 +55,7 @@
'availability_zone': availability_zone
}
put_body = json.dumps({'aggregate': put_body})
- resp, body = self.put('os-aggregates/%s' % str(aggregate_id),
- put_body, self.headers)
+ resp, body = self.put('os-aggregates/%s' % str(aggregate_id), put_body)
body = json.loads(body)
return resp, body['aggregate']
@@ -79,7 +78,7 @@
}
post_body = json.dumps({'add_host': post_body})
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['aggregate']
@@ -90,7 +89,7 @@
}
post_body = json.dumps({'remove_host': post_body})
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['aggregate']
@@ -101,6 +100,6 @@
}
post_body = json.dumps({'set_metadata': post_body})
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['aggregate']
diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py
index b7135f6..de0f1a8 100644
--- a/tempest/services/compute/json/certificates_client.py
+++ b/tempest/services/compute/json/certificates_client.py
@@ -36,6 +36,6 @@
def create_certificate(self):
"""create certificates."""
url = "os-certificates"
- resp, body = self.post(url, None, self.headers)
+ resp, body = self.post(url, None)
body = json.loads(body)
return resp, body['certificate']
diff --git a/tempest/services/compute/json/fixed_ips_client.py b/tempest/services/compute/json/fixed_ips_client.py
index 144b7dc..af750a3 100644
--- a/tempest/services/compute/json/fixed_ips_client.py
+++ b/tempest/services/compute/json/fixed_ips_client.py
@@ -36,5 +36,5 @@
def reserve_fixed_ip(self, ip, body):
"""This reserves and unreserves fixed ips."""
url = "os-fixed-ips/%s/action" % (ip)
- resp, body = self.post(url, json.dumps(body), self.headers)
+ resp, body = self.post(url, json.dumps(body))
return resp, body
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index 96ab6d7..289b09e 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -69,7 +69,7 @@
if kwargs.get('is_public'):
post_body['os-flavor-access:is_public'] = kwargs.get('is_public')
post_body = json.dumps({'flavor': post_body})
- resp, body = self.post('flavors', post_body, self.headers)
+ resp, body = self.post('flavors', post_body)
body = json.loads(body)
return resp, body['flavor']
@@ -92,7 +92,7 @@
"""Sets extra Specs to the mentioned flavor."""
post_body = json.dumps({'extra_specs': specs})
resp, body = self.post('flavors/%s/os-extra_specs' % flavor_id,
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['extra_specs']
@@ -112,8 +112,7 @@
def update_flavor_extra_spec(self, flavor_id, key, **kwargs):
"""Update specified extra Specs of the mentioned flavor and key."""
resp, body = self.put('flavors/%s/os-extra_specs/%s' %
- (flavor_id, key),
- json.dumps(kwargs), self.headers)
+ (flavor_id, key), json.dumps(kwargs))
body = json.loads(body)
return resp, body
@@ -124,8 +123,7 @@
def list_flavor_access(self, flavor_id):
"""Gets flavor access information given the flavor id."""
- resp, body = self.get('flavors/%s/os-flavor-access' % flavor_id,
- self.headers)
+ resp, body = self.get('flavors/%s/os-flavor-access' % flavor_id)
body = json.loads(body)
return resp, body['flavor_access']
@@ -137,8 +135,7 @@
}
}
post_body = json.dumps(post_body)
- resp, body = self.post('flavors/%s/action' % flavor_id,
- post_body, self.headers)
+ resp, body = self.post('flavors/%s/action' % flavor_id, post_body)
body = json.loads(body)
return resp, body['flavor_access']
@@ -150,7 +147,6 @@
}
}
post_body = json.dumps(post_body)
- resp, body = self.post('flavors/%s/action' % flavor_id,
- post_body, self.headers)
+ resp, body = self.post('flavors/%s/action' % flavor_id, post_body)
body = json.loads(body)
return resp, body['flavor_access']
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 2bf5241..0385160 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -52,7 +52,7 @@
url = 'os-floating-ips'
post_body = {'pool': pool_name}
post_body = json.dumps(post_body)
- resp, body = self.post(url, post_body, self.headers)
+ resp, body = self.post(url, post_body)
body = json.loads(body)
return resp, body['floating_ip']
@@ -72,7 +72,7 @@
}
post_body = json.dumps(post_body)
- resp, body = self.post(url, post_body, self.headers)
+ resp, body = self.post(url, post_body)
return resp, body
def disassociate_floating_ip_from_server(self, floating_ip, server_id):
@@ -85,7 +85,7 @@
}
post_body = json.dumps(post_body)
- resp, body = self.post(url, post_body, self.headers)
+ resp, body = self.post(url, post_body)
return resp, body
def is_resource_deleted(self, id):
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index aa63927..d826a78 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -55,8 +55,7 @@
request_body.update(**kwargs)
request_body = json.dumps(request_body)
- resp, body = self.put("os-hosts/%s" % str(hostname), request_body,
- self.headers)
+ resp, body = self.put("os-hosts/%s" % str(hostname), request_body)
body = json.loads(body)
return resp, body
diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py
index 7324d84..b3d8c35 100644
--- a/tempest/services/compute/json/images_client.py
+++ b/tempest/services/compute/json/images_client.py
@@ -46,7 +46,7 @@
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % str(server_id),
- post_body, self.headers)
+ post_body)
return resp, body
def list_images(self, params=None):
@@ -93,16 +93,14 @@
def set_image_metadata(self, image_id, meta):
"""Sets the metadata for an image."""
post_body = json.dumps({'metadata': meta})
- resp, body = self.put('images/%s/metadata' % str(image_id),
- post_body, self.headers)
+ resp, body = self.put('images/%s/metadata' % str(image_id), post_body)
body = json.loads(body)
return resp, body['metadata']
def update_image_metadata(self, image_id, meta):
"""Updates the metadata for an image."""
post_body = json.dumps({'metadata': meta})
- resp, body = self.post('images/%s/metadata' % str(image_id),
- post_body, self.headers)
+ resp, body = self.post('images/%s/metadata' % str(image_id), post_body)
body = json.loads(body)
return resp, body['metadata']
@@ -116,7 +114,7 @@
"""Sets the value for a specific image metadata key."""
post_body = json.dumps({'meta': meta})
resp, body = self.put('images/%s/metadata/%s' % (str(image_id), key),
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['meta']
diff --git a/tempest/services/compute/json/interfaces_client.py b/tempest/services/compute/json/interfaces_client.py
index d9a2030..f4c4c64 100644
--- a/tempest/services/compute/json/interfaces_client.py
+++ b/tempest/services/compute/json/interfaces_client.py
@@ -46,7 +46,6 @@
post_body['interfaceAttachment']['fixed_ips'] = [fip]
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/os-interface' % server,
- headers=self.headers,
body=post_body)
body = json.loads(body)
return resp, body['interfaceAttachment']
diff --git a/tempest/services/compute/json/keypairs_client.py b/tempest/services/compute/json/keypairs_client.py
index 3e2d4a7..356c2e6 100644
--- a/tempest/services/compute/json/keypairs_client.py
+++ b/tempest/services/compute/json/keypairs_client.py
@@ -47,8 +47,7 @@
if pub_key:
post_body['keypair']['public_key'] = pub_key
post_body = json.dumps(post_body)
- resp, body = self.post("os-keypairs",
- headers=self.headers, body=post_body)
+ resp, body = self.post("os-keypairs", body=post_body)
body = json.loads(body)
return resp, body['keypair']
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
index 2007d4e..7607cc0 100644
--- a/tempest/services/compute/json/quotas_client.py
+++ b/tempest/services/compute/json/quotas_client.py
@@ -96,8 +96,7 @@
post_body['security_groups'] = security_groups
post_body = json.dumps({'quota_set': post_body})
- resp, body = self.put('os-quota-sets/%s' % str(tenant_id), post_body,
- self.headers)
+ resp, body = self.put('os-quota-sets/%s' % str(tenant_id), post_body)
body = json.loads(body)
return resp, body['quota_set']
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index edaf4a3..2cd2d2e 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -58,7 +58,7 @@
'description': description,
}
post_body = json.dumps({'security_group': post_body})
- resp, body = self.post('os-security-groups', post_body, self.headers)
+ resp, body = self.post('os-security-groups', post_body)
body = json.loads(body)
return resp, body['security_group']
@@ -77,7 +77,7 @@
post_body['description'] = description
post_body = json.dumps({'security_group': post_body})
resp, body = self.put('os-security-groups/%s' % str(security_group_id),
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['security_group']
@@ -107,7 +107,7 @@
}
post_body = json.dumps({'security_group_rule': post_body})
url = 'os-security-group-rules'
- resp, body = self.post(url, post_body, self.headers)
+ resp, body = self.post(url, post_body)
body = json.loads(body)
return resp, body['security_group_rule']
@@ -123,3 +123,10 @@
if sg['id'] == security_group_id:
return resp, sg['rules']
raise exceptions.NotFound('No such Security Group')
+
+ def is_resource_deleted(self, id):
+ try:
+ self.get_security_group(id)
+ except exceptions.NotFound:
+ return True
+ return False
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 371a59c..025c4e5 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -78,7 +78,7 @@
if value is not None:
post_body[post_param] = value
post_body = json.dumps({'server': post_body})
- resp, body = self.post('servers', post_body, self.headers)
+ resp, body = self.post('servers', post_body)
body = json.loads(body)
# NOTE(maurosr): this deals with the case of multiple server create
@@ -116,8 +116,7 @@
post_body['OS-DCF:diskConfig'] = disk_config
post_body = json.dumps({'server': post_body})
- resp, body = self.put("servers/%s" % str(server_id),
- post_body, self.headers)
+ resp, body = self.put("servers/%s" % str(server_id), post_body)
body = json.loads(body)
return resp, body['server']
@@ -194,7 +193,7 @@
def action(self, server_id, action_name, response_key, **kwargs):
post_body = json.dumps({action_name: kwargs})
resp, body = self.post('servers/%s/action' % str(server_id),
- post_body, self.headers)
+ post_body)
if response_key is not None:
body = json.loads(body)[response_key]
return resp, body
@@ -269,14 +268,14 @@
else:
post_body = json.dumps({'metadata': meta})
resp, body = self.put('servers/%s/metadata' % str(server_id),
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['metadata']
def update_server_metadata(self, server_id, meta):
post_body = json.dumps({'metadata': meta})
resp, body = self.post('servers/%s/metadata' % str(server_id),
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['metadata']
@@ -288,7 +287,7 @@
def set_server_metadata_item(self, server_id, key, meta):
post_body = json.dumps({'meta': meta})
resp, body = self.put('servers/%s/metadata/%s' % (str(server_id), key),
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['meta']
@@ -312,7 +311,7 @@
}
})
resp, body = self.post('servers/%s/os-volume_attachments' % server_id,
- post_body, self.headers)
+ post_body)
return resp, body
def detach_volume(self, server_id, volume_id):
@@ -340,8 +339,7 @@
req_body = json.dumps({'os-migrateLive': migrate_params})
- resp, body = self.post("servers/%s/action" % str(server_id),
- req_body, self.headers)
+ resp, body = self.post("servers/%s/action" % str(server_id), req_body)
return resp, body
def migrate_server(self, server_id, **kwargs):
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
index 4abee47..8380dc2 100644
--- a/tempest/services/compute/json/services_client.py
+++ b/tempest/services/compute/json/services_client.py
@@ -45,7 +45,7 @@
binary: Service binary
"""
post_body = json.dumps({'binary': binary, 'host': host_name})
- resp, body = self.put('os-services/enable', post_body, self.headers)
+ resp, body = self.put('os-services/enable', post_body)
body = json.loads(body)
return resp, body['service']
@@ -56,6 +56,6 @@
binary: Service binary
"""
post_body = json.dumps({'binary': binary, 'host': host_name})
- resp, body = self.put('os-services/disable', post_body, self.headers)
+ resp, body = self.put('os-services/disable', post_body)
body = json.loads(body)
return resp, body['service']
diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_extensions_client.py
index ba7b5df..4b9dc0b 100644
--- a/tempest/services/compute/json/volumes_extensions_client.py
+++ b/tempest/services/compute/json/volumes_extensions_client.py
@@ -75,7 +75,7 @@
}
post_body = json.dumps({'volume': post_body})
- resp, body = self.post('os-volumes', post_body, self.headers)
+ resp, body = self.post('os-volumes', post_body)
body = json.loads(body)
return resp, body['volume']
diff --git a/tempest/services/compute/v3/json/aggregates_client.py b/tempest/services/compute/v3/json/aggregates_client.py
index 6bc758c..20ce87b 100644
--- a/tempest/services/compute/v3/json/aggregates_client.py
+++ b/tempest/services/compute/v3/json/aggregates_client.py
@@ -43,7 +43,7 @@
def create_aggregate(self, **kwargs):
"""Creates a new aggregate."""
post_body = json.dumps({'aggregate': kwargs})
- resp, body = self.post('os-aggregates', post_body, self.headers)
+ resp, body = self.post('os-aggregates', post_body)
body = json.loads(body)
return resp, body['aggregate']
@@ -55,8 +55,7 @@
'availability_zone': availability_zone
}
put_body = json.dumps({'aggregate': put_body})
- resp, body = self.put('os-aggregates/%s' % str(aggregate_id),
- put_body, self.headers)
+ resp, body = self.put('os-aggregates/%s' % str(aggregate_id), put_body)
body = json.loads(body)
return resp, body['aggregate']
@@ -79,7 +78,7 @@
}
post_body = json.dumps({'add_host': post_body})
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['aggregate']
@@ -90,7 +89,7 @@
}
post_body = json.dumps({'remove_host': post_body})
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['aggregate']
@@ -101,6 +100,6 @@
}
post_body = json.dumps({'set_metadata': post_body})
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['aggregate']
diff --git a/tempest/services/compute/v3/json/certificates_client.py b/tempest/services/compute/v3/json/certificates_client.py
index 0c9f9ac..620eedf 100644
--- a/tempest/services/compute/v3/json/certificates_client.py
+++ b/tempest/services/compute/v3/json/certificates_client.py
@@ -36,6 +36,6 @@
def create_certificate(self):
"""create certificates."""
url = "os-certificates"
- resp, body = self.post(url, None, self.headers)
+ resp, body = self.post(url, None)
body = json.loads(body)
return resp, body['certificate']
diff --git a/tempest/services/compute/v3/json/flavors_client.py b/tempest/services/compute/v3/json/flavors_client.py
index df3d0c1..f9df2b8 100644
--- a/tempest/services/compute/v3/json/flavors_client.py
+++ b/tempest/services/compute/v3/json/flavors_client.py
@@ -69,7 +69,7 @@
if kwargs.get('is_public'):
post_body['flavor-access:is_public'] = kwargs.get('is_public')
post_body = json.dumps({'flavor': post_body})
- resp, body = self.post('flavors', post_body, self.headers)
+ resp, body = self.post('flavors', post_body)
body = json.loads(body)
return resp, body['flavor']
@@ -92,7 +92,7 @@
"""Sets extra Specs to the mentioned flavor."""
post_body = json.dumps({'extra_specs': specs})
resp, body = self.post('flavors/%s/flavor-extra-specs' % flavor_id,
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['extra_specs']
@@ -112,8 +112,7 @@
def update_flavor_extra_spec(self, flavor_id, key, **kwargs):
"""Update specified extra Specs of the mentioned flavor and key."""
resp, body = self.put('flavors/%s/flavor-extra-specs/%s' %
- (flavor_id, key),
- json.dumps(kwargs), self.headers)
+ (flavor_id, key), json.dumps(kwargs))
body = json.loads(body)
return resp, body
@@ -124,8 +123,7 @@
def list_flavor_access(self, flavor_id):
"""Gets flavor access information given the flavor id."""
- resp, body = self.get('flavors/%s/flavor-access' % flavor_id,
- self.headers)
+ resp, body = self.get('flavors/%s/flavor-access' % flavor_id)
body = json.loads(body)
return resp, body['flavor_access']
@@ -137,8 +135,7 @@
}
}
post_body = json.dumps(post_body)
- resp, body = self.post('flavors/%s/action' % flavor_id,
- post_body, self.headers)
+ resp, body = self.post('flavors/%s/action' % flavor_id, post_body)
body = json.loads(body)
return resp, body['flavor_access']
@@ -150,7 +147,6 @@
}
}
post_body = json.dumps(post_body)
- resp, body = self.post('flavors/%s/action' % flavor_id,
- post_body, self.headers)
+ resp, body = self.post('flavors/%s/action' % flavor_id, post_body)
body = json.loads(body)
return resp, body['flavor_access']
diff --git a/tempest/services/compute/v3/json/hosts_client.py b/tempest/services/compute/v3/json/hosts_client.py
index e33dd5f..76af626 100644
--- a/tempest/services/compute/v3/json/hosts_client.py
+++ b/tempest/services/compute/v3/json/hosts_client.py
@@ -55,8 +55,7 @@
request_body.update(**kwargs)
request_body = json.dumps({'host': request_body})
- resp, body = self.put("os-hosts/%s" % str(hostname), request_body,
- self.headers)
+ resp, body = self.put("os-hosts/%s" % str(hostname), request_body)
body = json.loads(body)
return resp, body
diff --git a/tempest/services/compute/v3/json/interfaces_client.py b/tempest/services/compute/v3/json/interfaces_client.py
index 053b9af..c167520 100644
--- a/tempest/services/compute/v3/json/interfaces_client.py
+++ b/tempest/services/compute/v3/json/interfaces_client.py
@@ -45,7 +45,6 @@
post_body['fixed_ips'] = [dict(ip_address=fixed_ip)]
post_body = json.dumps({'interface_attachment': post_body})
resp, body = self.post('servers/%s/os-attach-interfaces' % server,
- headers=self.headers,
body=post_body)
body = json.loads(body)
return resp, body['interface_attachment']
diff --git a/tempest/services/compute/v3/json/keypairs_client.py b/tempest/services/compute/v3/json/keypairs_client.py
index 05dbe25..821b86f 100644
--- a/tempest/services/compute/v3/json/keypairs_client.py
+++ b/tempest/services/compute/v3/json/keypairs_client.py
@@ -47,8 +47,7 @@
if pub_key:
post_body['keypair']['public_key'] = pub_key
post_body = json.dumps(post_body)
- resp, body = self.post("keypairs",
- headers=self.headers, body=post_body)
+ resp, body = self.post("keypairs", body=post_body)
body = json.loads(body)
return resp, body['keypair']
diff --git a/tempest/services/compute/v3/json/quotas_client.py b/tempest/services/compute/v3/json/quotas_client.py
index 1ec8651..a01b9d2 100644
--- a/tempest/services/compute/v3/json/quotas_client.py
+++ b/tempest/services/compute/v3/json/quotas_client.py
@@ -84,8 +84,7 @@
post_body['security_groups'] = security_groups
post_body = json.dumps({'quota_set': post_body})
- resp, body = self.put('os-quota-sets/%s' % str(tenant_id), post_body,
- self.headers)
+ resp, body = self.put('os-quota-sets/%s' % str(tenant_id), post_body)
body = json.loads(body)
return resp, body['quota_set']
diff --git a/tempest/services/compute/v3/json/servers_client.py b/tempest/services/compute/v3/json/servers_client.py
index 11538f5..840e914 100644
--- a/tempest/services/compute/v3/json/servers_client.py
+++ b/tempest/services/compute/v3/json/servers_client.py
@@ -84,7 +84,7 @@
if value is not None:
post_body[post_param] = value
post_body = json.dumps({'server': post_body})
- resp, body = self.post('servers', post_body, self.headers)
+ resp, body = self.post('servers', post_body)
body = json.loads(body)
# NOTE(maurosr): this deals with the case of multiple server create
@@ -121,8 +121,7 @@
post_body['os-disk-config:disk_config'] = disk_config
post_body = json.dumps({'server': post_body})
- resp, body = self.put("servers/%s" % str(server_id),
- post_body, self.headers)
+ resp, body = self.put("servers/%s" % str(server_id), post_body)
body = json.loads(body)
return resp, body['server']
@@ -199,7 +198,7 @@
def action(self, server_id, action_name, response_key, **kwargs):
post_body = json.dumps({action_name: kwargs})
resp, body = self.post('servers/%s/action' % str(server_id),
- post_body, self.headers)
+ post_body)
if response_key is not None:
body = json.loads(body)[response_key]
return resp, body
@@ -216,6 +215,21 @@
return self.action(server_id, 'change_password', None,
admin_password=admin_password)
+ def get_password(self, server_id):
+ resp, body = self.get("servers/%s/os-server-password" %
+ str(server_id))
+ body = json.loads(body)
+ return resp, body
+
+ def delete_password(self, server_id):
+ """
+ Removes the encrypted server password from the metadata server
+ Note that this does not actually change the instance server
+ password.
+ """
+ return self.delete("servers/%s/os-server-password" %
+ str(server_id))
+
def reboot(self, server_id, reboot_type):
"""Reboots a server."""
return self.action(server_id, 'reboot', None, type=reboot_type)
@@ -258,7 +272,7 @@
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % str(server_id),
- post_body, self.headers)
+ post_body)
return resp, body
def list_server_metadata(self, server_id):
@@ -272,14 +286,14 @@
else:
post_body = json.dumps({'metadata': meta})
resp, body = self.put('servers/%s/metadata' % str(server_id),
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['metadata']
def update_server_metadata(self, server_id, meta):
post_body = json.dumps({'metadata': meta})
resp, body = self.post('servers/%s/metadata' % str(server_id),
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['metadata']
@@ -291,7 +305,7 @@
def set_server_metadata_item(self, server_id, key, meta):
post_body = json.dumps({'metadata': meta})
resp, body = self.put('servers/%s/metadata/%s' % (str(server_id), key),
- post_body, self.headers)
+ post_body)
body = json.loads(body)
return resp, body['metadata']
@@ -327,7 +341,7 @@
req_body = json.dumps({'migrate_live': migrate_params})
resp, body = self.post("servers/%s/action" % str(server_id),
- req_body, self.headers)
+ req_body)
return resp, body
def migrate_server(self, server_id, **kwargs):
diff --git a/tempest/services/compute/v3/json/services_client.py b/tempest/services/compute/v3/json/services_client.py
index 1082ea9..e20dfde 100644
--- a/tempest/services/compute/v3/json/services_client.py
+++ b/tempest/services/compute/v3/json/services_client.py
@@ -50,7 +50,7 @@
'host': host_name
}
})
- resp, body = self.put('os-services/enable', post_body, self.headers)
+ resp, body = self.put('os-services/enable', post_body)
body = json.loads(body)
return resp, body['service']
@@ -66,6 +66,6 @@
'host': host_name
}
})
- resp, body = self.put('os-services/disable', post_body, self.headers)
+ resp, body = self.put('os-services/disable', post_body)
body = json.loads(body)
return resp, body['service']
diff --git a/tempest/services/compute/xml/aggregates_client.py b/tempest/services/compute/xml/aggregates_client.py
index ba08f58..cf853ba 100644
--- a/tempest/services/compute/xml/aggregates_client.py
+++ b/tempest/services/compute/xml/aggregates_client.py
@@ -51,14 +51,13 @@
def list_aggregates(self):
"""Get aggregate list."""
- resp, body = self.get("os-aggregates", self.headers)
+ resp, body = self.get("os-aggregates")
aggregates = self._parse_array(etree.fromstring(body))
return resp, aggregates
def get_aggregate(self, aggregate_id):
"""Get details of the given aggregate."""
- resp, body = self.get("os-aggregates/%s" % str(aggregate_id),
- self.headers)
+ resp, body = self.get("os-aggregates/%s" % str(aggregate_id))
aggregate = self._format_aggregate(etree.fromstring(body))
return resp, aggregate
@@ -68,8 +67,7 @@
name=name,
availability_zone=availability_zone)
resp, body = self.post('os-aggregates',
- str(Document(post_body)),
- self.headers)
+ str(Document(post_body)))
aggregate = self._format_aggregate(etree.fromstring(body))
return resp, aggregate
@@ -79,15 +77,13 @@
name=name,
availability_zone=availability_zone)
resp, body = self.put('os-aggregates/%s' % str(aggregate_id),
- str(Document(put_body)),
- self.headers)
+ str(Document(put_body)))
aggregate = self._format_aggregate(etree.fromstring(body))
return resp, aggregate
def delete_aggregate(self, aggregate_id):
"""Deletes the given aggregate."""
- return self.delete("os-aggregates/%s" % str(aggregate_id),
- self.headers)
+ return self.delete("os-aggregates/%s" % str(aggregate_id))
def is_resource_deleted(self, id):
try:
@@ -100,8 +96,7 @@
"""Adds a host to the given aggregate."""
post_body = Element("add_host", host=host)
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- str(Document(post_body)),
- self.headers)
+ str(Document(post_body)))
aggregate = self._format_aggregate(etree.fromstring(body))
return resp, aggregate
@@ -109,8 +104,7 @@
"""Removes a host from the given aggregate."""
post_body = Element("remove_host", host=host)
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- str(Document(post_body)),
- self.headers)
+ str(Document(post_body)))
aggregate = self._format_aggregate(etree.fromstring(body))
return resp, aggregate
@@ -124,7 +118,6 @@
meta.append(Text(v))
metadata.append(meta)
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- str(Document(post_body)),
- self.headers)
+ str(Document(post_body)))
aggregate = self._format_aggregate(etree.fromstring(body))
return resp, aggregate
diff --git a/tempest/services/compute/xml/availability_zone_client.py b/tempest/services/compute/xml/availability_zone_client.py
index 38280b5..3d8ac8a 100644
--- a/tempest/services/compute/xml/availability_zone_client.py
+++ b/tempest/services/compute/xml/availability_zone_client.py
@@ -33,11 +33,11 @@
return [xml_to_json(x) for x in node]
def get_availability_zone_list(self):
- resp, body = self.get('os-availability-zone', self.headers)
+ resp, body = self.get('os-availability-zone')
availability_zone = self._parse_array(etree.fromstring(body))
return resp, availability_zone
def get_availability_zone_list_detail(self):
- resp, body = self.get('os-availability-zone/detail', self.headers)
+ resp, body = self.get('os-availability-zone/detail')
availability_zone = self._parse_array(etree.fromstring(body))
return resp, availability_zone
diff --git a/tempest/services/compute/xml/certificates_client.py b/tempest/services/compute/xml/certificates_client.py
index aad20a4..4ee10c4 100644
--- a/tempest/services/compute/xml/certificates_client.py
+++ b/tempest/services/compute/xml/certificates_client.py
@@ -28,13 +28,13 @@
def get_certificate(self, id):
url = "os-certificates/%s" % (id)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = self._parse_resp(body)
return resp, body
def create_certificate(self):
"""create certificates."""
url = "os-certificates"
- resp, body = self.post(url, None, self.headers)
+ resp, body = self.post(url, None)
body = self._parse_resp(body)
return resp, body
diff --git a/tempest/services/compute/xml/extensions_client.py b/tempest/services/compute/xml/extensions_client.py
index 9753ca8..f97b64d 100644
--- a/tempest/services/compute/xml/extensions_client.py
+++ b/tempest/services/compute/xml/extensions_client.py
@@ -36,7 +36,7 @@
def list_extensions(self):
url = 'extensions'
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = self._parse_array(etree.fromstring(body))
return resp, body
@@ -46,6 +46,6 @@
return any([e for e in exts if e['name'] == extension])
def get_extension(self, extension_alias):
- resp, body = self.get('extensions/%s' % extension_alias, self.headers)
+ resp, body = self.get('extensions/%s' % extension_alias)
body = xml_to_json(etree.fromstring(body))
return resp, body
diff --git a/tempest/services/compute/xml/fixed_ips_client.py b/tempest/services/compute/xml/fixed_ips_client.py
index 599e168..b89e096 100644
--- a/tempest/services/compute/xml/fixed_ips_client.py
+++ b/tempest/services/compute/xml/fixed_ips_client.py
@@ -31,7 +31,7 @@
def get_fixed_ip_details(self, fixed_ip):
url = "os-fixed-ips/%s" % (fixed_ip)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = self._parse_resp(body)
return resp, body
@@ -44,5 +44,5 @@
key, value = body.popitem()
xml_body = Element(key)
xml_body.append(Text(value))
- resp, body = self.post(url, str(Document(xml_body)), self.headers)
+ resp, body = self.post(url, str(Document(xml_body)))
return resp, body
diff --git a/tempest/services/compute/xml/flavors_client.py b/tempest/services/compute/xml/flavors_client.py
index fb16d20..554b253 100644
--- a/tempest/services/compute/xml/flavors_client.py
+++ b/tempest/services/compute/xml/flavors_client.py
@@ -81,7 +81,7 @@
if params:
url += "?%s" % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
flavors = self._parse_array(etree.fromstring(body))
return resp, flavors
@@ -94,7 +94,7 @@
return self._list_flavors(url, params)
def get_flavor_details(self, flavor_id):
- resp, body = self.get("flavors/%s" % str(flavor_id), self.headers)
+ resp, body = self.get("flavors/%s" % str(flavor_id))
body = xml_to_json(etree.fromstring(body))
flavor = self._format_flavor(body)
return resp, flavor
@@ -120,14 +120,14 @@
kwargs.get('is_public'))
flavor.add_attr('xmlns:OS-FLV-EXT-DATA', XMLNS_OS_FLV_EXT_DATA)
flavor.add_attr('xmlns:os-flavor-access', XMLNS_OS_FLV_ACCESS)
- resp, body = self.post('flavors', str(Document(flavor)), self.headers)
+ resp, body = self.post('flavors', str(Document(flavor)))
body = xml_to_json(etree.fromstring(body))
flavor = self._format_flavor(body)
return resp, flavor
def delete_flavor(self, flavor_id):
"""Deletes the given flavor."""
- return self.delete("flavors/%s" % str(flavor_id), self.headers)
+ return self.delete("flavors/%s" % str(flavor_id))
def is_resource_deleted(self, id):
# Did not use get_flavor_details(id) for verification as it gives
@@ -145,21 +145,20 @@
for key in specs.keys():
extra_specs.add_attr(key, specs[key])
resp, body = self.post('flavors/%s/os-extra_specs' % flavor_id,
- str(Document(extra_specs)), self.headers)
+ str(Document(extra_specs)))
body = xml_to_json(etree.fromstring(body))
return resp, body
def get_flavor_extra_spec(self, flavor_id):
"""Gets extra Specs of the mentioned flavor."""
- resp, body = self.get('flavors/%s/os-extra_specs' % flavor_id,
- self.headers)
+ resp, body = self.get('flavors/%s/os-extra_specs' % flavor_id)
body = xml_to_json(etree.fromstring(body))
return resp, body
def get_flavor_extra_spec_with_key(self, flavor_id, key):
"""Gets extra Specs key-value of the mentioned flavor and key."""
resp, xml_body = self.get('flavors/%s/os-extra_specs/%s' %
- (str(flavor_id), key), self.headers)
+ (str(flavor_id), key))
body = {}
element = etree.fromstring(xml_body)
key = element.get('key')
@@ -176,8 +175,7 @@
element.append(value)
resp, body = self.put('flavors/%s/os-extra_specs/%s' %
- (flavor_id, key),
- str(doc), self.headers)
+ (flavor_id, key), str(doc))
body = xml_to_json(etree.fromstring(body))
return resp, {key: body}
@@ -191,8 +189,7 @@
def list_flavor_access(self, flavor_id):
"""Gets flavor access information given the flavor id."""
- resp, body = self.get('flavors/%s/os-flavor-access' % str(flavor_id),
- self.headers)
+ resp, body = self.get('flavors/%s/os-flavor-access' % str(flavor_id))
body = self._parse_array(etree.fromstring(body))
return resp, body
@@ -202,8 +199,7 @@
server = Element("addTenantAccess")
doc.append(server)
server.add_attr("tenant", tenant_id)
- resp, body = self.post('flavors/%s/action' % str(flavor_id),
- str(doc), self.headers)
+ resp, body = self.post('flavors/%s/action' % str(flavor_id), str(doc))
body = self._parse_array_access(etree.fromstring(body))
return resp, body
@@ -213,7 +209,6 @@
server = Element("removeTenantAccess")
doc.append(server)
server.add_attr("tenant", tenant_id)
- resp, body = self.post('flavors/%s/action' % str(flavor_id),
- str(doc), self.headers)
+ resp, body = self.post('flavors/%s/action' % str(flavor_id), str(doc))
body = self._parse_array_access(etree.fromstring(body))
return resp, body
diff --git a/tempest/services/compute/xml/floating_ips_client.py b/tempest/services/compute/xml/floating_ips_client.py
index 0119d8a..d6decf3 100644
--- a/tempest/services/compute/xml/floating_ips_client.py
+++ b/tempest/services/compute/xml/floating_ips_client.py
@@ -48,14 +48,14 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = self._parse_array(etree.fromstring(body))
return resp, body
def get_floating_ip_details(self, floating_ip_id):
"""Get the details of a floating IP."""
url = "os-floating-ips/%s" % str(floating_ip_id)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = self._parse_floating_ip(etree.fromstring(body))
if resp.status == 404:
raise exceptions.NotFound(body)
@@ -69,16 +69,16 @@
pool = Element("pool")
pool.append(Text(pool_name))
doc.append(pool)
- resp, body = self.post(url, str(doc), self.headers)
+ resp, body = self.post(url, str(doc))
else:
- resp, body = self.post(url, None, self.headers)
+ resp, body = self.post(url, None)
body = self._parse_floating_ip(etree.fromstring(body))
return resp, body
def delete_floating_ip(self, floating_ip_id):
"""Deletes the provided floating IP from the project."""
url = "os-floating-ips/%s" % str(floating_ip_id)
- resp, body = self.delete(url, self.headers)
+ resp, body = self.delete(url)
return resp, body
def associate_floating_ip_to_server(self, floating_ip, server_id):
@@ -88,7 +88,7 @@
server = Element("addFloatingIp")
doc.append(server)
server.add_attr("address", floating_ip)
- resp, body = self.post(url, str(doc), self.headers)
+ resp, body = self.post(url, str(doc))
return resp, body
def disassociate_floating_ip_from_server(self, floating_ip, server_id):
@@ -98,7 +98,7 @@
server = Element("removeFloatingIp")
doc.append(server)
server.add_attr("address", floating_ip)
- resp, body = self.post(url, str(doc), self.headers)
+ resp, body = self.post(url, str(doc))
return resp, body
def is_resource_deleted(self, id):
@@ -114,6 +114,6 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = self._parse_array(etree.fromstring(body))
return resp, body
diff --git a/tempest/services/compute/xml/hosts_client.py b/tempest/services/compute/xml/hosts_client.py
index daa83c9..13abe18 100644
--- a/tempest/services/compute/xml/hosts_client.py
+++ b/tempest/services/compute/xml/hosts_client.py
@@ -37,7 +37,7 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
node = etree.fromstring(body)
body = [xml_to_json(x) for x in node.getchildren()]
return resp, body
@@ -45,7 +45,7 @@
def show_host_detail(self, hostname):
"""Show detail information for the host."""
- resp, body = self.get("os-hosts/%s" % str(hostname), self.headers)
+ resp, body = self.get("os-hosts/%s" % str(hostname))
node = etree.fromstring(body)
body = [xml_to_json(node)]
return resp, body
@@ -58,8 +58,7 @@
for k, v in kwargs.iteritems():
request_body.append(Element(k, v))
resp, body = self.put("os-hosts/%s" % str(hostname),
- str(Document(request_body)),
- self.headers)
+ str(Document(request_body)))
node = etree.fromstring(body)
body = [xml_to_json(x) for x in node.getchildren()]
return resp, body
@@ -67,8 +66,7 @@
def startup_host(self, hostname):
"""Startup a host."""
- resp, body = self.get("os-hosts/%s/startup" % str(hostname),
- self.headers)
+ resp, body = self.get("os-hosts/%s/startup" % str(hostname))
node = etree.fromstring(body)
body = [xml_to_json(x) for x in node.getchildren()]
return resp, body
@@ -76,8 +74,7 @@
def shutdown_host(self, hostname):
"""Shutdown a host."""
- resp, body = self.get("os-hosts/%s/shutdown" % str(hostname),
- self.headers)
+ resp, body = self.get("os-hosts/%s/shutdown" % str(hostname))
node = etree.fromstring(body)
body = [xml_to_json(x) for x in node.getchildren()]
return resp, body
@@ -85,8 +82,7 @@
def reboot_host(self, hostname):
"""Reboot a host."""
- resp, body = self.get("os-hosts/%s/reboot" % str(hostname),
- self.headers)
+ resp, body = self.get("os-hosts/%s/reboot" % str(hostname))
node = etree.fromstring(body)
body = [xml_to_json(x) for x in node.getchildren()]
return resp, body
diff --git a/tempest/services/compute/xml/hypervisor_client.py b/tempest/services/compute/xml/hypervisor_client.py
index 5abaad8..3c1ef08 100644
--- a/tempest/services/compute/xml/hypervisor_client.py
+++ b/tempest/services/compute/xml/hypervisor_client.py
@@ -33,46 +33,42 @@
def get_hypervisor_list(self):
"""List hypervisors information."""
- resp, body = self.get('os-hypervisors', self.headers)
+ resp, body = self.get('os-hypervisors')
hypervisors = self._parse_array(etree.fromstring(body))
return resp, hypervisors
def get_hypervisor_list_details(self):
"""Show detailed hypervisors information."""
- resp, body = self.get('os-hypervisors/detail', self.headers)
+ resp, body = self.get('os-hypervisors/detail')
hypervisors = self._parse_array(etree.fromstring(body))
return resp, hypervisors
def get_hypervisor_show_details(self, hyper_id):
"""Display the details of the specified hypervisor."""
- resp, body = self.get('os-hypervisors/%s' % hyper_id,
- self.headers)
+ resp, body = self.get('os-hypervisors/%s' % hyper_id)
hypervisor = xml_to_json(etree.fromstring(body))
return resp, hypervisor
def get_hypervisor_servers(self, hyper_name):
"""List instances belonging to the specified hypervisor."""
- resp, body = self.get('os-hypervisors/%s/servers' % hyper_name,
- self.headers)
+ resp, body = self.get('os-hypervisors/%s/servers' % hyper_name)
hypervisors = self._parse_array(etree.fromstring(body))
return resp, hypervisors
def get_hypervisor_stats(self):
"""Get hypervisor statistics over all compute nodes."""
- resp, body = self.get('os-hypervisors/statistics', self.headers)
+ resp, body = self.get('os-hypervisors/statistics')
stats = xml_to_json(etree.fromstring(body))
return resp, stats
def get_hypervisor_uptime(self, hyper_id):
"""Display the uptime of the specified hypervisor."""
- resp, body = self.get('os-hypervisors/%s/uptime' % hyper_id,
- self.headers)
+ resp, body = self.get('os-hypervisors/%s/uptime' % hyper_id)
uptime = xml_to_json(etree.fromstring(body))
return resp, uptime
def search_hypervisor(self, hyper_name):
"""Search specified hypervisor."""
- resp, body = self.get('os-hypervisors/%s/search' % hyper_name,
- self.headers)
+ resp, body = self.get('os-hypervisors/%s/search' % hyper_name)
hypervisors = self._parse_array(etree.fromstring(body))
return resp, hypervisors
diff --git a/tempest/services/compute/xml/images_client.py b/tempest/services/compute/xml/images_client.py
index d90a7d8..9f80c55 100644
--- a/tempest/services/compute/xml/images_client.py
+++ b/tempest/services/compute/xml/images_client.py
@@ -102,7 +102,7 @@
data.append(Text(v))
metadata.append(data)
resp, body = self.post('servers/%s/action' % str(server_id),
- str(Document(post_body)), self.headers)
+ str(Document(post_body)))
return resp, body
def list_images(self, params=None):
@@ -111,7 +111,7 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = self._parse_images(etree.fromstring(body))
return resp, body['images']
@@ -123,20 +123,20 @@
url = "images/detail?" + param_list
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = self._parse_images(etree.fromstring(body))
return resp, body['images']
def get_image(self, image_id):
"""Returns the details of a single image."""
- resp, body = self.get("images/%s" % str(image_id), self.headers)
+ resp, body = self.get("images/%s" % str(image_id))
self.expected_success(200, resp)
body = self._parse_image(etree.fromstring(body))
return resp, body
def delete_image(self, image_id):
"""Deletes the provided image."""
- return self.delete("images/%s" % str(image_id), self.headers)
+ return self.delete("images/%s" % str(image_id))
def wait_for_image_status(self, image_id, status):
"""Waits for an image to reach a given status."""
@@ -152,8 +152,7 @@
def list_image_metadata(self, image_id):
"""Lists all metadata items for an image."""
- resp, body = self.get("images/%s/metadata" % str(image_id),
- self.headers)
+ resp, body = self.get("images/%s/metadata" % str(image_id))
body = self._parse_key_value(etree.fromstring(body))
return resp, body
@@ -161,7 +160,7 @@
"""Sets the metadata for an image."""
post_body = self._metadata_body(meta)
resp, body = self.put('images/%s/metadata' % image_id,
- str(Document(post_body)), self.headers)
+ str(Document(post_body)))
body = self._parse_key_value(etree.fromstring(body))
return resp, body
@@ -169,14 +168,14 @@
"""Updates the metadata for an image."""
post_body = self._metadata_body(meta)
resp, body = self.post('images/%s/metadata' % str(image_id),
- str(Document(post_body)), self.headers)
+ str(Document(post_body)))
body = self._parse_key_value(etree.fromstring(body))
return resp, body
def get_image_metadata_item(self, image_id, key):
"""Returns the value for a specific image metadata key."""
resp, body = self.get("images/%s/metadata/%s.xml" %
- (str(image_id), key), self.headers)
+ (str(image_id), key))
body = self._parse_metadata(etree.fromstring(body))
return resp, body
@@ -186,7 +185,7 @@
post_body = Element('meta', key=key)
post_body.append(Text(v))
resp, body = self.put('images/%s/metadata/%s' % (str(image_id), key),
- str(Document(post_body)), self.headers)
+ str(Document(post_body)))
body = xml_to_json(etree.fromstring(body))
return resp, body
@@ -194,14 +193,13 @@
"""Sets the value for a specific image metadata key."""
post_body = Document('meta', Text(meta), key=key)
resp, body = self.put('images/%s/metadata/%s' % (str(image_id), key),
- post_body, self.headers)
+ post_body)
body = xml_to_json(etree.fromstring(body))
return resp, body['meta']
def delete_image_metadata_item(self, image_id, key):
"""Deletes a single image metadata key/value pair."""
- return self.delete("images/%s/metadata/%s" % (str(image_id), key),
- self.headers)
+ return self.delete("images/%s/metadata/%s" % (str(image_id), key))
def is_resource_deleted(self, id):
try:
diff --git a/tempest/services/compute/xml/instance_usage_audit_log_client.py b/tempest/services/compute/xml/instance_usage_audit_log_client.py
index 562774b..baa6966 100644
--- a/tempest/services/compute/xml/instance_usage_audit_log_client.py
+++ b/tempest/services/compute/xml/instance_usage_audit_log_client.py
@@ -31,12 +31,12 @@
def list_instance_usage_audit_logs(self):
url = 'os-instance_usage_audit_log'
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
instance_usage_audit_logs = xml_to_json(etree.fromstring(body))
return resp, instance_usage_audit_logs
def get_instance_usage_audit_log(self, time_before):
url = 'os-instance_usage_audit_log/%s' % time_before
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
instance_usage_audit_log = xml_to_json(etree.fromstring(body))
return resp, instance_usage_audit_log
diff --git a/tempest/services/compute/xml/interfaces_client.py b/tempest/services/compute/xml/interfaces_client.py
index 4194d7d..6155cd6 100644
--- a/tempest/services/compute/xml/interfaces_client.py
+++ b/tempest/services/compute/xml/interfaces_client.py
@@ -42,7 +42,7 @@
return iface
def list_interfaces(self, server):
- resp, body = self.get('servers/%s/os-interface' % server, self.headers)
+ resp, body = self.get('servers/%s/os-interface' % server)
node = etree.fromstring(body)
interfaces = [self._process_xml_interface(x)
for x in node.getchildren()]
@@ -70,14 +70,12 @@
iface.append(_fixed_ips)
doc.append(iface)
resp, body = self.post('servers/%s/os-interface' % server,
- headers=self.headers,
body=str(doc))
body = self._process_xml_interface(etree.fromstring(body))
return resp, body
def show_interface(self, server, port_id):
- resp, body = self.get('servers/%s/os-interface/%s' % (server, port_id),
- self.headers)
+ resp, body = self.get('servers/%s/os-interface/%s' % (server, port_id))
body = self._process_xml_interface(etree.fromstring(body))
return resp, body
diff --git a/tempest/services/compute/xml/keypairs_client.py b/tempest/services/compute/xml/keypairs_client.py
index 92fade4..5641251 100644
--- a/tempest/services/compute/xml/keypairs_client.py
+++ b/tempest/services/compute/xml/keypairs_client.py
@@ -33,13 +33,13 @@
self.service = CONF.compute.catalog_type
def list_keypairs(self):
- resp, body = self.get("os-keypairs", self.headers)
+ resp, body = self.get("os-keypairs")
node = etree.fromstring(body)
body = [{'keypair': xml_to_json(x)} for x in node.getchildren()]
return resp, body
def get_keypair(self, key_name):
- resp, body = self.get("os-keypairs/%s" % str(key_name), self.headers)
+ resp, body = self.get("os-keypairs/%s" % str(key_name))
body = xml_to_json(etree.fromstring(body))
return resp, body
@@ -61,8 +61,7 @@
doc.append(keypair_element)
- resp, body = self.post("os-keypairs",
- headers=self.headers, body=str(doc))
+ resp, body = self.post("os-keypairs", body=str(doc))
body = xml_to_json(etree.fromstring(body))
return resp, body
diff --git a/tempest/services/compute/xml/limits_client.py b/tempest/services/compute/xml/limits_client.py
index 2a8fbec..61c434c 100644
--- a/tempest/services/compute/xml/limits_client.py
+++ b/tempest/services/compute/xml/limits_client.py
@@ -30,7 +30,7 @@
self.service = CONF.compute.catalog_type
def get_absolute_limits(self):
- resp, body = self.get("limits", self.headers)
+ resp, body = self.get("limits")
body = objectify.fromstring(body)
lim = NS + 'absolute'
ret = {}
@@ -41,7 +41,7 @@
return resp, ret
def get_specific_absolute_limit(self, absolute_limit):
- resp, body = self.get("limits", self.headers)
+ resp, body = self.get("limits")
body = objectify.fromstring(body)
lim = NS + 'absolute'
ret = {}
diff --git a/tempest/services/compute/xml/quotas_client.py b/tempest/services/compute/xml/quotas_client.py
index f1041f0..00c3275 100644
--- a/tempest/services/compute/xml/quotas_client.py
+++ b/tempest/services/compute/xml/quotas_client.py
@@ -50,7 +50,7 @@
"""List the quota set for a tenant."""
url = 'os-quota-sets/%s' % str(tenant_id)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = xml_to_json(etree.fromstring(body))
body = self._format_quota(body)
return resp, body
@@ -59,7 +59,7 @@
"""List the default quota set for a tenant."""
url = 'os-quota-sets/%s/defaults' % str(tenant_id)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = xml_to_json(etree.fromstring(body))
body = self._format_quota(body)
return resp, body
@@ -119,8 +119,7 @@
post_body.add_attr('security_groups', security_groups)
resp, body = self.put('os-quota-sets/%s' % str(tenant_id),
- str(Document(post_body)),
- self.headers)
+ str(Document(post_body)))
body = xml_to_json(etree.fromstring(body))
body = self._format_quota(body)
return resp, body
diff --git a/tempest/services/compute/xml/security_groups_client.py b/tempest/services/compute/xml/security_groups_client.py
index 83072be..947f6da 100644
--- a/tempest/services/compute/xml/security_groups_client.py
+++ b/tempest/services/compute/xml/security_groups_client.py
@@ -51,14 +51,14 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = self._parse_array(etree.fromstring(body))
return resp, body
def get_security_group(self, security_group_id):
"""Get the details of a Security Group."""
url = "os-security-groups/%s" % str(security_group_id)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = self._parse_body(etree.fromstring(body))
return resp, body
@@ -73,8 +73,7 @@
des.append(Text(content=description))
security_group.append(des)
resp, body = self.post('os-security-groups',
- str(Document(security_group)),
- self.headers)
+ str(Document(security_group)))
body = self._parse_body(etree.fromstring(body))
return resp, body
@@ -97,15 +96,13 @@
security_group.append(des)
resp, body = self.put('os-security-groups/%s' %
str(security_group_id),
- str(Document(security_group)),
- self.headers)
+ str(Document(security_group)))
body = self._parse_body(etree.fromstring(body))
return resp, body
def delete_security_group(self, security_group_id):
"""Deletes the provided Security Group."""
- return self.delete('os-security-groups/%s' %
- str(security_group_id), self.headers)
+ return self.delete('os-security-groups/%s' % str(security_group_id))
def create_security_group_rule(self, parent_group_id, ip_proto, from_port,
to_port, **kwargs):
@@ -136,19 +133,19 @@
group_rule.append(element)
url = 'os-security-group-rules'
- resp, body = self.post(url, str(Document(group_rule)), self.headers)
+ resp, body = self.post(url, str(Document(group_rule)))
body = self._parse_body(etree.fromstring(body))
return resp, body
def delete_security_group_rule(self, group_rule_id):
"""Deletes the provided Security Group rule."""
return self.delete('os-security-group-rules/%s' %
- str(group_rule_id), self.headers)
+ str(group_rule_id))
def list_security_group_rules(self, security_group_id):
"""List all rules for a security group."""
url = "os-security-groups"
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = etree.fromstring(body)
secgroups = body.getchildren()
for secgroup in secgroups:
@@ -157,3 +154,10 @@
rules = [xml_to_json(x) for x in node.getchildren()]
return resp, rules
raise exceptions.NotFound('No such Security Group')
+
+ def is_resource_deleted(self, id):
+ try:
+ self.get_security_group(id)
+ except exceptions.NotFound:
+ return True
+ return False
diff --git a/tempest/services/compute/xml/servers_client.py b/tempest/services/compute/xml/servers_client.py
index 37980c9..a182d35 100644
--- a/tempest/services/compute/xml/servers_client.py
+++ b/tempest/services/compute/xml/servers_client.py
@@ -186,7 +186,7 @@
def get_server(self, server_id):
"""Returns the details of an existing server."""
- resp, body = self.get("servers/%s" % str(server_id), self.headers)
+ resp, body = self.get("servers/%s" % str(server_id))
server = self._parse_server(etree.fromstring(body))
return resp, server
@@ -245,7 +245,7 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
servers = self._parse_array(etree.fromstring(body))
return resp, {"servers": servers}
@@ -254,7 +254,7 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
servers = self._parse_array(etree.fromstring(body))
return resp, {"servers": servers}
@@ -282,8 +282,7 @@
meta.append(Text(v))
metadata.append(meta)
- resp, body = self.put('servers/%s' % str(server_id),
- str(doc), self.headers)
+ resp, body = self.put('servers/%s' % str(server_id), str(doc))
return resp, xml_to_json(etree.fromstring(body))
def create_server(self, name, image_ref, flavor_ref, **kwargs):
@@ -356,7 +355,7 @@
temp.append(Text(k['contents']))
personality.append(temp)
- resp, body = self.post('servers', str(Document(server)), self.headers)
+ resp, body = self.post('servers', str(Document(server)))
server = self._parse_server(etree.fromstring(body))
return resp, server
@@ -394,7 +393,7 @@
def list_addresses(self, server_id):
"""Lists all addresses for a server."""
- resp, body = self.get("servers/%s/ips" % str(server_id), self.headers)
+ resp, body = self.get("servers/%s/ips" % str(server_id))
networks = {}
xml_list = etree.fromstring(body)
@@ -407,8 +406,7 @@
def list_addresses_by_network(self, server_id, network_id):
"""Lists all addresses of a specific network type for a server."""
resp, body = self.get("servers/%s/ips/%s" % (str(server_id),
- network_id),
- self.headers)
+ network_id))
network = self._parse_network(etree.fromstring(body))
return resp, network
@@ -417,8 +415,7 @@
if 'xmlns' not in kwargs:
kwargs['xmlns'] = XMLNS_11
doc = Document((Element(action_name, **kwargs)))
- resp, body = self.post("servers/%s/action" % server_id,
- str(doc), self.headers)
+ resp, body = self.post("servers/%s/action" % server_id, str(doc))
if response_key is not None:
body = xml_to_json(etree.fromstring(body))
return resp, body
@@ -435,8 +432,7 @@
adminPass=password)
def get_password(self, server_id):
- resp, body = self.get("servers/%s/os-server-password" %
- str(server_id), self.headers)
+ resp, body = self.get("servers/%s/os-server-password" % str(server_id))
body = xml_to_json(etree.fromstring(body))
return resp, body
@@ -446,8 +442,7 @@
Note that this does not actually change the instance server
password.
"""
- return self.delete("servers/%s/os-server-password" %
- str(server_id))
+ return self.delete("servers/%s/os-server-password" % str(server_id))
def reboot(self, server_id, reboot_type):
return self.action(server_id, "reboot", None, type=reboot_type)
@@ -478,7 +473,7 @@
metadata.append(meta)
resp, body = self.post('servers/%s/action' % server_id,
- str(Document(rebuild)), self.headers)
+ str(Document(rebuild)))
server = self._parse_server(etree.fromstring(body))
return resp, server
@@ -523,12 +518,11 @@
host=dest_host)
resp, body = self.post("servers/%s/action" % str(server_id),
- str(Document(req_body)), self.headers)
+ str(Document(req_body)))
return resp, body
def list_server_metadata(self, server_id):
- resp, body = self.get("servers/%s/metadata" % str(server_id),
- self.headers)
+ resp, body = self.get("servers/%s/metadata" % str(server_id))
body = self._parse_key_value(etree.fromstring(body))
return resp, body
@@ -541,8 +535,7 @@
meta_element = Element("meta", key=k)
meta_element.append(Text(v))
metadata.append(meta_element)
- resp, body = self.put('servers/%s/metadata' % str(server_id),
- str(doc), self.headers)
+ resp, body = self.put('servers/%s/metadata' % str(server_id), str(doc))
return resp, xml_to_json(etree.fromstring(body))
def update_server_metadata(self, server_id, meta):
@@ -554,13 +547,12 @@
meta_element.append(Text(v))
metadata.append(meta_element)
resp, body = self.post("/servers/%s/metadata" % str(server_id),
- str(doc), headers=self.headers)
+ str(doc))
body = xml_to_json(etree.fromstring(body))
return resp, body
def get_server_metadata_item(self, server_id, key):
- resp, body = self.get("servers/%s/metadata/%s" % (str(server_id), key),
- headers=self.headers)
+ resp, body = self.get("servers/%s/metadata/%s" % (str(server_id), key))
return resp, dict([(etree.fromstring(body).attrib['key'],
xml_to_json(etree.fromstring(body)))])
@@ -571,7 +563,7 @@
meta_element.append(Text(v))
doc.append(meta_element)
resp, body = self.put('servers/%s/metadata/%s' % (str(server_id), key),
- str(doc), self.headers)
+ str(doc))
return resp, xml_to_json(etree.fromstring(body))
def delete_server_metadata_item(self, server_id, key):
@@ -588,7 +580,7 @@
List the virtual interfaces used in an instance.
"""
resp, body = self.get('/'.join(['servers', server_id,
- 'os-virtual-interfaces']), self.headers)
+ 'os-virtual-interfaces']))
virt_int = self._parse_xml_virtual_interfaces(etree.fromstring(body))
return resp, virt_int
@@ -604,7 +596,7 @@
post_body = Element("volumeAttachment", volumeId=volume_id,
device=device)
resp, body = self.post('servers/%s/os-volume_attachments' % server_id,
- str(Document(post_body)), self.headers)
+ str(Document(post_body)))
return resp, body
def detach_volume(self, server_id, volume_id):
@@ -616,22 +608,20 @@
def get_server_diagnostics(self, server_id):
"""Get the usage data for a server."""
- resp, body = self.get("servers/%s/diagnostics" % server_id,
- self.headers)
+ resp, body = self.get("servers/%s/diagnostics" % server_id)
body = xml_to_json(etree.fromstring(body))
return resp, body
def list_instance_actions(self, server_id):
"""List the provided server action."""
- resp, body = self.get("servers/%s/os-instance-actions" % server_id,
- self.headers)
+ resp, body = self.get("servers/%s/os-instance-actions" % server_id)
body = self._parse_array(etree.fromstring(body))
return resp, body
def get_instance_action(self, server_id, request_id):
"""Returns the action details of the provided server."""
resp, body = self.get("servers/%s/os-instance-actions/%s" %
- (server_id, request_id), self.headers)
+ (server_id, request_id))
body = xml_to_json(etree.fromstring(body))
return resp, body
diff --git a/tempest/services/compute/xml/services_client.py b/tempest/services/compute/xml/services_client.py
index c28dc12..5943ea9 100644
--- a/tempest/services/compute/xml/services_client.py
+++ b/tempest/services/compute/xml/services_client.py
@@ -38,7 +38,7 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
node = etree.fromstring(body)
body = [xml_to_json(x) for x in node.getchildren()]
return resp, body
@@ -53,8 +53,7 @@
post_body.add_attr('binary', binary)
post_body.add_attr('host', host_name)
- resp, body = self.put('os-services/enable', str(Document(post_body)),
- self.headers)
+ resp, body = self.put('os-services/enable', str(Document(post_body)))
body = xml_to_json(etree.fromstring(body))
return resp, body
@@ -68,7 +67,6 @@
post_body.add_attr('binary', binary)
post_body.add_attr('host', host_name)
- resp, body = self.put('os-services/disable', str(Document(post_body)),
- self.headers)
+ resp, body = self.put('os-services/disable', str(Document(post_body)))
body = xml_to_json(etree.fromstring(body))
return resp, body
diff --git a/tempest/services/compute/xml/tenant_usages_client.py b/tempest/services/compute/xml/tenant_usages_client.py
index 93eeb00..96c3147 100644
--- a/tempest/services/compute/xml/tenant_usages_client.py
+++ b/tempest/services/compute/xml/tenant_usages_client.py
@@ -39,7 +39,7 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
tenant_usage = self._parse_array(etree.fromstring(body))
return resp, tenant_usage['tenant_usage']
@@ -48,6 +48,6 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
tenant_usage = self._parse_array(etree.fromstring(body))
return resp, tenant_usage
diff --git a/tempest/services/compute/xml/volumes_extensions_client.py b/tempest/services/compute/xml/volumes_extensions_client.py
index 941cd69..a43fc21 100644
--- a/tempest/services/compute/xml/volumes_extensions_client.py
+++ b/tempest/services/compute/xml/volumes_extensions_client.py
@@ -60,7 +60,7 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = etree.fromstring(body)
volumes = []
if body is not None:
@@ -74,7 +74,7 @@
if params:
url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = etree.fromstring(body)
volumes = []
if body is not None:
@@ -84,7 +84,7 @@
def get_volume(self, volume_id):
"""Returns the details of a single volume."""
url = "os-volumes/%s" % str(volume_id)
- resp, body = self.get(url, self.headers)
+ resp, body = self.get(url)
body = etree.fromstring(body)
return resp, self._parse_volume(body)
@@ -110,8 +110,7 @@
meta.append(Text(value))
_metadata.append(meta)
- resp, body = self.post('os-volumes', str(Document(volume)),
- self.headers)
+ resp, body = self.post('os-volumes', str(Document(volume)))
body = xml_to_json(etree.fromstring(body))
return resp, body
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index ec3229e..b044e4d 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -14,7 +14,6 @@
# under the License.
import json
-import urlparse
from tempest.common.rest_client import RestClient
from tempest import config
@@ -445,11 +444,10 @@
def __init__(self):
super(V3TokenClientJSON, self).__init__(None)
auth_url = CONF.identity.uri_v3
- # If the v3 url is not set, get it from the v2 one
- if auth_url is None:
- auth_url = CONF.identity.uri.replace(urlparse.urlparse(
- CONF.identity.uri).path, "/v3")
-
+ if not auth_url and CONF.identity_feature_enabled.api_v3:
+ raise exceptions.InvalidConfiguration('you must specify a v3 uri '
+ 'if using the v3 identity '
+ 'api')
if 'auth/tokens' not in auth_url:
auth_url = auth_url.rstrip('/') + '/auth/tokens'
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index 094e567..c1faebb 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -51,3 +51,21 @@
resp, body = self.get(url)
body = json.loads(body)
return resp, body['service']
+
+ def create_service(self, serv_type, name=None, description=None,
+ enabled=True):
+ body_dict = {
+ "name": name,
+ 'type': serv_type,
+ 'enabled': enabled,
+ "description": description,
+ }
+ body = json.dumps({'service': body_dict})
+ resp, body = self.post("services", body)
+ body = json.loads(body)
+ return resp, body["service"]
+
+ def delete_service(self, serv_id):
+ url = "services/" + serv_id
+ resp, body = self.delete(url)
+ return resp, body
diff --git a/tempest/services/identity/v3/xml/identity_client.py b/tempest/services/identity/v3/xml/identity_client.py
index 6304628..5ae0461 100644
--- a/tempest/services/identity/v3/xml/identity_client.py
+++ b/tempest/services/identity/v3/xml/identity_client.py
@@ -14,7 +14,6 @@
# under the License.
import json
-import urlparse
from lxml import etree
@@ -432,10 +431,10 @@
def __init__(self):
super(V3TokenClientXML, self).__init__(None)
auth_url = CONF.identity.uri_v3
- # If the v3 url is not set, get it from the v2 one
- if auth_url is None:
- auth_url = CONF.identity.uri.replace(urlparse.urlparse(
- CONF.identity.uri).path, "/v3")
+ if not auth_url and CONF.identity_feature_enabled.api_v3:
+ raise exceptions.InvalidConfiguration('you must specify a v3 uri '
+ 'if using the v3 identity '
+ 'api')
if 'auth/tokens' not in auth_url:
auth_url = auth_url.rstrip('/') + '/auth/tokens'
diff --git a/tempest/services/identity/v3/xml/service_client.py b/tempest/services/identity/v3/xml/service_client.py
index f43ed2c..be6c443 100644
--- a/tempest/services/identity/v3/xml/service_client.py
+++ b/tempest/services/identity/v3/xml/service_client.py
@@ -67,3 +67,18 @@
resp, body = self.get(url)
body = self._parse_body(etree.fromstring(body))
return resp, body
+
+ def create_service(self, serv_type, name=None, description=None):
+ post_body = Element("service",
+ xmlns=XMLNS,
+ name=name,
+ description=description,
+ type=serv_type)
+ resp, body = self.post("services", str(Document(post_body)))
+ body = self._parse_body(etree.fromstring(body))
+ return resp, body
+
+ def delete_service(self, serv_id):
+ url = "services/" + serv_id
+ resp, body = self.delete(url)
+ return resp, body
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 1458c7b..1197a94 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -193,34 +193,6 @@
body = json.loads(body)
return resp, body
- def create_vip(self, name, protocol, protocol_port, subnet_id, pool_id):
- post_body = {
- "vip": {
- "protocol": protocol,
- "name": name,
- "subnet_id": subnet_id,
- "pool_id": pool_id,
- "protocol_port": protocol_port
- }
- }
- body = json.dumps(post_body)
- uri = '%s/lb/vips' % (self.uri_prefix)
- resp, body = self.post(uri, body)
- body = json.loads(body)
- return resp, body
-
- def update_vip(self, vip_id, new_name):
- put_body = {
- "vip": {
- "name": new_name,
- }
- }
- body = json.dumps(put_body)
- uri = '%s/lb/vips/%s' % (self.uri_prefix, vip_id)
- resp, body = self.put(uri, body)
- body = json.loads(body)
- return resp, body
-
def create_member(self, address, protocol_port, pool_id):
post_body = {
"member": {
@@ -247,33 +219,6 @@
body = json.loads(body)
return resp, body
- def create_health_monitor(self, delay, max_retries, Type, timeout):
- post_body = {
- "health_monitor": {
- "delay": delay,
- "max_retries": max_retries,
- "type": Type,
- "timeout": timeout
- }
- }
- body = json.dumps(post_body)
- uri = '%s/lb/health_monitors' % (self.uri_prefix)
- resp, body = self.post(uri, body)
- body = json.loads(body)
- return resp, body
-
- def update_health_monitor(self, admin_state_up, uuid):
- put_body = {
- "health_monitor": {
- "admin_state_up": admin_state_up
- }
- }
- body = json.dumps(put_body)
- uri = '%s/lb/health_monitors/%s' % (self.uri_prefix, uuid)
- resp, body = self.put(uri, body)
- body = json.loads(body)
- return resp, body
-
def associate_health_monitor_with_pool(self, health_monitor_id,
pool_id):
post_body = {
@@ -340,6 +285,19 @@
body = json.loads(body)
return resp, body
+ def list_pools_hosted_by_one_lbaas_agent(self, agent_id):
+ uri = '%s/agents/%s/loadbalancer-pools' % (self.uri_prefix, agent_id)
+ resp, body = self.get(uri)
+ body = json.loads(body)
+ return resp, body
+
+ def show_lbaas_agent_hosting_pool(self, pool_id):
+ uri = ('%s/lb/pools/%s/loadbalancer-agent' %
+ (self.uri_prefix, pool_id))
+ resp, body = self.get(uri)
+ body = json.loads(body)
+ return resp, body
+
def list_routers_on_l3_agent(self, agent_id):
uri = '%s/agents/%s/l3-routers' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
diff --git a/tempest/services/network/network_client_base.py b/tempest/services/network/network_client_base.py
index f3f8d70..f1bf548 100644
--- a/tempest/services/network/network_client_base.py
+++ b/tempest/services/network/network_client_base.py
@@ -59,19 +59,15 @@
raise NotImplementedError
def post(self, uri, body, headers=None):
- headers = headers or self.rest_client.headers
return self.rest_client.post(uri, body, headers)
def put(self, uri, body, headers=None):
- headers = headers or self.rest_client.headers
return self.rest_client.put(uri, body, headers)
def get(self, uri, headers=None):
- headers = headers or self.rest_client.headers
return self.rest_client.get(uri, headers)
def delete(self, uri, headers=None):
- headers = headers or self.rest_client.headers
return self.rest_client.delete(uri, headers)
def deserialize_list(self, body):
diff --git a/tempest/services/network/xml/network_client.py b/tempest/services/network/xml/network_client.py
index 720c842..135e211 100644
--- a/tempest/services/network/xml/network_client.py
+++ b/tempest/services/network/xml/network_client.py
@@ -101,32 +101,6 @@
body = _root_tag_fetcher_and_xml_to_json_parse(body)
return resp, body
- def create_vip(self, name, protocol, protocol_port, subnet_id, pool_id):
- uri = '%s/lb/vips' % (self.uri_prefix)
- post_body = Element("vip")
- p1 = Element("name", name)
- p2 = Element("protocol", protocol)
- p3 = Element("protocol_port", protocol_port)
- p4 = Element("subnet_id", subnet_id)
- p5 = Element("pool_id", pool_id)
- post_body.append(p1)
- post_body.append(p2)
- post_body.append(p3)
- post_body.append(p4)
- post_body.append(p5)
- resp, body = self.post(uri, str(Document(post_body)))
- body = _root_tag_fetcher_and_xml_to_json_parse(body)
- return resp, body
-
- def update_vip(self, vip_id, new_name):
- uri = '%s/lb/vips/%s' % (self.uri_prefix, str(vip_id))
- put_body = Element("vip")
- p2 = Element("name", new_name)
- put_body.append(p2)
- resp, body = self.put(uri, str(Document(put_body)))
- body = _root_tag_fetcher_and_xml_to_json_parse(body)
- return resp, body
-
def create_member(self, address, protocol_port, pool_id):
uri = '%s/lb/members' % (self.uri_prefix)
post_body = Element("member")
@@ -149,30 +123,6 @@
body = _root_tag_fetcher_and_xml_to_json_parse(body)
return resp, body
- def create_health_monitor(self, delay, max_retries, Type, timeout):
- uri = '%s/lb/health_monitors' % (self.uri_prefix)
- post_body = Element("health_monitor")
- p1 = Element("delay", delay)
- p2 = Element("max_retries", max_retries)
- p3 = Element("type", Type)
- p4 = Element("timeout", timeout)
- post_body.append(p1)
- post_body.append(p2)
- post_body.append(p3)
- post_body.append(p4)
- resp, body = self.post(uri, str(Document(post_body)))
- body = _root_tag_fetcher_and_xml_to_json_parse(body)
- return resp, body
-
- def update_health_monitor(self, admin_state_up, uuid):
- uri = '%s/lb/health_monitors/%s' % (self.uri_prefix, str(uuid))
- put_body = Element("health_monitor")
- p2 = Element("admin_state_up", admin_state_up)
- put_body.append(p2)
- resp, body = self.put(uri, str(Document(put_body)))
- body = _root_tag_fetcher_and_xml_to_json_parse(body)
- return resp, body
-
def associate_health_monitor_with_pool(self, health_monitor_id,
pool_id):
uri = '%s/lb/pools/%s/health_monitors' % (self.uri_prefix,
@@ -289,6 +239,20 @@
body = _root_tag_fetcher_and_xml_to_json_parse(body)
return resp, body
+ def list_pools_hosted_by_one_lbaas_agent(self, agent_id):
+ uri = '%s/agents/%s/loadbalancer-pools' % (self.uri_prefix, agent_id)
+ resp, body = self.get(uri)
+ pools = parse_array(etree.fromstring(body))
+ body = {'pools': pools}
+ return resp, body
+
+ def show_lbaas_agent_hosting_pool(self, pool_id):
+ uri = ('%s/lb/pools/%s/loadbalancer-agent' %
+ (self.uri_prefix, pool_id))
+ resp, body = self.get(uri)
+ body = _root_tag_fetcher_and_xml_to_json_parse(body)
+ return resp, body
+
def list_routers_on_l3_agent(self, agent_id):
uri = '%s/agents/%s/l3-routers' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
diff --git a/tempest/services/volume/xml/admin/volume_hosts_client.py b/tempest/services/volume/xml/admin/volume_hosts_client.py
index 59652fa..080e3d1 100644
--- a/tempest/services/volume/xml/admin/volume_hosts_client.py
+++ b/tempest/services/volume/xml/admin/volume_hosts_client.py
@@ -1,4 +1,4 @@
-# Copyright 2013 Openstack Foundation.
+# Copyright 2013 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py
index 2b500ae..94c1ff6 100644
--- a/tempest/services/volume/xml/volumes_client.py
+++ b/tempest/services/volume/xml/volumes_client.py
@@ -17,6 +17,7 @@
import urllib
from lxml import etree
+from xml.sax.saxutils import escape
from tempest.common.rest_client import RestClientXML
from tempest import config
@@ -358,7 +359,8 @@
post_body = Element('metadata')
for k, v in meta.items():
data = Element('meta', key=k)
- data.append(Text(v))
+ # Escape value to allow for special XML chars
+ data.append(Text(escape(v)))
post_body.append(data)
return post_body
diff --git a/tempest/test.py b/tempest/test.py
index 253e946..22aa3f2 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -312,7 +312,7 @@
@classmethod
def get_client_manager(cls, interface=None):
"""
- Returns an Openstack client manager
+ Returns an OpenStack client manager
"""
cls.isolated_creds = isolated_creds.IsolatedCreds(
cls.__name__, network_resources=cls.network_resources)
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index a6932bc..399a3c8 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -278,7 +278,7 @@
# TODO(afazekas): ping test. dependecy/permission ?
self.assertVolumeStatusWait(volume, "available")
- # NOTE(afazekas): it may be reports availble before it is available
+ # NOTE(afazekas): it may be reports available before it is available
ssh = RemoteClient(address.public_ip,
CONF.compute.ssh_user,
diff --git a/tools/install_venv.py b/tools/install_venv.py
index e41ca43..96b8279 100644
--- a/tools/install_venv.py
+++ b/tools/install_venv.py
@@ -25,12 +25,12 @@
def print_help(venv, root):
help = """
- Openstack development environment setup is complete.
+ OpenStack development environment setup is complete.
- Openstack development uses virtualenv to track and manage Python
+ OpenStack development uses virtualenv to track and manage Python
dependencies while in development and testing.
- To activate the Openstack virtualenv for the extent of your current shell
+ To activate the OpenStack virtualenv for the extent of your current shell
session you can run:
$ source %s/bin/activate
diff --git a/tools/tempest_auto_config.py b/tools/tempest_auto_config.py
index 9aeb077..5b8d05b 100644
--- a/tools/tempest_auto_config.py
+++ b/tools/tempest_auto_config.py
@@ -13,14 +13,14 @@
# License for the specific language governing permissions and limitations
# under the License.
#
-# This script aims to configure an initial Openstack environment with all the
-# necessary configurations for tempest's run using nothing but Openstack's
+# This script aims to configure an initial OpenStack environment with all the
+# necessary configurations for tempest's run using nothing but OpenStack's
# native API.
# That includes, creating users, tenants, registering images (cirros),
# configuring neutron and so on.
#
# ASSUMPTION: this script is run by an admin user as it is meant to configure
-# the Openstack environment prior to actual use.
+# the OpenStack environment prior to actual use.
# Config
import ConfigParser
@@ -32,7 +32,7 @@
import glanceclient as glance_client
import keystoneclient.v2_0.client as keystone_client
-# Import Openstack exceptions
+# Import OpenStack exceptions
import glanceclient.exc as glance_exception
import keystoneclient.exceptions as keystone_exception
@@ -88,7 +88,7 @@
def get_image_client(self, version="1", *args, **kwargs):
"""
- This method returns Openstack glance python client
+ This method returns OpenStack glance python client
:param version: a string representing the version of the glance client
to use.
:param string endpoint: A user-supplied endpoint URL for the glance
@@ -333,7 +333,7 @@
"""
Creates images for tempest's use and registers the environment variables
IMAGE_ID and IMAGE_ID_ALT with registered images
- :param image_client: Openstack python image client
+ :param image_client: OpenStack python image client
:param config: a ConfigParser object representing the tempest config file
:param config_section: the section name where the IMAGE ids are set
:param download_url: the URL from which we should download the UEC tar