Remove list_security_group_rules wrapper method
On Nova side there is no API which return sec grp rules list. This method is just implemented in Tempest service cleints. This is a wrapper method on show sec group API and return complete sec group like show sec group method of security_group_client does. This method should be removed and tests can use the show sec grp method to fethch the rules. Implements: blueprint method-return-value-and-move-service-clients-to-lib Change-Id: If8c82c978d269f59f4606b65b25e1eace20e9b4a
This commit is contained in:
		@@ -161,8 +161,8 @@ class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest):
 | 
			
		||||
        self.addCleanup(self.client.delete_security_group_rule, rule2_id)
 | 
			
		||||
 | 
			
		||||
        # Get rules of the created Security Group
 | 
			
		||||
        rules = (self.client.list_security_group_rules(securitygroup_id)
 | 
			
		||||
                 ['rules'])
 | 
			
		||||
        rules = self.security_groups_client.show_security_group(
 | 
			
		||||
            securitygroup_id)['security_group']['rules']
 | 
			
		||||
        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]))
 | 
			
		||||
 | 
			
		||||
@@ -187,6 +187,7 @@ class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest):
 | 
			
		||||
        # Delete group2
 | 
			
		||||
        self.security_groups_client.delete_security_group(sg2_id)
 | 
			
		||||
        # Get rules of the Group1
 | 
			
		||||
        rules = self.client.list_security_group_rules(sg1_id)['rules']
 | 
			
		||||
        rules = (self.security_groups_client.show_security_group(sg1_id)
 | 
			
		||||
                 ['security_group']['rules'])
 | 
			
		||||
        # The group1 has no rules because group2 has deleted
 | 
			
		||||
        self.assertEqual(0, len(rules))
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,6 @@
 | 
			
		||||
#    under the License.
 | 
			
		||||
 | 
			
		||||
from oslo_serialization import jsonutils as json
 | 
			
		||||
from tempest_lib import exceptions as lib_exc
 | 
			
		||||
 | 
			
		||||
from tempest.api_schema.response.compute.v2_1 import security_groups as schema
 | 
			
		||||
from tempest.common import service_client
 | 
			
		||||
@@ -46,13 +45,3 @@ class SecurityGroupRulesClient(service_client.ServiceClient):
 | 
			
		||||
                                 group_rule_id)
 | 
			
		||||
        self.validate_response(schema.delete_security_group_rule, resp, body)
 | 
			
		||||
        return service_client.ResponseBody(resp, body)
 | 
			
		||||
 | 
			
		||||
    def list_security_group_rules(self, security_group_id):
 | 
			
		||||
        """List all rules for a security group."""
 | 
			
		||||
        resp, body = self.get('os-security-groups')
 | 
			
		||||
        body = json.loads(body)
 | 
			
		||||
        self.validate_response(schema.list_security_groups, resp, body)
 | 
			
		||||
        for sg in body['security_groups']:
 | 
			
		||||
            if sg['id'] == security_group_id:
 | 
			
		||||
                return service_client.ResponseBody(resp, sg)
 | 
			
		||||
        raise lib_exc.NotFound('No such Security Group')
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user