Merge "Stabilize _create_loginable_secgroup_rule"
This commit is contained in:
commit
5364a9a789
|
@ -504,7 +504,14 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||||
self.addCleanup(self._cleanup_volume_type, volume_type)
|
self.addCleanup(self._cleanup_volume_type, volume_type)
|
||||||
return volume_type
|
return volume_type
|
||||||
|
|
||||||
def _create_loginable_secgroup_rule(self, secgroup_id=None):
|
def _create_loginable_secgroup_rule(self, secgroup_id=None, rulesets=None):
|
||||||
|
"""Create loginable security group rule by compute clients.
|
||||||
|
|
||||||
|
This function will create by default the following rules:
|
||||||
|
1. tcp port 22 allow rule in order to allow ssh access for ipv4
|
||||||
|
2. ipv4 icmp allow rule in order to allow icmpv4
|
||||||
|
"""
|
||||||
|
|
||||||
_client = self.compute_security_groups_client
|
_client = self.compute_security_groups_client
|
||||||
_client_rules = self.compute_security_group_rules_client
|
_client_rules = self.compute_security_group_rules_client
|
||||||
if secgroup_id is None:
|
if secgroup_id is None:
|
||||||
|
@ -517,22 +524,23 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||||
# traffic from all sources, so no group_id is provided.
|
# traffic from all sources, so no group_id is provided.
|
||||||
# Setting a group_id would only permit traffic from ports
|
# Setting a group_id would only permit traffic from ports
|
||||||
# belonging to the same security group.
|
# belonging to the same security group.
|
||||||
rulesets = [
|
if not rulesets:
|
||||||
{
|
rulesets = [
|
||||||
# ssh
|
{
|
||||||
'ip_protocol': 'tcp',
|
# ssh
|
||||||
'from_port': 22,
|
'ip_protocol': 'tcp',
|
||||||
'to_port': 22,
|
'from_port': 22,
|
||||||
'cidr': '0.0.0.0/0',
|
'to_port': 22,
|
||||||
},
|
'cidr': '0.0.0.0/0',
|
||||||
{
|
},
|
||||||
# ping
|
{
|
||||||
'ip_protocol': 'icmp',
|
# ping
|
||||||
'from_port': -1,
|
'ip_protocol': 'icmp',
|
||||||
'to_port': -1,
|
'from_port': -1,
|
||||||
'cidr': '0.0.0.0/0',
|
'to_port': -1,
|
||||||
}
|
'cidr': '0.0.0.0/0',
|
||||||
]
|
}
|
||||||
|
]
|
||||||
rules = list()
|
rules = list()
|
||||||
for ruleset in rulesets:
|
for ruleset in rulesets:
|
||||||
sg_rule = _client_rules.create_security_group_rule(
|
sg_rule = _client_rules.create_security_group_rule(
|
||||||
|
@ -1414,7 +1422,7 @@ class NetworkScenarioTest(ScenarioTest):
|
||||||
def _create_loginable_secgroup_rule(self, security_group_rules_client=None,
|
def _create_loginable_secgroup_rule(self, security_group_rules_client=None,
|
||||||
secgroup=None,
|
secgroup=None,
|
||||||
security_groups_client=None):
|
security_groups_client=None):
|
||||||
"""Create loginable security group rule
|
"""Create loginable security group rule by neutron clients by default.
|
||||||
|
|
||||||
This function will create:
|
This function will create:
|
||||||
1. egress and ingress tcp port 22 allow rule in order to allow ssh
|
1. egress and ingress tcp port 22 allow rule in order to allow ssh
|
||||||
|
|
Loading…
Reference in New Issue