Don't try to store protocol=None in OVSDB

The schema for the 'protocol' column is 0 or 1 strings in the set
('tcp', 'udp', 'sctp'). Empty optional values in OVSDB are
represented by []. Passing None will cause a schema error to be
thrown, so pass [] instead of None when protocol is not set.

Change-Id: Ibde099db717787d7905d7c7850bebda7e9e261a8
Closes-Bug: #1916646
(cherry picked from commit a641c2c395)
This commit is contained in:
Brian Haley 2021-03-04 16:27:06 -05:00
parent e87a553689
commit f4861f9d92
2 changed files with 5 additions and 5 deletions

View File

@ -940,7 +940,7 @@ class OvnProviderHelper(object):
break
# If protocol set make sure its lowercase
protocol = protocol.lower() if protocol else None
protocol = protocol.lower() if protocol else []
# In case port is not found for the vip_address we will see an
# exception when port['id'] is accessed.
external_ids = {

View File

@ -943,7 +943,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
ovn_const.LB_EXT_IDS_VIP_PORT_ID_KEY: mock.ANY,
'enabled': 'False'},
name=mock.ANY,
protocol=None,
protocol=[],
selection_fields=['ip_src', 'ip_dst', 'tp_src', 'tp_dst'])
@mock.patch('ovn_octavia_provider.driver.get_neutron_client')
@ -961,7 +961,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
ovn_const.LB_EXT_IDS_VIP_PORT_ID_KEY: mock.ANY,
'enabled': 'True'},
name=mock.ANY,
protocol=None,
protocol=[],
selection_fields=['ip_src', 'ip_dst', 'tp_src', 'tp_dst'])
@mock.patch('ovn_octavia_provider.driver.get_neutron_client')
@ -981,7 +981,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
ovn_const.LB_EXT_IDS_VIP_PORT_ID_KEY: mock.ANY,
'enabled': 'True'},
name=mock.ANY,
protocol=None)
protocol=[])
@mock.patch('ovn_octavia_provider.driver.get_neutron_client')
def test_lb_create_selection_fields_not_supported_algo(self, net_cli):
@ -1001,7 +1001,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
ovn_const.LB_EXT_IDS_VIP_PORT_ID_KEY: mock.ANY,
'enabled': 'True'},
name=mock.ANY,
protocol=None,
protocol=[],
selection_fields=['ip_src', 'ip_dst', 'tp_src', 'tp_dst'])
@mock.patch('ovn_octavia_provider.driver.get_neutron_client')