Merge "Add plugin interface for extending sample config generation"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 7d4ba86..c97eb97 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -5,12 +5,14 @@
#
# Print debugging output (set logging level to DEBUG instead of
-# default WARNING level). (boolean value)
+# default INFO level). (boolean value)
#debug = false
-# Print more verbose output (set logging level to INFO instead of
-# default WARNING level). (boolean value)
-#verbose = false
+# If set to false, will disable INFO logging level, making WARNING the
+# default. (boolean value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+#verbose = true
# The name of a logging configuration file. This file is appended to
# any existing logging configuration files. For details about logging
@@ -502,18 +504,29 @@
# From tempest.config
#
-# A regex to determine which requests should be traced. This is a
-# regex to match the caller for rest client requests to be able to
+# A regex to determine which requests should be traced.
+#
+# This is a regex to match the caller for rest client requests to be
+# able to
# selectively trace calls out of specific classes and methods. It
-# largely exists for test development, and is not expected to be used
-# in a real deploy of tempest. This will be matched against the
-# discovered ClassName:method in the test environment. Expected
-# values for this field are: * ClassName:test_method_name - traces
-# one test_method * ClassName:setUp(Class) - traces specific setup
-# functions * ClassName:tearDown(Class) - traces specific teardown
-# functions * ClassName:_run_cleanups - traces the cleanup functions
+# largely
+# exists for test development, and is not expected to be used in a
+# real deploy
+# of tempest. This will be matched against the discovered
+# ClassName:method
+# in the test environment.
+#
+# Expected values for this field are:
+#
+# * ClassName:test_method_name - traces one test_method
+# * ClassName:setUp(Class) - traces specific setup functions
+# * ClassName:tearDown(Class) - traces specific teardown functions
+# * ClassName:_run_cleanups - traces the cleanup functions
+#
# If nothing is specified, this feature is not enabled. To trace
-# everything specify .* as the regex. (string value)
+# everything
+# specify .* as the regex.
+# (string value)
#trace_requests =
diff --git a/openstack-common.conf b/openstack-common.conf
index 16ba6a7..acb1437 100644
--- a/openstack-common.conf
+++ b/openstack-common.conf
@@ -2,7 +2,6 @@
# The list of modules to copy from openstack-common
module=install_venv_common
-module=versionutils
module=with_venv
module=install_venv
diff --git a/setup.cfg b/setup.cfg
index f28c481..ab40f12 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -22,7 +22,7 @@
packages =
tempest
data_files =
- /etc/tempest = etc/*
+ etc/tempest = etc/*
[entry_points]
console_scripts =
diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py
index 364d080..a3c25a2 100644
--- a/tempest/api/compute/admin/test_flavors.py
+++ b/tempest/api/compute/admin/test_flavors.py
@@ -63,13 +63,13 @@
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
# Create the flavor
- flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- flavor_id,
+ flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=flavor_id,
ephemeral=self.ephemeral,
swap=self.swap,
- rxtx=self.rxtx)
+ rxtx_factor=self.rxtx)
self.addCleanup(self.flavor_clean_up, flavor['id'])
self.assertEqual(flavor['name'], flavor_name)
self.assertEqual(flavor['vcpus'], self.vcpus)
@@ -115,13 +115,13 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
- flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
ephemeral=self.ephemeral,
swap=self.swap,
- rxtx=self.rxtx)
+ rxtx_factor=self.rxtx)
self.addCleanup(self.flavor_clean_up, flavor['id'])
flag = False
# Verify flavor is retrieved
@@ -147,10 +147,10 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
- flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id)
+ flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id)
self.addCleanup(self.flavor_clean_up, flavor['id'])
self.assertEqual(flavor['name'], flavor_name)
self.assertEqual(flavor['ram'], self.ram)
@@ -182,10 +182,10 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
- flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
is_public="False")
self.addCleanup(self.flavor_clean_up, flavor['id'])
# Verify flavor is retrieved
@@ -211,10 +211,10 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
- flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
is_public="False")
self.addCleanup(self.flavor_clean_up, flavor['id'])
@@ -231,10 +231,10 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
- flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
is_public="True")
self.addCleanup(self.flavor_clean_up, flavor['id'])
flag = False
@@ -254,18 +254,18 @@
flavor_name_public = data_utils.rand_name(self.flavor_name_prefix)
# Create a non public flavor
- flavor = self.client.create_flavor(flavor_name_not_public,
- self.ram, self.vcpus,
- self.disk,
- flavor_id_not_public,
+ flavor = self.client.create_flavor(name=flavor_name_not_public,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=flavor_id_not_public,
is_public="False")
self.addCleanup(self.flavor_clean_up, flavor['id'])
# Create a public flavor
- flavor = self.client.create_flavor(flavor_name_public,
- self.ram, self.vcpus,
- self.disk,
- flavor_id_public,
+ flavor = self.client.create_flavor(name=flavor_name_public,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=flavor_id_public,
is_public="True")
self.addCleanup(self.flavor_clean_up, flavor['id'])
@@ -294,10 +294,10 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
ram = "1024"
- flavor = self.client.create_flavor(flavor_name,
- ram, self.vcpus,
- self.disk,
- new_flavor_id)
+ flavor = self.client.create_flavor(name=flavor_name,
+ ram=ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id)
self.addCleanup(self.flavor_clean_up, flavor['id'])
self.assertEqual(flavor['name'], flavor_name)
self.assertEqual(flavor['vcpus'], self.vcpus)
diff --git a/tempest/api/compute/admin/test_flavors_access.py b/tempest/api/compute/admin/test_flavors_access.py
index 2baa53e..ccfe20b 100644
--- a/tempest/api/compute/admin/test_flavors_access.py
+++ b/tempest/api/compute/admin/test_flavors_access.py
@@ -56,10 +56,10 @@
# private flavor will return an empty access list
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ new_flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
flavor_access = self.client.list_flavor_access(new_flavor_id)
@@ -70,10 +70,10 @@
# Test to add and remove flavor access to a given tenant.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ new_flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# Add flavor access to a tenant.
diff --git a/tempest/api/compute/admin/test_flavors_access_negative.py b/tempest/api/compute/admin/test_flavors_access_negative.py
index e5ae23b..03898c2 100644
--- a/tempest/api/compute/admin/test_flavors_access_negative.py
+++ b/tempest/api/compute/admin/test_flavors_access_negative.py
@@ -57,10 +57,10 @@
# Test to list flavor access with exceptions by querying public flavor
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ new_flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
is_public='True')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
self.assertRaises(lib_exc.NotFound,
@@ -73,10 +73,10 @@
# Test to add flavor access as a user without admin privileges.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ new_flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
self.assertRaises(lib_exc.Forbidden,
@@ -90,10 +90,10 @@
# Test to remove flavor access as a user without admin privileges.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ new_flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# Add flavor access to a tenant.
@@ -111,10 +111,10 @@
# Create a new flavor.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ new_flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
@@ -136,10 +136,10 @@
# Create a new flavor.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
+ new_flavor = self.client.create_flavor(name=flavor_name,
+ ram=self.ram, vcpus=self.vcpus,
+ disk=self.disk,
+ id=new_flavor_id,
is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
diff --git a/tempest/api/compute/admin/test_flavors_extra_specs.py b/tempest/api/compute/admin/test_flavors_extra_specs.py
index 6866c1a..6039cb2 100644
--- a/tempest/api/compute/admin/test_flavors_extra_specs.py
+++ b/tempest/api/compute/admin/test_flavors_extra_specs.py
@@ -50,12 +50,12 @@
swap = 1024
rxtx = 1
# Create a flavor so as to set/get/unset extra specs
- cls.flavor = cls.client.create_flavor(flavor_name,
- ram, vcpus,
- disk,
- cls.new_flavor_id,
+ cls.flavor = cls.client.create_flavor(name=flavor_name,
+ ram=ram, vcpus=vcpus,
+ disk=disk,
+ id=cls.new_flavor_id,
ephemeral=ephemeral,
- swap=swap, rxtx=rxtx)
+ swap=swap, rxtx_factor=rxtx)
@classmethod
def resource_cleanup(cls):
@@ -71,7 +71,7 @@
specs = {"key1": "value1", "key2": "value2"}
# SET extra specs to the flavor created in setUp
set_body = \
- self.client.set_flavor_extra_spec(self.flavor['id'], specs)
+ self.client.set_flavor_extra_spec(self.flavor['id'], **specs)
self.assertEqual(set_body, specs)
# GET extra specs and verify
get_body = self.client.list_flavor_extra_specs(self.flavor['id'])
@@ -96,7 +96,7 @@
@test.idempotent_id('a99dad88-ae1c-4fba-aeb4-32f898218bd0')
def test_flavor_non_admin_get_all_keys(self):
specs = {"key1": "value1", "key2": "value2"}
- self.client.set_flavor_extra_spec(self.flavor['id'], specs)
+ self.client.set_flavor_extra_spec(self.flavor['id'], **specs)
body = self.flavors_client.list_flavor_extra_specs(self.flavor['id'])
for key in specs:
@@ -104,8 +104,8 @@
@test.idempotent_id('12805a7f-39a3-4042-b989-701d5cad9c90')
def test_flavor_non_admin_get_specific_key(self):
- specs = {"key1": "value1", "key2": "value2"}
- body = self.client.set_flavor_extra_spec(self.flavor['id'], specs)
+ body = self.client.set_flavor_extra_spec(self.flavor['id'],
+ key1="value1", key2="value2")
self.assertEqual(body['key1'], 'value1')
self.assertIn('key2', body)
body = self.flavors_client.show_flavor_extra_spec(
diff --git a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
index 8c5a103..f1e11f4 100644
--- a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
+++ b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
@@ -53,12 +53,12 @@
swap = 1024
rxtx = 1
# Create a flavor
- cls.flavor = cls.client.create_flavor(flavor_name,
- ram, vcpus,
- disk,
- cls.new_flavor_id,
+ cls.flavor = cls.client.create_flavor(name=flavor_name,
+ ram=ram, vcpus=vcpus,
+ disk=disk,
+ id=cls.new_flavor_id,
ephemeral=ephemeral,
- swap=swap, rxtx=rxtx)
+ swap=swap, rxtx_factor=rxtx)
@classmethod
def resource_cleanup(cls):
@@ -70,19 +70,17 @@
@test.idempotent_id('a00a3b81-5641-45a8-ab2b-4a8ec41e1d7d')
def test_flavor_non_admin_set_keys(self):
# Test to SET flavor extra spec as a user without admin privileges.
- specs = {"key1": "value1", "key2": "value2"}
self.assertRaises(lib_exc.Forbidden,
self.flavors_client.set_flavor_extra_spec,
self.flavor['id'],
- specs)
+ key1="value1", key2="value2")
@test.attr(type=['negative'])
@test.idempotent_id('1ebf4ef8-759e-48fe-a801-d451d80476fb')
def test_flavor_non_admin_update_specific_key(self):
# non admin user is not allowed to update flavor extra spec
- specs = {"key1": "value1", "key2": "value2"}
body = self.client.set_flavor_extra_spec(
- self.flavor['id'], specs)
+ self.flavor['id'], key1="value1", key2="value2")
self.assertEqual(body['key1'], 'value1')
self.assertRaises(lib_exc.Forbidden,
self.flavors_client.
@@ -94,8 +92,8 @@
@test.attr(type=['negative'])
@test.idempotent_id('28f12249-27c7-44c1-8810-1f382f316b11')
def test_flavor_non_admin_unset_keys(self):
- specs = {"key1": "value1", "key2": "value2"}
- self.client.set_flavor_extra_spec(self.flavor['id'], specs)
+ self.client.set_flavor_extra_spec(self.flavor['id'],
+ key1="value1", key2="value2")
self.assertRaises(lib_exc.Forbidden,
self.flavors_client.unset_flavor_extra_spec,
diff --git a/tempest/api/compute/admin/test_quotas_negative.py b/tempest/api/compute/admin/test_quotas_negative.py
index 33313be..8dcd0b2 100644
--- a/tempest/api/compute/admin/test_quotas_negative.py
+++ b/tempest/api/compute/admin/test_quotas_negative.py
@@ -129,7 +129,7 @@
# will be raised when out of quota
self.assertRaises((lib_exc.Forbidden, lib_exc.OverLimit),
self.sg_client.create_security_group,
- "sg-overlimit", "sg-desc")
+ name="sg-overlimit", description="sg-desc")
@decorators.skip_because(bug="1186354",
condition=CONF.service_available.neutron)
@@ -157,7 +157,8 @@
s_name = data_utils.rand_name('securitygroup')
s_description = data_utils.rand_name('description')
securitygroup =\
- self.sg_client.create_security_group(s_name, s_description)
+ self.sg_client.create_security_group(name=s_name,
+ description=s_description)
self.addCleanup(self.sg_client.delete_security_group,
securitygroup['id'])
@@ -169,4 +170,5 @@
# will be raised when out of quota
self.assertRaises((lib_exc.OverLimit, lib_exc.Forbidden),
self.sgr_client.create_security_group_rule,
- secgroup_id, ip_protocol, 1025, 1025)
+ parent_group_id=secgroup_id, ip_protocol=ip_protocol,
+ from_port=1025, to_port=1025)
diff --git a/tempest/api/compute/admin/test_security_group_default_rules.py b/tempest/api/compute/admin/test_security_group_default_rules.py
index 13d6cc0..5ae6553 100644
--- a/tempest/api/compute/admin/test_security_group_default_rules.py
+++ b/tempest/api/compute/admin/test_security_group_default_rules.py
@@ -45,9 +45,9 @@
cidr='10.10.0.0/24'):
# Create Security Group default rule
rule = self.adm_client.create_security_default_group_rule(
- ip_protocol,
- from_port,
- to_port,
+ ip_protocol=ip_protocol,
+ from_port=from_port,
+ to_port=to_port,
cidr=cidr)
self.assertEqual(ip_protocol, rule['ip_protocol'])
self.assertEqual(from_port, rule['from_port'])
@@ -73,9 +73,9 @@
from_port = 80
to_port = 80
rule = self.adm_client.create_security_default_group_rule(
- ip_protocol,
- from_port,
- to_port)
+ ip_protocol=ip_protocol,
+ from_port=from_port,
+ to_port=to_port)
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
self.assertNotEqual(0, rule['id'])
@@ -88,9 +88,9 @@
to_port = 10
cidr = ''
rule = self.adm_client.create_security_default_group_rule(
- ip_protocol,
- from_port,
- to_port,
+ ip_protocol=ip_protocol,
+ from_port=from_port,
+ to_port=to_port,
cidr=cidr)
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py
index ff87a4f..b2a1b98 100644
--- a/tempest/api/compute/admin/test_security_groups.py
+++ b/tempest/api/compute/admin/test_security_groups.py
@@ -51,7 +51,8 @@
name = data_utils.rand_name('securitygroup')
description = data_utils.rand_name('description')
securitygroup = (self.client
- .create_security_group(name, description))
+ .create_security_group(name=name,
+ description=description))
self.addCleanup(self._delete_security_group,
securitygroup['id'], admin=False)
security_group_list.append(securitygroup)
@@ -61,9 +62,8 @@
for i in range(2):
name = data_utils.rand_name('securitygroup')
description = data_utils.rand_name('description')
- adm_securitygroup = (self.adm_client
- .create_security_group(name,
- description))
+ adm_securitygroup = self.adm_client.create_security_group(
+ name=name, description=description)
self.addCleanup(self._delete_security_group,
adm_securitygroup['id'])
security_group_list.append(adm_securitygroup)
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index b93aaca..0241e70 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -73,9 +73,9 @@
ram = int(quota_set['ram']) + 1
vcpus = 8
disk = 10
- flavor_ref = self.flavors_client.create_flavor(flavor_name,
- ram, vcpus, disk,
- flavor_id)
+ flavor_ref = self.flavors_client.create_flavor(name=flavor_name,
+ ram=ram, vcpus=vcpus,
+ disk=disk, id=flavor_id)
self.addCleanup(self.flavors_client.delete_flavor, flavor_id)
self.assertRaises((lib_exc.Forbidden, lib_exc.OverLimit),
self.client.resize,
@@ -95,9 +95,9 @@
quota_set = self.quotas_client.show_default_quota_set(self.tenant_id)
vcpus = int(quota_set['cores']) + 1
disk = 10
- flavor_ref = self.flavors_client.create_flavor(flavor_name,
- ram, vcpus, disk,
- flavor_id)
+ flavor_ref = self.flavors_client.create_flavor(name=flavor_name,
+ ram=ram, vcpus=vcpus,
+ disk=disk, id=flavor_id)
self.addCleanup(self.flavors_client.delete_flavor, flavor_id)
self.assertRaises((lib_exc.Forbidden, lib_exc.OverLimit),
self.client.resize,
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 33442b2..b2effc2 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -222,8 +222,8 @@
if description is None:
description = data_utils.rand_name('description')
body = \
- cls.security_groups_client.create_security_group(name,
- description)
+ cls.security_groups_client.create_security_group(
+ name=name, description=description)
cls.security_groups.append(body)
return body
@@ -279,7 +279,7 @@
if 'name' in kwargs:
name = kwargs.pop('name')
- image = cls.images_client.create_image(server_id, name)
+ image = cls.images_client.create_image(server_id, name=name)
image_id = data_utils.parse_image_id(image.response['location'])
cls.images.append(image_id)
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index 9721fa5..84a8258 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -93,7 +93,7 @@
snapshot_name = data_utils.rand_name('test-snap')
test_uuid = ('a' * 35)
self.assertRaises(lib_exc.NotFound, self.client.create_image,
- test_uuid, snapshot_name)
+ test_uuid, name=snapshot_name)
@test.attr(type=['negative'])
@test.idempotent_id('36741560-510e-4cc2-8641-55fe4dfb2437')
@@ -102,7 +102,7 @@
snapshot_name = data_utils.rand_name('test-snap')
test_uuid = ('a' * 37)
self.assertRaises(lib_exc.NotFound, self.client.create_image,
- test_uuid, snapshot_name)
+ test_uuid, name=snapshot_name)
@test.attr(type=['negative'])
@test.idempotent_id('381acb65-785a-4942-94ce-d8f8c84f1f0f')
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 40a781c..06b7cac 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -80,7 +80,8 @@
# Create a new image
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
- body = self.client.create_image(self.server_id, name, meta)
+ body = self.client.create_image(self.server_id, name=name,
+ metadata=meta)
image_id = data_utils.parse_image_id(body.response['location'])
waiters.wait_for_image_status(self.client, image_id, 'ACTIVE')
@@ -112,6 +113,6 @@
# #1370954 in glance which will 500 if mysql is used as the
# backend and it attempts to store a 4 byte utf-8 character
utf8_name = data_utils.rand_name('\xe2\x82\xa1')
- body = self.client.create_image(self.server_id, utf8_name)
+ body = self.client.create_image(self.server_id, name=utf8_name)
image_id = data_utils.parse_image_id(body.response['location'])
self.addCleanup(self.client.delete_image, image_id)
diff --git a/tempest/api/compute/images/test_images_oneserver_negative.py b/tempest/api/compute/images/test_images_oneserver_negative.py
index 1a74e52..9ea62fb 100644
--- a/tempest/api/compute/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/images/test_images_oneserver_negative.py
@@ -93,7 +93,7 @@
snapshot_name = data_utils.rand_name('test-snap')
meta = {'': ''}
self.assertRaises(lib_exc.BadRequest, self.client.create_image,
- self.server_id, snapshot_name, meta)
+ self.server_id, name=snapshot_name, metadata=meta)
@test.attr(type=['negative'])
@test.idempotent_id('3d24d11f-5366-4536-bd28-cff32b748eca')
@@ -102,7 +102,7 @@
snapshot_name = data_utils.rand_name('test-snap')
meta = {'a' * 260: 'b' * 260}
self.assertRaises(lib_exc.BadRequest, self.client.create_image,
- self.server_id, snapshot_name, meta)
+ self.server_id, name=snapshot_name, metadata=meta)
@test.attr(type=['negative'])
@test.idempotent_id('0460efcf-ee88-4f94-acef-1bf658695456')
@@ -111,8 +111,7 @@
# Create first snapshot
snapshot_name = data_utils.rand_name('test-snap')
- body = self.client.create_image(self.server_id,
- snapshot_name)
+ body = self.client.create_image(self.server_id, name=snapshot_name)
image_id = data_utils.parse_image_id(body.response['location'])
self.image_ids.append(image_id)
self.addCleanup(self._reset_server)
@@ -120,7 +119,7 @@
# Create second snapshot
alt_snapshot_name = data_utils.rand_name('test-snap')
self.assertRaises(lib_exc.Conflict, self.client.create_image,
- self.server_id, alt_snapshot_name)
+ self.server_id, name=alt_snapshot_name)
@test.attr(type=['negative'])
@test.idempotent_id('084f0cbc-500a-4963-8a4e-312905862581')
@@ -129,7 +128,7 @@
snapshot_name = data_utils.rand_name('a' * 260)
self.assertRaises(lib_exc.BadRequest, self.client.create_image,
- self.server_id, snapshot_name)
+ self.server_id, name=snapshot_name)
@test.attr(type=['negative'])
@test.idempotent_id('0894954d-2db2-4195-a45b-ffec0bc0187e')
@@ -137,7 +136,7 @@
# Return an error while trying to delete an image what is creating
snapshot_name = data_utils.rand_name('test-snap')
- body = self.client.create_image(self.server_id, snapshot_name)
+ body = self.client.create_image(self.server_id, name=snapshot_name)
image_id = data_utils.parse_image_id(body.response['location'])
self.image_ids.append(image_id)
self.addCleanup(self._reset_server)
diff --git a/tempest/api/compute/keypairs/base.py b/tempest/api/compute/keypairs/base.py
new file mode 100644
index 0000000..b742c8c
--- /dev/null
+++ b/tempest/api/compute/keypairs/base.py
@@ -0,0 +1,38 @@
+# Copyright 2015 Deutsche Telekom AG
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.compute import base
+
+
+class BaseKeypairTest(base.BaseComputeTest):
+ """Base test case class for all keypair API tests."""
+
+ _api_version = 2
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseKeypairTest, cls).setup_clients()
+ cls.client = cls.keypairs_client
+
+ def _delete_keypair(self, keypair_name):
+ self.client.delete_keypair(keypair_name)
+
+ def _create_keypair(self, keypair_name, pub_key=None):
+ kwargs = {'name': keypair_name}
+ if pub_key:
+ kwargs.update({'public_key': pub_key})
+ body = self.client.create_keypair(**kwargs)
+ self.addCleanup(self._delete_keypair, keypair_name)
+ return body
diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 9243fdf..225af12 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -13,31 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.api.compute import base
+from tempest.api.compute.keypairs import base
from tempest.common.utils import data_utils
from tempest import test
-class KeyPairsV2TestJSON(base.BaseComputeTest):
-
- _api_version = 2
-
- @classmethod
- def setup_clients(cls):
- super(KeyPairsV2TestJSON, cls).setup_clients()
- cls.client = cls.keypairs_client
-
- def _delete_keypair(self, keypair_name):
- self.client.delete_keypair(keypair_name)
-
- def _create_keypair(self, keypair_name, pub_key=None):
- kwargs = {'name': keypair_name}
- if pub_key:
- kwargs.update({'public_key': pub_key})
- body = self.client.create_keypair(**kwargs)
- self.addCleanup(self._delete_keypair, keypair_name)
- return body
-
+class KeyPairsV2TestJSON(base.BaseKeypairTest):
@test.idempotent_id('1d1dbedb-d7a0-432a-9d09-83f543c3c19b')
def test_keypairs_create_list_delete(self):
# Keypairs created should be available in the response list
diff --git a/tempest/api/compute/keypairs/test_keypairs_negative.py b/tempest/api/compute/keypairs/test_keypairs_negative.py
index 3e6d400..0ab78fb 100644
--- a/tempest/api/compute/keypairs/test_keypairs_negative.py
+++ b/tempest/api/compute/keypairs/test_keypairs_negative.py
@@ -16,25 +16,12 @@
from tempest_lib import exceptions as lib_exc
-from tempest.api.compute import base
+from tempest.api.compute.keypairs import base
from tempest.common.utils import data_utils
from tempest import test
-class KeyPairsNegativeTestJSON(base.BaseV2ComputeTest):
-
- @classmethod
- def setup_clients(cls):
- super(KeyPairsNegativeTestJSON, cls).setup_clients()
- cls.client = cls.keypairs_client
-
- def _create_keypair(self, keypair_name, pub_key=None):
- kwargs = {'name': keypair_name}
- if pub_key:
- kwargs.update({'public_key': pub_key})
- self.client.create_keypair(**kwargs)
- self.addCleanup(self.client.delete_keypair, keypair_name)
-
+class KeyPairsNegativeTestJSON(base.BaseKeypairTest):
@test.attr(type=['negative'])
@test.idempotent_id('29cca892-46ae-4d48-bc32-8fe7e731eb81')
def test_keypair_create_with_invalid_pub_key(self):
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 4596e1f..b5eff70 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -69,11 +69,11 @@
security_group = self.create_security_group()
securitygroup_id = security_group['id']
# Adding rules to the created Security Group
- rule = \
- self.client.create_security_group_rule(securitygroup_id,
- self.ip_protocol,
- self.from_port,
- self.to_port)
+ rule = self.client.create_security_group_rule(
+ parent_group_id=securitygroup_id,
+ ip_protocol=self.ip_protocol,
+ from_port=self.from_port,
+ to_port=self.to_port)
self.expected['parent_group_id'] = securitygroup_id
self.expected['ip_range'] = {'cidr': '0.0.0.0/0'}
self._check_expected_response(rule)
@@ -91,12 +91,12 @@
# Adding rules to the created Security Group with optional cidr
cidr = '10.2.3.124/24'
- rule = \
- self.client.create_security_group_rule(parent_group_id,
- self.ip_protocol,
- self.from_port,
- self.to_port,
- cidr=cidr)
+ rule = self.client.create_security_group_rule(
+ parent_group_id=parent_group_id,
+ ip_protocol=self.ip_protocol,
+ from_port=self.from_port,
+ to_port=self.to_port,
+ cidr=cidr)
self.expected['parent_group_id'] = parent_group_id
self.expected['ip_range'] = {'cidr': cidr}
self._check_expected_response(rule)
@@ -118,12 +118,12 @@
group_name = security_group['name']
# Adding rules to the created Security Group with optional group_id
- rule = \
- self.client.create_security_group_rule(parent_group_id,
- self.ip_protocol,
- self.from_port,
- self.to_port,
- group_id=group_id)
+ rule = self.client.create_security_group_rule(
+ parent_group_id=parent_group_id,
+ ip_protocol=self.ip_protocol,
+ from_port=self.from_port,
+ to_port=self.to_port,
+ group_id=group_id)
self.expected['parent_group_id'] = parent_group_id
self.expected['group'] = {'tenant_id': self.client.tenant_id,
'name': group_name}
@@ -140,21 +140,22 @@
securitygroup_id = security_group['id']
# Add a first rule to the created Security Group
- rule = \
- self.client.create_security_group_rule(securitygroup_id,
- self.ip_protocol,
- self.from_port,
- self.to_port)
+ rule = self.client.create_security_group_rule(
+ parent_group_id=securitygroup_id,
+ ip_protocol=self.ip_protocol,
+ from_port=self.from_port,
+ to_port=self.to_port)
rule1_id = rule['id']
# Add a second rule to the created Security Group
ip_protocol2 = 'icmp'
from_port2 = -1
to_port2 = -1
- rule = \
- self.client.create_security_group_rule(securitygroup_id,
- ip_protocol2,
- from_port2, to_port2)
+ rule = self.client.create_security_group_rule(
+ parent_group_id=securitygroup_id,
+ ip_protocol=ip_protocol2,
+ from_port=from_port2,
+ to_port=to_port2)
rule2_id = rule['id']
# Delete the Security Group rule2 at the end of this method
self.addCleanup(self.client.delete_security_group_rule, rule2_id)
@@ -176,11 +177,12 @@
security_group = self.create_security_group()
sg2_id = security_group['id']
# Adding rules to the Group1
- self.client.create_security_group_rule(sg1_id,
- self.ip_protocol,
- self.from_port,
- self.to_port,
- group_id=sg2_id)
+ self.client.create_security_group_rule(
+ parent_group_id=sg1_id,
+ ip_protocol=self.ip_protocol,
+ from_port=self.from_port,
+ to_port=self.to_port,
+ group_id=sg2_id)
# Delete group2
self.security_groups_client.delete_security_group(sg2_id)
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 e2a1034..d12306a 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
@@ -51,7 +51,9 @@
to_port = 22
self.assertRaises(lib_exc.NotFound,
self.rules_client.create_security_group_rule,
- parent_group_id, ip_protocol, from_port, to_port)
+ parent_group_id=parent_group_id,
+ ip_protocol=ip_protocol, from_port=from_port,
+ to_port=to_port)
@test.attr(type=['negative'])
@test.idempotent_id('2244d7e4-adb7-4ecb-9930-2d77e123ce4f')
@@ -66,7 +68,9 @@
to_port = 22
self.assertRaises(lib_exc.BadRequest,
self.rules_client.create_security_group_rule,
- parent_group_id, ip_protocol, from_port, to_port)
+ parent_group_id=parent_group_id,
+ ip_protocol=ip_protocol, from_port=from_port,
+ to_port=to_port)
@test.attr(type=['negative'])
@test.idempotent_id('8bd56d02-3ffa-4d67-9933-b6b9a01d6089')
@@ -81,17 +85,17 @@
from_port = 22
to_port = 22
- rule = \
- self.rules_client.create_security_group_rule(parent_group_id,
- ip_protocol,
- from_port,
- to_port)
+ rule = self.rules_client.create_security_group_rule(
+ parent_group_id=parent_group_id, ip_protocol=ip_protocol,
+ from_port=from_port, to_port=to_port)
self.addCleanup(self.rules_client.delete_security_group_rule,
rule['id'])
# Add the same rule to the group should fail
self.assertRaises(lib_exc.BadRequest,
self.rules_client.create_security_group_rule,
- parent_group_id, ip_protocol, from_port, to_port)
+ parent_group_id=parent_group_id,
+ ip_protocol=ip_protocol, from_port=from_port,
+ to_port=to_port)
@test.attr(type=['negative'])
@test.idempotent_id('84c81249-9f6e-439c-9bbf-cbb0d2cddbdf')
@@ -109,7 +113,9 @@
self.assertRaises(lib_exc.BadRequest,
self.rules_client.create_security_group_rule,
- parent_group_id, ip_protocol, from_port, to_port)
+ parent_group_id=parent_group_id,
+ ip_protocol=ip_protocol, from_port=from_port,
+ to_port=to_port)
@test.attr(type=['negative'])
@test.idempotent_id('12bbc875-1045-4f7a-be46-751277baedb9')
@@ -126,7 +132,9 @@
to_port = 22
self.assertRaises(lib_exc.BadRequest,
self.rules_client.create_security_group_rule,
- parent_group_id, ip_protocol, from_port, to_port)
+ parent_group_id=parent_group_id,
+ ip_protocol=ip_protocol, from_port=from_port,
+ to_port=to_port)
@test.attr(type=['negative'])
@test.idempotent_id('ff88804d-144f-45d1-bf59-dd155838a43a')
@@ -143,7 +151,9 @@
to_port = data_utils.rand_int_id(start=65536)
self.assertRaises(lib_exc.BadRequest,
self.rules_client.create_security_group_rule,
- parent_group_id, ip_protocol, from_port, to_port)
+ parent_group_id=parent_group_id,
+ ip_protocol=ip_protocol, from_port=from_port,
+ to_port=to_port)
@test.attr(type=['negative'])
@test.idempotent_id('00296fa9-0576-496a-ae15-fbab843189e0')
@@ -160,7 +170,9 @@
to_port = 21
self.assertRaises(lib_exc.BadRequest,
self.rules_client.create_security_group_rule,
- secgroup_id, ip_protocol, from_port, to_port)
+ parent_group_id=secgroup_id,
+ ip_protocol=ip_protocol, from_port=from_port,
+ to_port=to_port)
@test.attr(type=['negative'])
@test.idempotent_id('56fddcca-dbb8-4494-a0db-96e9f869527c')
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 d8cbe3d..642aca1 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -72,16 +72,17 @@
s_description = data_utils.rand_name('description')
# Create Security Group with empty string as group name
self.assertRaises(lib_exc.BadRequest,
- self.client.create_security_group, "", s_description)
+ self.client.create_security_group,
+ name="", description=s_description)
# Create Security Group with white space in group name
self.assertRaises(lib_exc.BadRequest,
- self.client.create_security_group, " ",
- s_description)
+ self.client.create_security_group,
+ name=" ", description=s_description)
# Create Security Group with group name longer than 255 chars
s_name = 'securitygroup-'.ljust(260, '0')
self.assertRaises(lib_exc.BadRequest,
- self.client.create_security_group, s_name,
- s_description)
+ self.client.create_security_group,
+ name=s_name, description=s_description)
@decorators.skip_because(bug="1161411",
condition=CONF.service_available.neutron)
@@ -96,8 +97,8 @@
# Create Security Group with group description longer than 255 chars
s_description = 'description-'.ljust(260, '0')
self.assertRaises(lib_exc.BadRequest,
- self.client.create_security_group, s_name,
- s_description)
+ self.client.create_security_group,
+ name=s_name, description=s_description)
@test.idempotent_id('9fdb4abc-6b66-4b27-b89c-eb215a956168')
@testtools.skipIf(CONF.service_available.neutron,
@@ -109,11 +110,11 @@
# be created
s_name = data_utils.rand_name('securitygroup')
s_description = data_utils.rand_name('description')
- self.create_security_group(s_name, s_description)
+ self.create_security_group(name=s_name, description=s_description)
# Now try the Security Group with the same 'Name'
self.assertRaises(lib_exc.BadRequest,
- self.client.create_security_group, s_name,
- s_description)
+ self.client.create_security_group,
+ name=s_name, description=s_description)
@test.attr(type=['negative'])
@test.idempotent_id('36a1629f-c6da-4a26-b8b8-55e7e5d5cd58')
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 23a9cb3..e62a52b 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -269,9 +269,9 @@
# Create a flavor with extra specs
flavor = (self.flavor_client.
- create_flavor(flavor_with_eph_disk_name,
- ram, vcpus, disk,
- flavor_with_eph_disk_id,
+ create_flavor(name=flavor_with_eph_disk_name,
+ ram=ram, vcpus=vcpus, disk=disk,
+ id=flavor_with_eph_disk_id,
ephemeral=1))
self.addCleanup(flavor_clean_up, flavor['id'])
@@ -287,9 +287,9 @@
# Create a flavor without extra specs
flavor = (self.flavor_client.
- create_flavor(flavor_no_eph_disk_name,
- ram, vcpus, disk,
- flavor_no_eph_disk_id))
+ create_flavor(name=flavor_no_eph_disk_name,
+ ram=ram, vcpus=vcpus, disk=disk,
+ id=flavor_no_eph_disk_id))
self.addCleanup(flavor_clean_up, flavor['id'])
return flavor['id']
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 98a2f9d..7e09096 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -48,9 +48,8 @@
# Security group creation
cls.sg_name = data_utils.rand_name('sg')
cls.sg_desc = data_utils.rand_name('sg-desc')
- cls.sg = \
- cls.security_groups_client.create_security_group(cls.sg_name,
- cls.sg_desc)
+ cls.sg = cls.security_groups_client.create_security_group(
+ name=cls.sg_name, description=cls.sg_desc)
cls.sg_id = cls.sg['id']
# Server for positive tests
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 7e2868e..e7111b0 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -83,14 +83,15 @@
name = data_utils.rand_name('security')
description = data_utils.rand_name('description')
cls.security_group = cls.security_client.create_security_group(
- name, description)
+ name=name, description=description)
parent_group_id = cls.security_group['id']
ip_protocol = 'tcp'
from_port = 22
to_port = 22
cls.rule = cls.rule_client.create_security_group_rule(
- parent_group_id, ip_protocol, from_port, to_port)
+ parent_group_id=parent_group_id, ip_protocol=ip_protocol,
+ from_port=from_port, to_port=to_port)
@classmethod
def resource_cleanup(cls):
@@ -173,7 +174,7 @@
# A create image request for another user's server should fail
self.assertRaises(lib_exc.NotFound,
self.alt_images_client.create_image,
- self.server['id'], 'testImage')
+ self.server['id'], name='testImage')
@test.idempotent_id('95d445f6-babc-4f2e-aea3-aa24ec5e7f0d')
def test_create_server_with_unauthorized_image(self):
@@ -262,7 +263,7 @@
resp['status'] = None
self.assertRaises(lib_exc.BadRequest,
self.alt_security_client.create_security_group,
- s_name, s_description)
+ name=s_name, description=s_description)
finally:
# Next request the base_url is back to normal
if resp['status'] is not None:
@@ -304,8 +305,9 @@
self.assertRaises(lib_exc.BadRequest,
self.alt_rule_client.
create_security_group_rule,
- parent_group_id, ip_protocol, from_port,
- to_port)
+ parent_group_id=parent_group_id,
+ ip_protocol=ip_protocol,
+ from_port=from_port, to_port=to_port)
finally:
# Next request the base_url is back to normal
if resp['status'] is not None:
diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py
index c13fbe5..5e616f7 100644
--- a/tempest/cmd/init.py
+++ b/tempest/cmd/init.py
@@ -15,6 +15,7 @@
import os
import shutil
import subprocess
+import sys
from cliff import command
from oslo_log import log as logging
@@ -33,13 +34,44 @@
"""
+def get_tempest_default_config_dir():
+ """Returns the correct default config dir to support both cases of
+ tempest being or not installed in a virtualenv.
+ Cases considered:
+ - no virtual env, python2: real_prefix and base_prefix not set
+ - no virtual env, python3: real_prefix not set, base_prefix set and
+ identical to prefix
+ - virtualenv, python2: real_prefix and prefix are set and different
+ - virtualenv, python3: real_prefix not set, base_prefix and prefix are
+ set and identical
+ - pyvenv, any python version: real_prefix not set, base_prefix and prefix
+ are set and different
+
+ :return: default config dir
+ """
+ real_prefix = getattr(sys, 'real_prefix', None)
+ base_prefix = getattr(sys, 'base_prefix', None)
+ prefix = sys.prefix
+ if real_prefix is None and base_prefix is None:
+ # Not running in a virtual environnment of any kind
+ return '/etc/tempest'
+ elif (real_prefix is None and base_prefix is not None and
+ base_prefix == prefix):
+ # Probably not running in a virtual environment
+ # NOTE(andreaf) we cannot distinguish this case from the case of
+ # a virtual environment created with virtualenv, and running python3.
+ return '/etc/tempest'
+ else:
+ return os.path.join(sys.prefix, 'etc/tempest')
+
+
class TempestInit(command.Command):
"""Setup a local working environment for running tempest"""
def get_parser(self, prog_name):
parser = super(TempestInit, self).get_parser(prog_name)
parser.add_argument('dir', nargs='?', default=os.getcwd())
- parser.add_argument('--config-dir', '-c', default='/etc/tempest')
+ parser.add_argument('--config-dir', '-c', default=None)
return parser
def generate_testr_conf(self, local_path):
@@ -96,4 +128,5 @@
subprocess.call(['testr', 'init'], cwd=local_dir)
def take_action(self, parsed_args):
- self.create_working_dir(parsed_args.dir, parsed_args.config_dir)
+ config_dir = parsed_args.config_dir or get_tempest_default_config_dir()
+ self.create_working_dir(parsed_args.dir, config_dir)
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index f35548a..30fb38c 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -915,13 +915,14 @@
continue
body = client.secgroups.create_security_group(
- secgroup['name'], secgroup['description'])
+ name=secgroup['name'], description=secgroup['description'])
secgroup_id = body['id']
# for each security group, create the rules
for rule in secgroup['rules']:
ip_proto, from_port, to_port, cidr = rule.split()
client.secrules.create_security_group_rule(
- secgroup_id, ip_proto, from_port, to_port, cidr=cidr)
+ parent_group_id=secgroup_id, ip_protocol=ip_proto,
+ from_port=from_port, to_port=to_port, cidr=cidr)
def destroy_secgroups(secgroups):
diff --git a/tempest/common/validation_resources.py b/tempest/common/validation_resources.py
index 852ee54..402638d 100644
--- a/tempest/common/validation_resources.py
+++ b/tempest/common/validation_resources.py
@@ -27,12 +27,15 @@
sg_name = data_utils.rand_name('securitygroup-')
sg_description = data_utils.rand_name('description-')
security_group = \
- security_group_client.create_security_group(sg_name, sg_description)
+ security_group_client.create_security_group(name=sg_name,
+ description=sg_description)
if add_rule:
- security_group_client.create_security_group_rule(security_group['id'],
- 'tcp', 22, 22)
- security_group_client.create_security_group_rule(security_group['id'],
- 'icmp', -1, -1)
+ security_group_client.create_security_group_rule(
+ parent_group_id=security_group['id'], ip_protocol='tcp',
+ from_port=22, to_port=22)
+ security_group_client.create_security_group_rule(
+ parent_group_id=security_group['id'], ip_protocol='icmp',
+ from_port=-1, to_port=-1)
LOG.debug("SSH Validation resource security group with tcp and icmp "
"rules %s created"
% sg_name)
diff --git a/tempest/openstack/__init__.py b/tempest/openstack/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/openstack/__init__.py
+++ /dev/null
diff --git a/tempest/openstack/common/__init__.py b/tempest/openstack/common/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/openstack/common/__init__.py
+++ /dev/null
diff --git a/tempest/openstack/common/_i18n.py b/tempest/openstack/common/_i18n.py
deleted file mode 100644
index 5bbc77d..0000000
--- a/tempest/openstack/common/_i18n.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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.
-
-"""oslo.i18n integration module.
-
-See http://docs.openstack.org/developer/oslo.i18n/usage.html
-
-"""
-
-try:
- import oslo_i18n
-
- # NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
- # application name when this module is synced into the separate
- # repository. It is OK to have more than one translation function
- # using the same domain, since there will still only be one message
- # catalog.
- _translators = oslo_i18n.TranslatorFactory(domain='tempest')
-
- # The primary translation function using the well-known name "_"
- _ = _translators.primary
-
- # Translators for log levels.
- #
- # The abbreviated names are meant to reflect the usual use of a short
- # name like '_'. The "L" is for "log" and the other letter comes from
- # the level.
- _LI = _translators.log_info
- _LW = _translators.log_warning
- _LE = _translators.log_error
- _LC = _translators.log_critical
-except ImportError:
- # NOTE(dims): Support for cases where a project wants to use
- # code from oslo-incubator, but is not ready to be internationalized
- # (like tempest)
- _ = _LI = _LW = _LE = _LC = lambda x: x
diff --git a/tempest/openstack/common/versionutils.py b/tempest/openstack/common/versionutils.py
deleted file mode 100644
index 12d2e14..0000000
--- a/tempest/openstack/common/versionutils.py
+++ /dev/null
@@ -1,263 +0,0 @@
-# Copyright (c) 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.
-
-"""
-Helpers for comparing version strings.
-"""
-
-import copy
-import functools
-import inspect
-import logging
-
-from oslo_config import cfg
-import pkg_resources
-import six
-
-from tempest.openstack.common._i18n import _
-from oslo_log import log as logging
-
-
-LOG = logging.getLogger(__name__)
-CONF = cfg.CONF
-
-
-deprecated_opts = [
- cfg.BoolOpt('fatal_deprecations',
- default=False,
- help='Enables or disables fatal status of deprecations.'),
-]
-
-
-def list_opts():
- """Entry point for oslo.config-generator.
- """
- return [(None, copy.deepcopy(deprecated_opts))]
-
-
-class deprecated(object):
- """A decorator to mark callables as deprecated.
-
- This decorator logs a deprecation message when the callable it decorates is
- used. The message will include the release where the callable was
- deprecated, the release where it may be removed and possibly an optional
- replacement.
-
- Examples:
-
- 1. Specifying the required deprecated release
-
- >>> @deprecated(as_of=deprecated.ICEHOUSE)
- ... def a(): pass
-
- 2. Specifying a replacement:
-
- >>> @deprecated(as_of=deprecated.ICEHOUSE, in_favor_of='f()')
- ... def b(): pass
-
- 3. Specifying the release where the functionality may be removed:
-
- >>> @deprecated(as_of=deprecated.ICEHOUSE, remove_in=+1)
- ... def c(): pass
-
- 4. Specifying the deprecated functionality will not be removed:
- >>> @deprecated(as_of=deprecated.ICEHOUSE, remove_in=0)
- ... def d(): pass
-
- 5. Specifying a replacement, deprecated functionality will not be removed:
- >>> @deprecated(as_of=deprecated.ICEHOUSE, in_favor_of='f()', remove_in=0)
- ... def e(): pass
-
- """
-
- # NOTE(morganfainberg): Bexar is used for unit test purposes, it is
- # expected we maintain a gap between Bexar and Folsom in this list.
- BEXAR = 'B'
- FOLSOM = 'F'
- GRIZZLY = 'G'
- HAVANA = 'H'
- ICEHOUSE = 'I'
- JUNO = 'J'
- KILO = 'K'
- LIBERTY = 'L'
-
- _RELEASES = {
- # NOTE(morganfainberg): Bexar is used for unit test purposes, it is
- # expected we maintain a gap between Bexar and Folsom in this list.
- 'B': 'Bexar',
- 'F': 'Folsom',
- 'G': 'Grizzly',
- 'H': 'Havana',
- 'I': 'Icehouse',
- 'J': 'Juno',
- 'K': 'Kilo',
- 'L': 'Liberty',
- }
-
- _deprecated_msg_with_alternative = _(
- '%(what)s is deprecated as of %(as_of)s in favor of '
- '%(in_favor_of)s and may be removed in %(remove_in)s.')
-
- _deprecated_msg_no_alternative = _(
- '%(what)s is deprecated as of %(as_of)s and may be '
- 'removed in %(remove_in)s. It will not be superseded.')
-
- _deprecated_msg_with_alternative_no_removal = _(
- '%(what)s is deprecated as of %(as_of)s in favor of %(in_favor_of)s.')
-
- _deprecated_msg_with_no_alternative_no_removal = _(
- '%(what)s is deprecated as of %(as_of)s. It will not be superseded.')
-
- def __init__(self, as_of, in_favor_of=None, remove_in=2, what=None):
- """Initialize decorator
-
- :param as_of: the release deprecating the callable. Constants
- are define in this class for convenience.
- :param in_favor_of: the replacement for the callable (optional)
- :param remove_in: an integer specifying how many releases to wait
- before removing (default: 2)
- :param what: name of the thing being deprecated (default: the
- callable's name)
-
- """
- self.as_of = as_of
- self.in_favor_of = in_favor_of
- self.remove_in = remove_in
- self.what = what
-
- def __call__(self, func_or_cls):
- if not self.what:
- self.what = func_or_cls.__name__ + '()'
- msg, details = self._build_message()
-
- if inspect.isfunction(func_or_cls):
-
- @six.wraps(func_or_cls)
- def wrapped(*args, **kwargs):
- report_deprecated_feature(LOG, msg, details)
- return func_or_cls(*args, **kwargs)
- return wrapped
- elif inspect.isclass(func_or_cls):
- orig_init = func_or_cls.__init__
-
- # TODO(tsufiev): change `functools` module to `six` as
- # soon as six 1.7.4 (with fix for passing `assigned`
- # argument to underlying `functools.wraps`) is released
- # and added to the oslo-incubator requrements
- @functools.wraps(orig_init, assigned=('__name__', '__doc__'))
- def new_init(self, *args, **kwargs):
- report_deprecated_feature(LOG, msg, details)
- orig_init(self, *args, **kwargs)
- func_or_cls.__init__ = new_init
- return func_or_cls
- else:
- raise TypeError('deprecated can be used only with functions or '
- 'classes')
-
- def _get_safe_to_remove_release(self, release):
- # TODO(dstanek): this method will have to be reimplemented once
- # when we get to the X release because once we get to the Y
- # release, what is Y+2?
- new_release = chr(ord(release) + self.remove_in)
- if new_release in self._RELEASES:
- return self._RELEASES[new_release]
- else:
- return new_release
-
- def _build_message(self):
- details = dict(what=self.what,
- as_of=self._RELEASES[self.as_of],
- remove_in=self._get_safe_to_remove_release(self.as_of))
-
- if self.in_favor_of:
- details['in_favor_of'] = self.in_favor_of
- if self.remove_in > 0:
- msg = self._deprecated_msg_with_alternative
- else:
- # There are no plans to remove this function, but it is
- # now deprecated.
- msg = self._deprecated_msg_with_alternative_no_removal
- else:
- if self.remove_in > 0:
- msg = self._deprecated_msg_no_alternative
- else:
- # There are no plans to remove this function, but it is
- # now deprecated.
- msg = self._deprecated_msg_with_no_alternative_no_removal
- return msg, details
-
-
-def is_compatible(requested_version, current_version, same_major=True):
- """Determine whether `requested_version` is satisfied by
- `current_version`; in other words, `current_version` is >=
- `requested_version`.
-
- :param requested_version: version to check for compatibility
- :param current_version: version to check against
- :param same_major: if True, the major version must be identical between
- `requested_version` and `current_version`. This is used when a
- major-version difference indicates incompatibility between the two
- versions. Since this is the common-case in practice, the default is
- True.
- :returns: True if compatible, False if not
- """
- requested_parts = pkg_resources.parse_version(requested_version)
- current_parts = pkg_resources.parse_version(current_version)
-
- if same_major and (requested_parts[0] != current_parts[0]):
- return False
-
- return current_parts >= requested_parts
-
-
-# Track the messages we have sent already. See
-# report_deprecated_feature().
-_deprecated_messages_sent = {}
-
-
-def report_deprecated_feature(logger, msg, *args, **kwargs):
- """Call this function when a deprecated feature is used.
-
- If the system is configured for fatal deprecations then the message
- is logged at the 'critical' level and :class:`DeprecatedConfig` will
- be raised.
-
- Otherwise, the message will be logged (once) at the 'warn' level.
-
- :raises: :class:`DeprecatedConfig` if the system is configured for
- fatal deprecations.
- """
- stdmsg = _("Deprecated: %s") % msg
- CONF.register_opts(deprecated_opts)
- if CONF.fatal_deprecations:
- logger.critical(stdmsg, *args, **kwargs)
- raise DeprecatedConfig(msg=stdmsg)
-
- # Using a list because a tuple with dict can't be stored in a set.
- sent_args = _deprecated_messages_sent.setdefault(msg, list())
-
- if args in sent_args:
- # Already logged this message, so don't log it again.
- return
-
- sent_args.append(args)
- logger.warn(stdmsg, *args, **kwargs)
-
-
-class DeprecatedConfig(Exception):
- message = _("Fatal call to deprecated config: %(msg)s")
-
- def __init__(self, msg):
- super(Exception, self).__init__(self.message % dict(msg=msg))
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 67052b0..60bf7cb 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -233,14 +233,14 @@
rulesets = [
{
# ssh
- 'ip_proto': 'tcp',
+ 'ip_protocol': 'tcp',
'from_port': 22,
'to_port': 22,
'cidr': '0.0.0.0/0',
},
{
# ping
- 'ip_proto': 'icmp',
+ 'ip_protocol': 'icmp',
'from_port': -1,
'to_port': -1,
'cidr': '0.0.0.0/0',
@@ -248,8 +248,8 @@
]
rules = list()
for ruleset in rulesets:
- sg_rule = _client_rules.create_security_group_rule(secgroup_id,
- **ruleset)
+ sg_rule = _client_rules.create_security_group_rule(
+ parent_group_id=secgroup_id, **ruleset)
self.addCleanup(self.delete_wrapper,
_client_rules.delete_security_group_rule,
sg_rule['id'])
@@ -261,7 +261,7 @@
sg_name = data_utils.rand_name(self.__class__.__name__)
sg_desc = sg_name + " description"
secgroup = self.security_groups_client.create_security_group(
- sg_name, sg_desc)
+ name=sg_name, description=sg_desc)
self.assertEqual(secgroup['name'], sg_name)
self.assertEqual(secgroup['description'], sg_desc)
self.addCleanup(self.delete_wrapper,
@@ -402,7 +402,7 @@
if name is None:
name = data_utils.rand_name('scenario-snapshot')
LOG.debug("Creating a snapshot image for server: %s", server['name'])
- image = _images_client.create_image(server['id'], name)
+ image = _images_client.create_image(server['id'], name=name)
image_id = image.response['location'].split('images/')[1]
_image_client.wait_for_image_status(image_id, 'active')
self.addCleanup_with_wait(
@@ -1080,6 +1080,11 @@
port = self._create_port(network_id=net_id,
client=net_client,
**create_port_body)
+ # if port_vnic_type is set, ports in the passing
+ # create_kwargs will be override, which cause the
+ # inconsistence. Set the port_id according to network id
+ if net_id == self.network['id']:
+ self.port_id = port.id
ports.append({'port': port.id})
if ports:
create_kwargs['networks'] = ports
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index fa70d3f..c44557e 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -87,7 +87,7 @@
# Since no traffic is tested, we don't need to actually add rules to
# secgroup
secgroup = self.security_groups_client.create_security_group(
- 'secgroup-%s' % name, 'secgroup-desc-%s' % name)
+ name='secgroup-%s' % name, description='secgroup-desc-%s' % name)
self.addCleanupClass(self.security_groups_client.delete_security_group,
secgroup['id'])
create_kwargs = {
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index e676063..b31ba69 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -101,6 +101,7 @@
self.servers = []
def _setup_network_and_servers(self, **kwargs):
+ vnic_type = CONF.network.port_vnic_type
boot_with_port = kwargs.pop('boot_with_port', False)
self.security_group = \
self._create_security_group(tenant_id=self.tenant_id)
@@ -108,7 +109,9 @@
self.check_networks()
self.port_id = None
- if boot_with_port:
+ # when vnic_type is set, ports will be created in create_server.
+ # So no need to create a port here in this case.
+ if boot_with_port and not vnic_type:
# create a port on the network and boot with that
self.port_id = self._create_port(self.network['id']).id
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index b928f9f..1422944 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -47,24 +47,19 @@
self.validate_response(schema.create_get_flavor_details, resp, body)
return service_client.ResponseBody(resp, body['flavor'])
- def create_flavor(self, name, ram, vcpus, disk, flavor_id, **kwargs):
- """Creates a new flavor or instance type."""
- post_body = {
- 'name': name,
- 'ram': ram,
- 'vcpus': vcpus,
- 'disk': disk,
- 'id': flavor_id,
- }
+ def create_flavor(self, **kwargs):
+ """Creates a new flavor or instance type.
+ Most parameters except the following are passed to the API without
+ any changes.
+ :param ephemeral: The name is changed to OS-FLV-EXT-DATA:ephemeral
+ :param is_public: The name is changed to os-flavor-access:is_public
+ """
if kwargs.get('ephemeral'):
- post_body['OS-FLV-EXT-DATA:ephemeral'] = kwargs.get('ephemeral')
- if kwargs.get('swap'):
- post_body['swap'] = kwargs.get('swap')
- if kwargs.get('rxtx'):
- post_body['rxtx_factor'] = kwargs.get('rxtx')
+ kwargs['OS-FLV-EXT-DATA:ephemeral'] = kwargs.pop('ephemeral')
if kwargs.get('is_public'):
- post_body['os-flavor-access:is_public'] = kwargs.get('is_public')
- post_body = json.dumps({'flavor': post_body})
+ kwargs['os-flavor-access:is_public'] = kwargs.pop('is_public')
+
+ post_body = json.dumps({'flavor': kwargs})
resp, body = self.post('flavors', post_body)
body = json.loads(body)
@@ -92,9 +87,9 @@
"""Returns the primary type of resource this client works with."""
return 'flavor'
- def set_flavor_extra_spec(self, flavor_id, specs):
+ def set_flavor_extra_spec(self, flavor_id, **kwargs):
"""Sets extra Specs to the mentioned flavor."""
- post_body = json.dumps({'extra_specs': specs})
+ post_body = json.dumps({'extra_specs': kwargs})
resp, body = self.post('flavors/%s/os-extra_specs' % flavor_id,
post_body)
body = json.loads(body)
diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py
index b0ce2dc..4e7e93f 100644
--- a/tempest/services/compute/json/images_client.py
+++ b/tempest/services/compute/json/images_client.py
@@ -23,18 +23,10 @@
class ImagesClient(service_client.ServiceClient):
- def create_image(self, server_id, name, meta=None):
+ def create_image(self, server_id, **kwargs):
"""Creates an image of the original server."""
- post_body = {
- 'createImage': {
- 'name': name,
- }
- }
-
- if meta is not None:
- post_body['createImage']['metadata'] = meta
-
+ post_body = {'createImage': kwargs}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
post_body)
diff --git a/tempest/services/compute/json/security_group_default_rules_client.py b/tempest/services/compute/json/security_group_default_rules_client.py
index fcc715a..658b89a 100644
--- a/tempest/services/compute/json/security_group_default_rules_client.py
+++ b/tempest/services/compute/json/security_group_default_rules_client.py
@@ -22,8 +22,7 @@
class SecurityGroupDefaultRulesClient(service_client.ServiceClient):
- def create_security_default_group_rule(self, ip_protocol, from_port,
- to_port, **kwargs):
+ def create_security_default_group_rule(self, **kwargs):
"""
Creating security group default rules.
ip_protocol : ip_protocol (icmp, tcp, udp).
@@ -31,13 +30,7 @@
to_port : Port at end of range.
cidr : CIDR for address range.
"""
- post_body = {
- 'ip_protocol': ip_protocol,
- 'from_port': from_port,
- 'to_port': to_port,
- 'cidr': kwargs.get('cidr'),
- }
- post_body = json.dumps({'security_group_default_rule': post_body})
+ post_body = json.dumps({'security_group_default_rule': kwargs})
url = 'os-security-group-default-rules'
resp, body = self.post(url, post_body)
body = json.loads(body)
diff --git a/tempest/services/compute/json/security_group_rules_client.py b/tempest/services/compute/json/security_group_rules_client.py
index f570eb7..9a7c881 100644
--- a/tempest/services/compute/json/security_group_rules_client.py
+++ b/tempest/services/compute/json/security_group_rules_client.py
@@ -23,8 +23,7 @@
class SecurityGroupRulesClient(service_client.ServiceClient):
- def create_security_group_rule(self, parent_group_id, ip_proto, from_port,
- to_port, **kwargs):
+ def create_security_group_rule(self, **kwargs):
"""
Creating a new security group rules.
parent_group_id :ID of Security group
@@ -35,15 +34,7 @@
cidr : CIDR for address range.
group_id : ID of the Source group
"""
- post_body = {
- 'parent_group_id': parent_group_id,
- 'ip_protocol': ip_proto,
- 'from_port': from_port,
- 'to_port': to_port,
- 'cidr': kwargs.get('cidr'),
- 'group_id': kwargs.get('group_id'),
- }
- post_body = json.dumps({'security_group_rule': post_body})
+ post_body = json.dumps({'security_group_rule': kwargs})
url = 'os-security-group-rules'
resp, body = self.post(url, post_body)
body = json.loads(body)
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index eec961c..c0b667b 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -43,36 +43,26 @@
self.validate_response(schema.get_security_group, resp, body)
return service_client.ResponseBody(resp, body['security_group'])
- def create_security_group(self, name, description):
+ def create_security_group(self, **kwargs):
"""
Creates a new security group.
name (Required): Name of security group.
description (Required): Description of security group.
"""
- post_body = {
- 'name': name,
- 'description': description,
- }
- post_body = json.dumps({'security_group': post_body})
+ post_body = json.dumps({'security_group': kwargs})
resp, body = self.post('os-security-groups', post_body)
body = json.loads(body)
self.validate_response(schema.get_security_group, resp, body)
return service_client.ResponseBody(resp, body['security_group'])
- def update_security_group(self, security_group_id, name=None,
- description=None):
+ def update_security_group(self, security_group_id, **kwargs):
"""
Update a security group.
security_group_id: a security_group to update
name: new name of security group
description: new description of security group
"""
- post_body = {}
- if name:
- post_body['name'] = name
- if description:
- post_body['description'] = description
- post_body = json.dumps({'security_group': post_body})
+ post_body = json.dumps({'security_group': kwargs})
resp, body = self.put('os-security-groups/%s' % security_group_id,
post_body)
body = json.loads(body)
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index 4a27466..09e6d88 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -93,11 +93,13 @@
sec_grp_cli = self.manager.security_groups_client
s_name = data_utils.rand_name('sec_grp')
s_description = data_utils.rand_name('desc')
- self.sec_grp = sec_grp_cli.create_security_group(s_name,
- s_description)
+ self.sec_grp = sec_grp_cli.create_security_group(
+ name=s_name, description=s_description)
create_rule = sec_grp_cli.create_security_group_rule
- create_rule(self.sec_grp['id'], 'tcp', 22, 22)
- create_rule(self.sec_grp['id'], 'icmp', -1, -1)
+ create_rule(parent_group_id=self.sec_grp['id'], ip_protocol='tcp',
+ from_port=22, to_port=22)
+ create_rule(parent_group_id=self.sec_grp['id'], ip_protocol='icmp',
+ from_port=-1, to_port=-1)
def _destroy_sec_grp(self):
sec_grp_cli = self.manager.security_groups_client
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index c48ad4b..0e0141f 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -55,11 +55,13 @@
sec_grp_cli = self.manager.security_groups_client
s_name = data_utils.rand_name('sec_grp')
s_description = data_utils.rand_name('desc')
- self.sec_grp = sec_grp_cli.create_security_group(s_name,
- s_description)
+ self.sec_grp = sec_grp_cli.create_security_group(
+ name=s_name, description=s_description)
create_rule = sec_grp_cli.create_security_group_rule
- create_rule(self.sec_grp['id'], 'tcp', 22, 22)
- create_rule(self.sec_grp['id'], 'icmp', -1, -1)
+ create_rule(parent_group_id=self.sec_grp['id'], ip_protocol='tcp',
+ from_port=22, to_port=22)
+ create_rule(parent_group_id=self.sec_grp['id'], ip_protocol='icmp',
+ from_port=-1, to_port=-1)
def _destroy_sec_grp(self):
sec_grp_cli = self.manager.security_groups_client
diff --git a/tempest/tests/cmd/test_javelin.py b/tempest/tests/cmd/test_javelin.py
index f0921d5..3a3e46e 100644
--- a/tempest/tests/cmd/test_javelin.py
+++ b/tempest/tests/cmd/test_javelin.py
@@ -278,8 +278,8 @@
mocked_function = self.fake_client.secgroups.create_security_group
mocked_function.assert_called_once_with(
- self.fake_object['name'],
- self.fake_object['description'])
+ name=self.fake_object['name'],
+ description=self.fake_object['description'])
class TestDestroyResources(JavelinUnitTest):