OVN: Add support for DHCP option "domain-search" for IPv4

Nothing much else, what the title says...

Change-Id: Ib1d41a6e4c869e108f31c1eb604f22c794d66467
Closes-Bug: #1996759
Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
This commit is contained in:
Lucas Alvares Gomes 2022-11-16 14:07:00 +00:00
parent a358bb802b
commit bf44e70db6
3 changed files with 19 additions and 0 deletions

View File

@ -17,6 +17,7 @@ classless-static-route classless_static_route
default-ttl default_ttl
dns-server dns_server
domain-name domain_name
domain-search domain_search_list
ethernet-encap ethernet_encap
ip-forward-enable ip_forward_enable
lease-time lease_time
@ -67,6 +68,7 @@ wpad wpad
59 T2
66 tftp_server
67 bootfile_name
119 domain_search_list
121 classless_static_route
150 tftp_server_address
210 path_prefix

View File

@ -113,6 +113,7 @@ SUPPORTED_DHCP_OPTS_MAPPING = {
'log-server': 'log_server',
'lpr-server': 'lpr_server',
'domain-name': 'domain_name',
'domain-search': 'domain_search_list',
'swap-server': 'swap_server',
'policy-filter': 'policy_filter',
'router-solicitation': 'router_solicitation',
@ -164,6 +165,7 @@ SUPPORTED_DHCP_OPTS_MAPPING = {
'58': 'T1',
'59': 'T2',
'67': 'bootfile_name',
'119': 'domain_search_list',
'252': 'wpad',
'210': 'path_prefix',
'150': 'tftp_server_address'},
@ -189,6 +191,7 @@ SUPPORTED_BM_DHCP_OPTS_MAPPING[4].update({
# OVN string type DHCP options
OVN_STR_TYPE_DHCP_OPTS = [
'domain_name',
'domain_search_list',
'bootfile_name',
'bootfile_name_alt',
'path_prefix',

View File

@ -432,6 +432,20 @@ class TestDHCPUtils(base.BaseTestCase):
# Assert no options were passed
self.assertEqual({}, options)
def test_get_lsp_dhcp_opts_for_domain_search(self):
opt = {'opt_name': 'domain-search',
'opt_value': 'openstack.org,ovn.org',
'ip_version': 4}
port = {portbindings.VNIC_TYPE: portbindings.VNIC_NORMAL,
edo_ext.EXTRADHCPOPTS: [opt]}
dhcp_disabled, options = utils.get_lsp_dhcp_opts(port, 4)
self.assertFalse(dhcp_disabled)
# Assert option got translated to "domain_search_list" and
# the value is a string (double-quoted)
expected_options = {'domain_search_list': '"openstack.org,ovn.org"'}
self.assertEqual(expected_options, options)
class TestGetDhcpDnsServers(base.BaseTestCase):