Add ALPN support to load balancer listener

This adds property 'alpn_protocols' to load balancer listeners.

Depends-On: https://review.opendev.org/#/c/744520/
Change-Id: I310131afb477d7c33d18963555cc44730f510c1b
This commit is contained in:
Carlos Goncalves 2020-08-18 18:59:26 +02:00
parent e29794be55
commit b7f1911d75
3 changed files with 12 additions and 2 deletions

View File

@ -32,13 +32,16 @@ class Listener(resource.Resource, resource.TagMixin):
'sni_container_refs', 'insert_headers', 'load_balancer_id', 'sni_container_refs', 'insert_headers', 'load_balancer_id',
'timeout_client_data', 'timeout_member_connect', 'timeout_client_data', 'timeout_member_connect',
'timeout_member_data', 'timeout_tcp_inspect', 'allowed_cidrs', 'timeout_member_data', 'timeout_tcp_inspect', 'allowed_cidrs',
'tls_ciphers', 'tls_versions', is_admin_state_up='admin_state_up', 'tls_ciphers', 'tls_versions', 'alpn_protocols',
is_admin_state_up='admin_state_up',
**resource.TagMixin._tag_query_parameters **resource.TagMixin._tag_query_parameters
) )
# Properties # Properties
#: List of IPv4 or IPv6 CIDRs. #: List of IPv4 or IPv6 CIDRs.
allowed_cidrs = resource.Body('allowed_cidrs', type=list) allowed_cidrs = resource.Body('allowed_cidrs', type=list)
#: List of ALPN protocols.
alpn_protocols = resource.Body('alpn_protocols', type=list)
#: The maximum number of connections permitted for this load balancer. #: The maximum number of connections permitted for this load balancer.
#: Default is infinite. #: Default is infinite.
connection_limit = resource.Body('connection_limit') connection_limit = resource.Body('connection_limit')

View File

@ -42,7 +42,8 @@ EXAMPLE = {
'timeout_member_data': 50000, 'timeout_member_data': 50000,
'timeout_tcp_inspect': 0, 'timeout_tcp_inspect': 0,
'tls_ciphers': 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256', 'tls_ciphers': 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256',
'tls_versions': ['TLSv1.1', 'TLSv1.2'] 'tls_versions': ['TLSv1.1', 'TLSv1.2'],
'alpn_protocols': ['h2', 'http/1.1', 'http/1.0']
} }
EXAMPLE_STATS = { EXAMPLE_STATS = {
@ -109,6 +110,8 @@ class TestListener(base.TestCase):
test_listener.tls_ciphers) test_listener.tls_ciphers)
self.assertEqual(EXAMPLE['tls_versions'], self.assertEqual(EXAMPLE['tls_versions'],
test_listener.tls_versions) test_listener.tls_versions)
self.assertEqual(EXAMPLE['alpn_protocols'],
test_listener.alpn_protocols)
self.assertDictEqual( self.assertDictEqual(
{'limit': 'limit', {'limit': 'limit',
@ -141,6 +144,7 @@ class TestListener(base.TestCase):
'timeout_tcp_inspect': 'timeout_tcp_inspect', 'timeout_tcp_inspect': 'timeout_tcp_inspect',
'tls_ciphers': 'tls_ciphers', 'tls_ciphers': 'tls_ciphers',
'tls_versions': 'tls_versions', 'tls_versions': 'tls_versions',
'alpn_protocols': 'alpn_protocols',
}, },
test_listener._query_mapping._mapping) test_listener._query_mapping._mapping)

View File

@ -0,0 +1,3 @@
---
features:
- Adds ALPN protocols support for the Octavia (load_balancer) listeners.