Fix scenario base functions
There were two issues introduced in [1] which are fixed here:
- Calling create_server() with parameter security_groups=None fails,
we need to use the "default" group instead of passing "None" to nova.
- The signature of create_secgroup_rules() was changed, we need to
append the new parameter at the end in order to preserve
compatibility with existing callers.
[1] I711a10eef321622c335e35b84e386b01d73b938a
Change-Id: I506dfa66378a9c7c59e2296f35f88613a1bd3af1
diff --git a/neutron_tempest_plugin/scenario/base.py b/neutron_tempest_plugin/scenario/base.py
index 9fe6a94..50f6b54 100644
--- a/neutron_tempest_plugin/scenario/base.py
+++ b/neutron_tempest_plugin/scenario/base.py
@@ -77,8 +77,9 @@
"""
name = kwargs.get('name', data_utils.rand_name('server-test'))
- security_groups = kwargs.get(
- 'security_groups', [{'name': 'default'}])
+ security_groups = kwargs.get('security_groups')
+ if not security_groups:
+ security_groups = [{'name': 'default'}]
availability_zone = kwargs.get('availability_zone')
server_args = {
@@ -119,8 +120,8 @@
return body['keypair']
@classmethod
- def create_secgroup_rules(cls, rule_list, client=None,
- secgroup_id=None):
+ def create_secgroup_rules(cls, rule_list, secgroup_id=None,
+ client=None):
client = client or cls.os_primary.network_client
if not secgroup_id:
sgs = client.list_security_groups()['security_groups']
@@ -153,7 +154,7 @@
'port_range_max': 22,
'remote_ip_prefix': '0.0.0.0/0'}]
client = client or cls.os_primary.network_client
- cls.create_secgroup_rules(rule_list, client,
+ cls.create_secgroup_rules(rule_list, client=client,
secgroup_id=secgroup_id)
@classmethod
@@ -168,7 +169,7 @@
'port_range_max': 0, # code
'remote_ip_prefix': '0.0.0.0/0'}]
client = client or cls.os_primary.network_client
- cls.create_secgroup_rules(rule_list, client,
+ cls.create_secgroup_rules(rule_list, client=client,
secgroup_id=secgroup_id)
@classmethod