diff --git a/openstack/load_balancer/v2/listener.py b/openstack/load_balancer/v2/listener.py index 894a93523..88ccfef74 100644 --- a/openstack/load_balancer/v2/listener.py +++ b/openstack/load_balancer/v2/listener.py @@ -31,12 +31,14 @@ class Listener(resource.Resource, resource.TagMixin): 'created_at', 'updated_at', 'provisioning_status', 'operating_status', 'sni_container_refs', 'insert_headers', 'load_balancer_id', 'timeout_client_data', 'timeout_member_connect', - 'timeout_member_data', 'timeout_tcp_inspect', + 'timeout_member_data', 'timeout_tcp_inspect', 'allowed_cidrs', is_admin_state_up='admin_state_up', **resource.TagMixin._tag_query_parameters ) # Properties + #: List of IPv4 or IPv6 CIDRs. + allowed_cidrs = resource.Body('allowed_cidrs', type=list) #: The maximum number of connections permitted for this load balancer. #: Default is infinite. connection_limit = resource.Body('connection_limit') diff --git a/openstack/tests/unit/load_balancer/test_listener.py b/openstack/tests/unit/load_balancer/test_listener.py index a0b254116..299e61e94 100644 --- a/openstack/tests/unit/load_balancer/test_listener.py +++ b/openstack/tests/unit/load_balancer/test_listener.py @@ -18,6 +18,7 @@ from openstack.load_balancer.v2 import listener IDENTIFIER = 'IDENTIFIER' EXAMPLE = { 'admin_state_up': True, + 'allowed_cidrs': ['192.168.1.0/24'], 'connection_limit': '2', 'default_pool_id': uuid.uuid4(), 'description': 'test description', @@ -67,6 +68,7 @@ class TestListener(base.TestCase): def test_make_it(self): test_listener = listener.Listener(**EXAMPLE) self.assertTrue(test_listener.is_admin_state_up) + self.assertEqual(EXAMPLE['allowed_cidrs'], test_listener.allowed_cidrs) self.assertEqual(EXAMPLE['connection_limit'], test_listener.connection_limit) self.assertEqual(EXAMPLE['default_pool_id'], @@ -118,6 +120,7 @@ class TestListener(base.TestCase): 'provisioning_status': 'provisioning_status', 'is_admin_state_up': 'admin_state_up', + 'allowed_cidrs': 'allowed_cidrs', 'connection_limit': 'connection_limit', 'default_pool_id': 'default_pool_id', 'default_tls_container_ref': 'default_tls_container_ref', diff --git a/releasenotes/notes/add-support-allowed-cidrs-loadbalancer-listener-809e523a8bd6a7d5.yaml b/releasenotes/notes/add-support-allowed-cidrs-loadbalancer-listener-809e523a8bd6a7d5.yaml new file mode 100644 index 000000000..3d47aa397 --- /dev/null +++ b/releasenotes/notes/add-support-allowed-cidrs-loadbalancer-listener-809e523a8bd6a7d5.yaml @@ -0,0 +1,3 @@ +--- +features: + - Added allowed_cidrs parameter into load balancer listener.