Merge "Fix typos in boto decision_maker()"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 949302f..0eeb738 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -439,6 +439,9 @@
# running instances? (boolean value)
#snapshot = true
+# Does the test environment have the ec2 api running? (boolean value)
+#ec2_api = true
+
[dashboard]
diff --git a/tempest/api/compute/admin/test_quotas_negative.py b/tempest/api/compute/admin/test_quotas_negative.py
index 532f195..0c511d7 100644
--- a/tempest/api/compute/admin/test_quotas_negative.py
+++ b/tempest/api/compute/admin/test_quotas_negative.py
@@ -142,7 +142,7 @@
s_name = data_utils.rand_name('securitygroup-')
s_description = data_utils.rand_name('description-')
- resp, securitygroup =\
+ securitygroup =\
self.sg_client.create_security_group(s_name, s_description)
self.addCleanup(self.sg_client.delete_security_group,
securitygroup['id'])
diff --git a/tempest/api/compute/admin/test_security_group_default_rules.py b/tempest/api/compute/admin/test_security_group_default_rules.py
index 4c0bd47..563d517 100644
--- a/tempest/api/compute/admin/test_security_group_default_rules.py
+++ b/tempest/api/compute/admin/test_security_group_default_rules.py
@@ -40,7 +40,7 @@
from_port=22, to_port=22,
cidr='10.10.0.0/24'):
# Create Security Group default rule
- _, rule = self.adm_client.create_security_default_group_rule(
+ rule = self.adm_client.create_security_default_group_rule(
ip_protocol,
from_port,
to_port,
@@ -68,7 +68,7 @@
ip_protocol = 'udp'
from_port = 80
to_port = 80
- _, rule = self.adm_client.create_security_default_group_rule(
+ rule = self.adm_client.create_security_default_group_rule(
ip_protocol,
from_port,
to_port)
@@ -83,7 +83,7 @@
from_port = 10
to_port = 10
cidr = ''
- _, rule = self.adm_client.create_security_default_group_rule(
+ rule = self.adm_client.create_security_default_group_rule(
ip_protocol,
from_port,
to_port,
@@ -105,7 +105,7 @@
cidr)
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
- _, rules = self.adm_client.list_security_group_default_rules()
+ rules = self.adm_client.list_security_group_default_rules()
self.assertNotEqual(0, len(rules))
self.assertIn(rule, rules)
@@ -121,6 +121,6 @@
cidr)
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
- _, fetched_rule = self.adm_client.get_security_group_default_rule(
+ fetched_rule = self.adm_client.get_security_group_default_rule(
rule['id'])
self.assertEqual(rule, fetched_rule)
diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py
index b4615f2..82cb26e 100644
--- a/tempest/api/compute/admin/test_security_groups.py
+++ b/tempest/api/compute/admin/test_security_groups.py
@@ -33,11 +33,9 @@
def _delete_security_group(self, securitygroup_id, admin=True):
if admin:
- resp, _ = self.adm_client.delete_security_group(securitygroup_id)
+ self.adm_client.delete_security_group(securitygroup_id)
else:
- resp, _ = self.client.delete_security_group(securitygroup_id)
-
- self.assertEqual(202, resp.status)
+ self.client.delete_security_group(securitygroup_id)
@testtools.skipIf(CONF.service_available.neutron,
"Skipped because neutron do not support all_tenants"
@@ -52,9 +50,8 @@
for i in range(2):
name = data_utils.rand_name('securitygroup-')
description = data_utils.rand_name('description-')
- resp, securitygroup = (self.client
- .create_security_group(name, description))
- self.assertEqual(200, resp.status)
+ securitygroup = (self.client
+ .create_security_group(name, description))
self.addCleanup(self._delete_security_group,
securitygroup['id'], admin=False)
security_group_list.append(securitygroup)
@@ -64,18 +61,16 @@
for i in range(2):
name = data_utils.rand_name('securitygroup-')
description = data_utils.rand_name('description-')
- resp, adm_securitygroup = (self.adm_client
- .create_security_group(name,
- description))
- self.assertEqual(200, resp.status)
+ adm_securitygroup = (self.adm_client
+ .create_security_group(name,
+ description))
self.addCleanup(self._delete_security_group,
adm_securitygroup['id'])
security_group_list.append(adm_securitygroup)
# Fetch all security groups based on 'all_tenants' search filter
param = {'all_tenants': 'true'}
- resp, fetched_list = self.adm_client.list_security_groups(params=param)
- self.assertEqual(200, resp.status)
+ fetched_list = self.adm_client.list_security_groups(params=param)
sec_group_id_list = map(lambda sg: sg['id'], fetched_list)
# Now check if all created Security Groups are present in fetched list
for sec_group in security_group_list:
@@ -83,8 +78,7 @@
# Fetch all security groups for non-admin user with 'all_tenants'
# search filter
- resp, fetched_list = self.client.list_security_groups(params=param)
- self.assertEqual(200, resp.status)
+ fetched_list = self.client.list_security_groups(params=param)
# Now check if all created Security Groups are present in fetched list
for sec_group in fetched_list:
self.assertEqual(sec_group['tenant_id'], client_tenant_id,
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index c245eb4..3e80bf2 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -159,8 +159,7 @@
str(sg['id']) for sg in cls.security_groups))
for sg in cls.security_groups:
try:
- resp, body =\
- cls.security_groups_client.delete_security_group(sg['id'])
+ cls.security_groups_client.delete_security_group(sg['id'])
except exceptions.NotFound:
# The security group may have already been deleted which is OK.
pass
@@ -235,12 +234,12 @@
name = data_utils.rand_name(cls.__name__ + "-securitygroup")
if description is None:
description = data_utils.rand_name('description-')
- resp, body = \
+ body = \
cls.security_groups_client.create_security_group(name,
description)
cls.security_groups.append(body)
- return resp, body
+ return body
@classmethod
def create_test_server_group(cls, name="", policy=None):
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 be06213..527f2dd 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -61,10 +61,10 @@
# Positive test: Creation of Security Group rule
# should be successful
# Creating a Security Group to add rules to it
- _, security_group = self.create_security_group()
+ security_group = self.create_security_group()
securitygroup_id = security_group['id']
# Adding rules to the created Security Group
- _, rule = \
+ rule = \
self.client.create_security_group_rule(securitygroup_id,
self.ip_protocol,
self.from_port,
@@ -81,12 +81,12 @@
# should be successful
# Creating a Security Group to add rules to it
- _, security_group = self.create_security_group()
+ security_group = self.create_security_group()
parent_group_id = security_group['id']
# Adding rules to the created Security Group with optional cidr
cidr = '10.2.3.124/24'
- _, rule = \
+ rule = \
self.client.create_security_group_rule(parent_group_id,
self.ip_protocol,
self.from_port,
@@ -104,16 +104,16 @@
# should be successful
# Creating a Security Group to add rules to it
- _, security_group = self.create_security_group()
+ security_group = self.create_security_group()
parent_group_id = security_group['id']
# Creating a Security Group so as to assign group_id to the rule
- _, security_group = self.create_security_group()
+ security_group = self.create_security_group()
group_id = security_group['id']
group_name = security_group['name']
# Adding rules to the created Security Group with optional group_id
- _, rule = \
+ rule = \
self.client.create_security_group_rule(parent_group_id,
self.ip_protocol,
self.from_port,
@@ -130,11 +130,11 @@
# Positive test: Created Security Group rules should be
# in the list of all rules
# Creating a Security Group to add rules to it
- resp, security_group = self.create_security_group()
+ security_group = self.create_security_group()
securitygroup_id = security_group['id']
# Add a first rule to the created Security Group
- resp, rule = \
+ rule = \
self.client.create_security_group_rule(securitygroup_id,
self.ip_protocol,
self.from_port,
@@ -145,7 +145,7 @@
ip_protocol2 = 'icmp'
from_port2 = -1
to_port2 = -1
- resp, rule = \
+ rule = \
self.client.create_security_group_rule(securitygroup_id,
ip_protocol2,
from_port2, to_port2)
@@ -154,7 +154,7 @@
self.addCleanup(self.client.delete_security_group_rule, rule2_id)
# Get rules of the created Security Group
- resp, rules = \
+ rules = \
self.client.list_security_group_rules(securitygroup_id)
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]))
@@ -164,25 +164,22 @@
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
- resp, security_group = self.create_security_group()
+ security_group = self.create_security_group()
sg1_id = security_group['id']
# Creating other Security Group to access to group1
- resp, security_group = self.create_security_group()
+ security_group = self.create_security_group()
sg2_id = security_group['id']
# Adding rules to the Group1
- resp, rule = \
- 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(sg1_id,
+ self.ip_protocol,
+ self.from_port,
+ self.to_port,
+ group_id=sg2_id)
- self.assertEqual(200, resp.status)
# Delete group2
- resp, body = self.client.delete_security_group(sg2_id)
- self.assertEqual(202, resp.status)
+ self.client.delete_security_group(sg2_id)
# Get rules of the Group1
- resp, rules = \
+ rules = \
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 88a99b9..d97c404 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
@@ -69,20 +69,19 @@
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
- resp, sg = self.create_security_group()
+ 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
- resp, rule = \
+ rule = \
self.client.create_security_group_rule(parent_group_id,
ip_protocol,
from_port,
to_port)
self.addCleanup(self.client.delete_security_group_rule, rule['id'])
- self.assertEqual(200, resp.status)
# Add the same rule to the group should fail
self.assertRaises(exceptions.BadRequest,
self.client.create_security_group_rule,
@@ -94,7 +93,7 @@
# Negative test: Creation of Security Group rule should FAIL
# with invalid ip_protocol
# Creating a Security Group to add rule to it
- resp, sg = self.create_security_group()
+ sg = self.create_security_group()
# Adding rules to the created Security Group
parent_group_id = sg['id']
ip_protocol = data_utils.rand_name('999')
@@ -111,7 +110,7 @@
# Negative test: Creation of Security Group rule should FAIL
# with invalid from_port
# Creating a Security Group to add rule to it
- resp, sg = self.create_security_group()
+ sg = self.create_security_group()
# Adding rules to the created Security Group
parent_group_id = sg['id']
ip_protocol = 'tcp'
@@ -127,7 +126,7 @@
# Negative test: Creation of Security Group rule should FAIL
# with invalid to_port
# Creating a Security Group to add rule to it
- resp, sg = self.create_security_group()
+ sg = self.create_security_group()
# Adding rules to the created Security Group
parent_group_id = sg['id']
ip_protocol = 'tcp'
@@ -143,7 +142,7 @@
# Negative test: Creation of Security Group rule should FAIL
# with invalid port range.
# Creating a Security Group to add rule to it.
- resp, sg = self.create_security_group()
+ sg = self.create_security_group()
# Adding a rule to the created Security Group
secgroup_id = sg['id']
ip_protocol = 'tcp'
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 1cfb16b..909d444 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -33,13 +33,11 @@
# Create 3 Security Groups
security_group_list = []
for i in range(3):
- resp, body = self.create_security_group()
- self.assertEqual(200, resp.status)
+ body = self.create_security_group()
security_group_list.append(body)
# 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)
+ fetched_list = self.client.list_security_groups()
# Now check if all the created Security Groups are in fetched list
missing_sgs = \
[sg for sg in security_group_list if sg not in fetched_list]
@@ -49,11 +47,10 @@
for m_group in missing_sgs))
# Delete all security groups
for sg in security_group_list:
- resp, _ = self.client.delete_security_group(sg['id'])
- self.assertEqual(202, resp.status)
+ self.client.delete_security_group(sg['id'])
self.client.wait_for_resource_deletion(sg['id'])
# Now check if all the created Security Groups are deleted
- resp, fetched_list = self.client.list_security_groups()
+ fetched_list = self.client.list_security_groups()
deleted_sgs = \
[sg for sg in security_group_list if sg in fetched_list]
self.assertFalse(deleted_sgs,
@@ -68,22 +65,19 @@
# with char space between name along with
# leading and trailing spaces
s_name = ' %s ' % data_utils.rand_name('securitygroup ')
- resp, securitygroup = self.create_security_group(name=s_name)
- self.assertEqual(200, resp.status)
+ securitygroup = self.create_security_group(name=s_name)
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")
# Now fetch the created Security Group by its 'id'
- resp, fetched_group = \
+ fetched_group = \
self.client.get_security_group(securitygroup['id'])
- self.assertEqual(200, resp.status)
self.assertEqual(securitygroup, fetched_group,
"The fetched Security Group is different "
"from the created Group")
- resp, _ = self.client.delete_security_group(securitygroup['id'])
- self.assertEqual(202, resp.status)
+ self.client.delete_security_group(securitygroup['id'])
self.client.wait_for_resource_deletion(securitygroup['id'])
@test.attr(type='smoke')
@@ -93,8 +87,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
- resp, sg = self.create_security_group()
- resp, sg2 = self.create_security_group()
+ sg = self.create_security_group()
+ sg2 = self.create_security_group()
# Create server and add the security group created
# above to the server we just created
@@ -128,30 +122,25 @@
self.servers_client.delete_server(server_id)
self.servers_client.wait_for_server_termination(server_id)
- resp, _ = self.client.delete_security_group(sg['id'])
- self.assertEqual(202, resp.status)
- resp, _ = self.client.delete_security_group(sg2['id'])
- self.assertEqual(202, resp.status)
+ self.client.delete_security_group(sg['id'])
+ self.client.delete_security_group(sg2['id'])
@test.attr(type='smoke')
@test.services('network')
def test_update_security_groups(self):
# Update security group name and description
# Create a security group
- resp, securitygroup = self.create_security_group()
- self.assertEqual(200, resp.status)
+ securitygroup = self.create_security_group()
self.assertIn('id', securitygroup)
securitygroup_id = 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-')
- resp, sg_new = \
- self.client.update_security_group(securitygroup_id,
- name=s_new_name,
- description=s_new_des)
- self.assertEqual(200, resp.status)
+ self.client.update_security_group(securitygroup_id,
+ name=s_new_name,
+ description=s_new_des)
# get the security group
- resp, fetched_group = \
+ fetched_group = \
self.client.get_security_group(securitygroup_id)
self.assertEqual(s_new_name, fetched_group['name'])
self.assertEqual(s_new_des, fetched_group['description'])
diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py
index ce06180..988482b 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -34,7 +34,7 @@
def _generate_a_non_existent_security_group_id(self):
security_group_id = []
- resp, body = self.client.list_security_groups()
+ body = self.client.list_security_groups()
for i in range(len(body)):
security_group_id.append(body[i]['id'])
# Generate a non-existent security group id
@@ -105,9 +105,7 @@
# be created
s_name = data_utils.rand_name('securitygroup-')
s_description = data_utils.rand_name('description-')
- resp, security_group =\
- self.create_security_group(s_name, s_description)
- self.assertEqual(200, resp.status)
+ self.create_security_group(s_name, s_description)
# Now try the Security Group with the same 'Name'
self.assertRaises(exceptions.BadRequest,
self.client.create_security_group, s_name,
@@ -118,7 +116,7 @@
def test_delete_the_default_security_group(self):
# Negative test:Deletion of the "default" Security Group should Fail
default_security_group_id = None
- resp, body = self.client.list_security_groups()
+ body = self.client.list_security_groups()
for i in range(len(body)):
if body[i]['name'] == 'default':
default_security_group_id = body[i]['id']
@@ -164,8 +162,7 @@
@test.services('network')
def test_update_security_group_with_invalid_sg_name(self):
# Update security_group with invalid sg_name should fail
- resp, securitygroup = self.create_security_group()
- self.assertEqual(200, resp.status)
+ securitygroup = self.create_security_group()
self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
# Update Security Group with group name longer than 255 chars
@@ -180,8 +177,7 @@
@test.services('network')
def test_update_security_group_with_invalid_sg_des(self):
# Update security_group with invalid sg_des should fail
- resp, securitygroup = self.create_security_group()
- self.assertEqual(200, resp.status)
+ securitygroup = self.create_security_group()
self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
# Update Security Group with group description longer than 255 chars
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index ee1e268..b04fe69 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -40,7 +40,7 @@
# Security group creation
cls.sg_name = data_utils.rand_name('sg')
cls.sg_desc = data_utils.rand_name('sg-desc')
- resp, cls.sg = \
+ cls.sg = \
cls.security_groups_client.create_security_group(cls.sg_name,
cls.sg_desc)
cls.sg_id = cls.sg['id']
@@ -58,7 +58,7 @@
def resource_cleanup(cls):
# Deleting the floating IP which is created in this method
cls.floating_ips_client.delete_floating_ip(cls.floating_ip_id)
- resp, cls.sg = cls.security_groups_client.delete_security_group(
+ cls.sg = cls.security_groups_client.delete_security_group(
cls.sg_id)
super(ServerRescueTestJSON, cls).resource_cleanup()
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 60cb812..fda4107 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -73,14 +73,14 @@
name = data_utils.rand_name('security')
description = data_utils.rand_name('description')
- resp, cls.security_group = cls.security_client.create_security_group(
+ cls.security_group = cls.security_client.create_security_group(
name, description)
parent_group_id = cls.security_group['id']
ip_protocol = 'tcp'
from_port = 22
to_port = 22
- resp, cls.rule = cls.security_client.create_security_group_rule(
+ cls.rule = cls.security_client.create_security_group_rule(
parent_group_id, ip_protocol, from_port, to_port)
@classmethod
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index a0bbb70..80f2e22 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -271,7 +271,7 @@
def list(self):
client = self.client
- _, secgrps = client.list_security_groups()
+ secgrps = client.list_security_groups()
secgrp_del = [grp for grp in secgrps if grp['name'] != 'default']
LOG.debug("List count, %s Security Groups" % len(secgrp_del))
return secgrp_del
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 48ea823..a170edc 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -851,17 +851,14 @@
# only create a security group if the name isn't here
# i.e. a security group may be used by another server
# only create a router if the name isn't here
- r, body = client.secgroups.list_security_groups()
+ body = client.secgroups.list_security_groups()
if any(item['name'] == secgroup['name'] for item in body):
LOG.warning("Security group '%s' already exists" %
secgroup['name'])
continue
- resp, body = client.secgroups.create_security_group(
+ body = client.secgroups.create_security_group(
secgroup['name'], secgroup['description'])
- if not resp_ok(resp):
- raise ValueError("Failed to create security group: [%s] %s" %
- (resp, body))
secgroup_id = body['id']
# for each security group, create the rules
for rule in secgroup['rules']:
diff --git a/tempest/config.py b/tempest/config.py
index 70f972f..c60434a 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -349,7 +349,10 @@
cfg.BoolOpt('snapshot',
default=True,
help='Does the test environment support creating snapshot '
- 'images of running instances?')
+ 'images of running instances?'),
+ cfg.BoolOpt('ec2_api',
+ default=True,
+ help='Does the test environment have the ec2 api running?')
]
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 5b092c3..0fcc75b 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -236,7 +236,7 @@
def _create_loginable_secgroup_rule(self, secgroup_id=None):
_client = self.security_groups_client
if secgroup_id is None:
- _, sgs = _client.list_security_groups()
+ sgs = _client.list_security_groups()
for sg in sgs:
if sg['name'] == 'default':
secgroup_id = sg['id']
@@ -263,8 +263,8 @@
]
rules = list()
for ruleset in rulesets:
- _, sg_rule = _client.create_security_group_rule(secgroup_id,
- **ruleset)
+ sg_rule = _client.create_security_group_rule(secgroup_id,
+ **ruleset)
self.addCleanup(self.delete_wrapper,
_client.delete_security_group_rule,
sg_rule['id'])
@@ -275,7 +275,7 @@
# Create security group
sg_name = data_utils.rand_name(self.__class__.__name__)
sg_desc = sg_name + " description"
- _, secgroup = self.security_groups_client.create_security_group(
+ secgroup = self.security_groups_client.create_security_group(
sg_name, sg_desc)
self.assertEqual(secgroup['name'], sg_name)
self.assertEqual(secgroup['description'], sg_desc)
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index 60fd2bd..99a2023 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -74,7 +74,7 @@
# Explicitly create secgroup to avoid cleanup at the end of testcases.
# Since no traffic is tested, we don't need to actually add rules to
# secgroup
- _, secgroup = self.security_groups_client.create_security_group(
+ secgroup = self.security_groups_client.create_security_group(
'secgroup-%s' % name, 'secgroup-desc-%s' % name)
self.addCleanupClass(self.security_groups_client.delete_security_group,
secgroup['id'])
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 5d0c16f..b370e00 100644
--- a/tempest/services/compute/json/security_group_default_rules_client.py
+++ b/tempest/services/compute/json/security_group_default_rules_client.py
@@ -43,7 +43,8 @@
body = json.loads(body)
self.validate_response(schema.create_get_security_group_default_rule,
resp, body)
- return resp, body['security_group_default_rule']
+ rule = body['security_group_default_rule']
+ return service_client.ResponseBody(resp, rule)
def delete_security_group_default_rule(self,
security_group_default_rule_id):
@@ -52,7 +53,7 @@
security_group_default_rule_id))
self.validate_response(schema.delete_security_group_default_rule,
resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_security_group_default_rules(self):
"""List all Security Group default rules."""
@@ -60,7 +61,8 @@
body = json.loads(body)
self.validate_response(schema.list_security_group_default_rules,
resp, body)
- return resp, body['security_group_default_rules']
+ rules = body['security_group_default_rules']
+ return service_client.ResponseBodyList(resp, rules)
def get_security_group_default_rule(self, security_group_default_rule_id):
"""Return the details of provided Security Group default rule."""
@@ -69,4 +71,5 @@
body = json.loads(body)
self.validate_response(schema.create_get_security_group_default_rule,
resp, body)
- return resp, body['security_group_default_rule']
+ rule = body['security_group_default_rule']
+ return service_client.ResponseBody(resp, rule)
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index 1ac52af..410ad60 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -33,7 +33,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_security_groups, resp, body)
- return resp, body['security_groups']
+ return service_client.ResponseBodyList(resp, body['security_groups'])
def get_security_group(self, security_group_id):
"""Get the details of a Security Group."""
@@ -41,7 +41,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_security_group, resp, body)
- return resp, body['security_group']
+ return service_client.ResponseBody(resp, body['security_group'])
def create_security_group(self, name, description):
"""
@@ -57,7 +57,7 @@
resp, body = self.post('os-security-groups', post_body)
body = json.loads(body)
self.validate_response(schema.get_security_group, resp, body)
- return resp, body['security_group']
+ return service_client.ResponseBody(resp, body['security_group'])
def update_security_group(self, security_group_id, name=None,
description=None):
@@ -77,14 +77,14 @@
post_body)
body = json.loads(body)
self.validate_response(schema.update_security_group, resp, body)
- return resp, body['security_group']
+ return service_client.ResponseBody(resp, body['security_group'])
def delete_security_group(self, security_group_id):
"""Deletes the provided Security Group."""
resp, body = self.delete(
'os-security-groups/%s' % str(security_group_id))
self.validate_response(schema.delete_security_group, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_security_group_rule(self, parent_group_id, ip_proto, from_port,
to_port, **kwargs):
@@ -111,14 +111,14 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.validate_response(schema.create_security_group_rule, resp, body)
- return resp, body['security_group_rule']
+ return service_client.ResponseBody(resp, body['security_group_rule'])
def delete_security_group_rule(self, group_rule_id):
"""Deletes the provided Security Group rule."""
resp, body = self.delete('os-security-group-rules/%s' %
str(group_rule_id))
self.validate_response(schema.delete_security_group_rule, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_security_group_rules(self, security_group_id):
"""List all rules for a security group."""
@@ -127,7 +127,7 @@
self.validate_response(schema.list_security_groups, resp, body)
for sg in body['security_groups']:
if sg['id'] == security_group_id:
- return resp, sg['rules']
+ return service_client.ResponseBodyList(resp, sg['rules'])
raise exceptions.NotFound('No such Security Group')
def is_resource_deleted(self, id):
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index 5bc8cac..c473df6 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -92,8 +92,8 @@
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(s_name,
+ 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)
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index a13d890..aa3cad0 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -53,8 +53,8 @@
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(s_name,
+ 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)
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index b494db6..94d4b30 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -46,7 +46,7 @@
pass
secgrp_client = admin_manager.security_groups_client
- _, secgrp = secgrp_client.list_security_groups({"all_tenants": True})
+ secgrp = secgrp_client.list_security_groups({"all_tenants": True})
secgrp_del = [grp for grp in secgrp if grp['name'] != 'default']
LOG.info("Cleanup::remove %s Security Group" % len(secgrp_del))
for g in secgrp_del:
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index 566ce90..edd9de1 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -195,6 +195,12 @@
"""Recommended to use as base class for boto related test."""
@classmethod
+ def skip_checks(cls):
+ super(BotoTestCase, cls).skip_checks()
+ if not CONF.compute_feature_enabled.ec2_api:
+ raise cls.skipException("The EC2 API is not available")
+
+ @classmethod
def resource_setup(cls):
super(BotoTestCase, cls).resource_setup()
cls.conclusion = decision_maker()