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>
(cherry picked from commit bf44e70db6)
This commit is contained in:
Lucas Alvares Gomes 2022-11-16 14:07:00 +00:00
parent 90865c06af
commit 1e6ff935d8
3 changed files with 20 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

@ -108,6 +108,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',
@ -158,6 +159,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'},
@ -174,6 +176,7 @@ SUPPORTED_DHCP_OPTS_MAPPING = {
# OVN string type DHCP options
OVN_STR_TYPE_DHCP_OPTS = [
'domain_name',
'domain_search_list',
'bootfile_name',
'path_prefix',
'wpad',

View File

@ -19,6 +19,7 @@ from unittest import mock
import fixtures
from neutron_lib.api.definitions import extra_dhcp_opt as edo_ext
from neutron_lib.api.definitions import portbindings
from neutron_lib import constants as n_const
from oslo_config import cfg
@ -319,6 +320,20 @@ class TestDHCPUtils(base.BaseTestCase):
'bootfile_name': '"homer_simpson.bin"'}
self.assertEqual(expected_options, 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):