Add API test for normalized CIDR attribute in the SG rule

This patch adds test which replaces fullstack test:
neutron.tests.fullstack.test_securitygroup.SecurityGroupRulesTest.test_normalized_cidr_in_rule

It is simple API test which can be done quickly in
neutron-tempest-plugin job. In fullstack instead it requires to prepare
whole environment with neutron-server, fake compute
node, agents, etc. so it takes much more time.

Change-Id: I4124f7f0a2edfe28c95693280b6490c8884fce11
This commit is contained in:
Slawek Kaplonski 2023-12-06 11:01:24 +01:00
parent eec234d703
commit 63396f05fd
2 changed files with 23 additions and 0 deletions

View File

@ -740,3 +740,25 @@ class SecGroupSearchCriteriaTest(base.BaseSearchCriteriaTest):
@decorators.idempotent_id('5c78bd57-e6e9-4e71-a05c-9c4082a3f139')
def test_list_no_pagination_limit_0(self):
self._test_list_no_pagination_limit_0()
class SecGroupNormalizedCidrTest(base.BaseNetworkTest):
required_extensions = ['security-group', 'security-groups-normalized-cidr']
@decorators.idempotent_id('f87bb108-205c-4f06-a378-81a26f71b829')
def test_normalized_cidr_in_rule(self):
security_group = self.create_security_group()
rule = self.create_security_group_rule(
security_group=security_group,
direction=constants.INGRESS_DIRECTION,
remote_ip_prefix='10.0.0.34/24')
self.assertEqual('10.0.0.0/24', rule['normalized_cidr'])
self.assertEqual('10.0.0.34/24', rule['remote_ip_prefix'])
rule = self.create_security_group_rule(
security_group=security_group,
remote_group_id=security_group['id'],
direction=constants.INGRESS_DIRECTION)
self.assertIsNone(rule['normalized_cidr'])
self.assertIsNone(rule['remote_ip_prefix'])

View File

@ -115,6 +115,7 @@
- router_availability_zone
- security-group
- security-groups-default-rules
- security-groups-normalized-cidr
- security-groups-remote-address-group
- segment
- service-type