diff options
author | Lucas Alvares Gomes <lucasagomes@gmail.com> | 2022-11-16 14:07:00 +0000 |
---|---|---|
committer | Lucas Alvares Gomes <lucasagomes@gmail.com> | 2022-11-18 11:54:51 +0000 |
commit | 1e6ff935d8130d7d1336c58713ce2258602cdd1e (patch) | |
tree | 11b8c46b3c61f9fd8282dd45cd6c05e081799ef5 | |
parent | 90865c06afe9780ac3116be9e527da9a75944c96 (diff) | |
download | neutron-1e6ff935d8130d7d1336c58713ce2258602cdd1e.tar.gz |
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 bf44e70db6219e7f3a45bd61b7dd14a31ae33bb0)
-rw-r--r-- | doc/source/ovn/dhcp_opts.rst | 2 | ||||
-rw-r--r-- | neutron/common/ovn/constants.py | 3 | ||||
-rw-r--r-- | neutron/tests/unit/common/ovn/test_utils.py | 15 |
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 283765d302..4c8405b4c4 100644 --- a/neutron/common/ovn/constants.py +++ b/neutron/common/ovn/constants.py @@ -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', diff --git a/neutron/tests/unit/common/ovn/test_utils.py b/neutron/tests/unit/common/ovn/test_utils.py index c3df305045..6e3537897c 100644 --- a/neutron/tests/unit/common/ovn/test_utils.py +++ b/neutron/tests/unit/common/ovn/test_utils.py @@ -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): |