Security Groups API Tests Enhancements
Add test to create security rule
-Create a security group rule with protocol attribute as integer value
-Validate the security rule protocol value
Change-Id: Icd967f8d25a55c3e0db57af8e764bfb0a3dab6f9
diff --git a/tempest/api/network/test_security_groups.py b/tempest/api/network/test_security_groups.py
index cea8344..855b5fb 100644
--- a/tempest/api/network/test_security_groups.py
+++ b/tempest/api/network/test_security_groups.py
@@ -126,6 +126,24 @@
self.assertEqual(int(sec_group_rule['port_range_min']), port_range_min)
self.assertEqual(int(sec_group_rule['port_range_max']), port_range_max)
+ @test.attr(type='smoke')
+ def test_create_security_group_rule_with_protocol_integer_value(self):
+ # Verify creating security group rule with the
+ # protocol as integer value
+ # arguments : "protocol": 17
+ group_create_body, _ = self._create_security_group()
+ direction = 'ingress'
+ protocol = 17
+ security_group_id = group_create_body['security_group']['id']
+ _, rule_create_body = self.client.create_security_group_rule(
+ security_group_id=security_group_id,
+ direction=direction,
+ protocol=protocol
+ )
+ sec_group_rule = rule_create_body['security_group_rule']
+ self.assertEqual(sec_group_rule['direction'], direction)
+ self.assertEqual(int(sec_group_rule['protocol']), protocol)
+
class SecGroupTestXML(SecGroupTest):
_interface = 'xml'