Add allowed_cidrs param to load balancer listener

Parameter allowed_cidrs was added in Octavia API v2.12 (included in
Train release).

Change-Id: I043efce748d48bd1743ed3706cabda5e51494cfe
This commit is contained in:
Carlos Goncalves 2020-01-17 10:01:01 +01:00
parent 6db3ac2674
commit fcdb2924d4
3 changed files with 9 additions and 1 deletions

View File

@ -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')

View File

@ -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',

View File

@ -0,0 +1,3 @@
---
features:
- Added allowed_cidrs parameter into load balancer listener.