diff --git a/releasenotes/notes/create_security_group_rule-16d58a8f0f0ff262.yaml b/releasenotes/notes/create_security_group_rule-16d58a8f0f0ff262.yaml new file mode 100644 index 0000000000..3354f65984 --- /dev/null +++ b/releasenotes/notes/create_security_group_rule-16d58a8f0f0ff262.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Added public interface create_security_group_rule(). + Since this interface is meant to be used by tempest plugins, + It doesn't neccessarily require to be private api. diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py index acc563acb7..b6507846a9 100644 --- a/tempest/scenario/manager.py +++ b/tempest/scenario/manager.py @@ -1387,10 +1387,10 @@ class NetworkScenarioTest(ScenarioTest): client.delete_security_group, secgroup['id']) return secgroup - def _create_security_group_rule(self, secgroup=None, - sec_group_rules_client=None, - project_id=None, - security_groups_client=None, **kwargs): + def create_security_group_rule(self, secgroup=None, + sec_group_rules_client=None, + project_id=None, + security_groups_client=None, **kwargs): """Create a rule from a dictionary of rule parameters. Create a rule in a secgroup. if secgroup not defined will search for @@ -1474,7 +1474,7 @@ class NetworkScenarioTest(ScenarioTest): for r_direction in ['ingress', 'egress']: ruleset['direction'] = r_direction try: - sg_rule = self._create_security_group_rule( + sg_rule = self.create_security_group_rule( sec_group_rules_client=sec_group_rules_client, secgroup=secgroup, security_groups_client=security_groups_client, diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py index 3fc93e4aa4..0c91257f23 100644 --- a/tempest/scenario/test_security_groups_basic_ops.py +++ b/tempest/scenario/test_security_groups_basic_ops.py @@ -217,7 +217,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): direction='ingress', ) sec_group_rules_client = tenant.manager.security_group_rules_client - self._create_security_group_rule( + self.create_security_group_rule( secgroup=access_sg, sec_group_rules_client=sec_group_rules_client, **ssh_rule) @@ -385,7 +385,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): remote_group_id=tenant.security_groups['default']['id'], direction='ingress' ) - self._create_security_group_rule( + self.create_security_group_rule( secgroup=tenant.security_groups['default'], security_groups_client=tenant.manager.security_groups_client, **ruleset @@ -413,7 +413,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): protocol = ruleset['protocol'] sec_group_rules_client = ( dest_tenant.manager.security_group_rules_client) - self._create_security_group_rule( + self.create_security_group_rule( secgroup=dest_tenant.security_groups['default'], sec_group_rules_client=sec_group_rules_client, **ruleset @@ -429,7 +429,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): # allow reverse traffic and check sec_group_rules_client = ( source_tenant.manager.security_group_rules_client) - self._create_security_group_rule( + self.create_security_group_rule( secgroup=source_tenant.security_groups['default'], sec_group_rules_client=sec_group_rules_client, **ruleset @@ -543,7 +543,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): direction='ingress', ) sec_group_rules_client = new_tenant.manager.security_group_rules_client - self._create_security_group_rule( + self.create_security_group_rule( secgroup=new_sg, sec_group_rules_client=sec_group_rules_client, **icmp_rule) @@ -596,7 +596,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): protocol='icmp', direction='ingress' ) - self._create_security_group_rule( + self.create_security_group_rule( secgroup=tenant.security_groups['default'], **ruleset )