Browse Source

Add alpn_protocols to the listener data model

Change-Id: Iea9fdbfaee7c7965adcc65825fe6422f87b06de0
changes/19/744519/4
Carlos Goncalves 11 months ago
parent
commit
b262fc9ad3
4 changed files with 25 additions and 3 deletions
  1. +3
    -1
      octavia_lib/api/drivers/data_models.py
  2. +6
    -0
      octavia_lib/common/constants.py
  3. +9
    -2
      octavia_lib/tests/unit/api/drivers/test_data_models.py
  4. +7
    -0
      releasenotes/notes/add-listener-alpn-protocols-ecb49db86b956c71.yaml

+ 3
- 1
octavia_lib/api/drivers/data_models.py View File

@ -133,7 +133,8 @@ class Listener(BaseDataModel):
client_ca_tls_container_data=Unset,
client_authentication=Unset, client_crl_container_ref=Unset,
client_crl_container_data=Unset, project_id=Unset,
allowed_cidrs=Unset, tls_versions=Unset, tls_ciphers=Unset):
allowed_cidrs=Unset, tls_versions=Unset, tls_ciphers=Unset,
alpn_protocols=Unset):
self.admin_state_up = admin_state_up
self.connection_limit = connection_limit
@ -164,6 +165,7 @@ class Listener(BaseDataModel):
self.allowed_cidrs = allowed_cidrs
self.tls_versions = tls_versions
self.tls_ciphers = tls_ciphers
self.alpn_protocols = alpn_protocols
class Pool(BaseDataModel):


+ 6
- 0
octavia_lib/common/constants.py View File

@ -147,6 +147,11 @@ LISTENER_SUPPORTED_PROTOCOLS = (PROTOCOL_TCP, PROTOCOL_HTTPS, PROTOCOL_HTTP,
POOL_SUPPORTED_PROTOCOLS = (PROTOCOL_TCP, PROTOCOL_HTTP, PROTOCOL_HTTPS,
PROTOCOL_PROXY, PROTOCOL_UDP, PROTOCOL_SCTP)
ALPN_PROTOCOL_HTTP_1_0 = "http/1.0"
ALPN_PROTOCOL_HTTP_1_1 = "http/1.1"
ALPN_PROTOCOL_HTTP_2 = "h2"
PROVISIONING_STATUS = 'provisioning_status'
# Amphora has been allocated to a load balancer
AMPHORA_ALLOCATED = 'ALLOCATED'
@ -195,6 +200,7 @@ ADDITIONAL_VIPS = 'additional_vips'
ADDRESS = 'address'
ADMIN_STATE_UP = 'admin_state_up'
ALLOWED_CIDRS = 'allowed_cidrs'
ALPN_PROTOCOLS = 'alpn_protocols'
AVAILABILITY_ZONE = 'availability_zone'
BACKUP = 'backup'
CA_TLS_CONTAINER_DATA = 'ca_tls_container_data'


+ 9
- 2
octavia_lib/tests/unit/api/drivers/test_data_models.py View File

@ -107,7 +107,10 @@ class TestProviderDataModels(base.TestCase):
constants.TLS_VERSION_1_1,
constants.TLS_VERSION_1_2,
constants.TLS_VERSION_1_3],
tls_ciphers=None)
tls_ciphers=None,
alpn_protocols=[constants.ALPN_PROTOCOL_HTTP_1_0,
constants.ALPN_PROTOCOL_HTTP_1_1,
constants.ALPN_PROTOCOL_HTTP_2])
self.ref_lb = data_models.LoadBalancer(
admin_state_up=False,
@ -253,7 +256,10 @@ class TestProviderDataModels(base.TestCase):
constants.TLS_VERSION_1_1,
constants.TLS_VERSION_1_2,
constants.TLS_VERSION_1_3],
'tls_ciphers': None}
'tls_ciphers': None,
'alpn_protocols': [constants.ALPN_PROTOCOL_HTTP_1_0,
constants.ALPN_PROTOCOL_HTTP_1_1,
constants.ALPN_PROTOCOL_HTTP_2]}
self.ref_lb_dict_with_listener = {
'admin_state_up': False,
@ -367,6 +373,7 @@ class TestProviderDataModels(base.TestCase):
ref_list_dict.pop('sni_container_data', None)
ref_list_dict.pop('sni_container_refs', None)
ref_list_dict.pop('tls_versions', None)
ref_list_dict.pop('alpn_protocols', None)
ref_pool_dict = deepcopy(self.ref_pool_dict)
ref_pool_dict['healthmonitor'] = None
ref_pool_dict.pop('members', None)


+ 7
- 0
releasenotes/notes/add-listener-alpn-protocols-ecb49db86b956c71.yaml View File

@ -0,0 +1,7 @@
---
features:
- |
Added parameter ``alpn_protocols`` to listeners. This parameter contains
the list of protocols supported by listeners, in descending order of
preference. The supported protocols are ``http/1.0``, ``http/1.1``
and ``h2``.

Loading…
Cancel
Save