From b7f1911d75ee3eeaba23fdb30d3bc169e5ad160e Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Tue, 18 Aug 2020 18:59:26 +0200 Subject: [PATCH] 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 --- openstack/load_balancer/v2/listener.py | 5 ++++- openstack/tests/unit/load_balancer/test_listener.py | 6 +++++- ...d-balancer-listener-alpn-protocols-ded816c78bf2080c.yaml | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/add-load-balancer-listener-alpn-protocols-ded816c78bf2080c.yaml diff --git a/openstack/load_balancer/v2/listener.py b/openstack/load_balancer/v2/listener.py index d8b50f0aa..c59e28c92 100644 --- a/openstack/load_balancer/v2/listener.py +++ b/openstack/load_balancer/v2/listener.py @@ -32,13 +32,16 @@ class Listener(resource.Resource, resource.TagMixin): 'sni_container_refs', 'insert_headers', 'load_balancer_id', 'timeout_client_data', 'timeout_member_connect', '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 ) # Properties #: List of IPv4 or IPv6 CIDRs. 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. #: 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 fe97597a7..3d70ac9cd 100644 --- a/openstack/tests/unit/load_balancer/test_listener.py +++ b/openstack/tests/unit/load_balancer/test_listener.py @@ -42,7 +42,8 @@ EXAMPLE = { 'timeout_member_data': 50000, 'timeout_tcp_inspect': 0, '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 = { @@ -109,6 +110,8 @@ class TestListener(base.TestCase): test_listener.tls_ciphers) self.assertEqual(EXAMPLE['tls_versions'], test_listener.tls_versions) + self.assertEqual(EXAMPLE['alpn_protocols'], + test_listener.alpn_protocols) self.assertDictEqual( {'limit': 'limit', @@ -141,6 +144,7 @@ class TestListener(base.TestCase): 'timeout_tcp_inspect': 'timeout_tcp_inspect', 'tls_ciphers': 'tls_ciphers', 'tls_versions': 'tls_versions', + 'alpn_protocols': 'alpn_protocols', }, test_listener._query_mapping._mapping) diff --git a/releasenotes/notes/add-load-balancer-listener-alpn-protocols-ded816c78bf2080c.yaml b/releasenotes/notes/add-load-balancer-listener-alpn-protocols-ded816c78bf2080c.yaml new file mode 100644 index 000000000..685c5695b --- /dev/null +++ b/releasenotes/notes/add-load-balancer-listener-alpn-protocols-ded816c78bf2080c.yaml @@ -0,0 +1,3 @@ +--- +features: + - Adds ALPN protocols support for the Octavia (load_balancer) listeners.