summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-11-25 11:29:21 +0000
committerGerrit Code Review <review@openstack.org>2022-11-25 11:29:21 +0000
commit6bdf44266a1760de0d995ab5b2e2c83ad6902a68 (patch)
tree9617fa021b2fd4d4815f35b754f4556d400cb150
parent4da5638baea22db869c2ef8e1bf5bfc40cdbfdfc (diff)
parent4c124667c41727e5dd3af9026c27d5a8905c49b7 (diff)
downloadneutron-6bdf44266a1760de0d995ab5b2e2c83ad6902a68.tar.gz
Merge "OVN: Add support for DHCP option "domain-search" for IPv4" into stable/ussuri
-rw-r--r--doc/source/ovn/dhcp_opts.rst2
-rw-r--r--neutron/common/ovn/constants.py3
-rw-r--r--neutron/tests/unit/common/ovn/test_utils.py15
3 files changed, 20 insertions, 0 deletions
diff --git a/doc/source/ovn/dhcp_opts.rst b/doc/source/ovn/dhcp_opts.rst
index d4bd459a16..f85a560c4f 100644
--- a/doc/source/ovn/dhcp_opts.rst
+++ b/doc/source/ovn/dhcp_opts.rst
@@ -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
diff --git a/neutron/common/ovn/constants.py b/neutron/common/ovn/constants.py
index 4597848802..502ac239e7 100644
--- a/neutron/common/ovn/constants.py
+++ b/neutron/common/ovn/constants.py
@@ -109,6 +109,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',
@@ -159,6 +160,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'},
@@ -175,6 +177,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',
diff --git a/neutron/tests/unit/common/ovn/test_utils.py b/neutron/tests/unit/common/ovn/test_utils.py
index 3bb3b46f17..2d327b1703 100644
--- a/neutron/tests/unit/common/ovn/test_utils.py
+++ b/neutron/tests/unit/common/ovn/test_utils.py
@@ -18,6 +18,7 @@ from os import path
import fixtures
import mock
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
@@ -273,6 +274,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):