From b754e5ffd51fda686cdef08fe96516241dcfdfd6 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Sun, 21 May 2017 09:36:11 +0300 Subject: [PATCH] NSX|V: Support tftp-server dhcp option The DHCP option tftp-server-name is referred to upstream as tftp-server. This patch supports both names as the same backend option. Change-Id: Ied936532eafadcd11cb83c51d456509f9d5eedd6 --- vmware_nsx/plugins/nsx_v/vshield/common/constants.py | 1 + vmware_nsx/plugins/nsx_v/vshield/edge_utils.py | 3 ++- vmware_nsx/tests/unit/nsx_v/test_plugin.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/vshield/common/constants.py b/vmware_nsx/plugins/nsx_v/vshield/common/constants.py index a4faf564cd..449ff4fd66 100644 --- a/vmware_nsx/plugins/nsx_v/vshield/common/constants.py +++ b/vmware_nsx/plugins/nsx_v/vshield/common/constants.py @@ -78,6 +78,7 @@ SUPPORTED_DHCP_OPTIONS = { 'bootfile-name': 'option67', 'classless-static-route': 'option121', 'tftp-server-address': 'option150', + 'tftp-server': 'option150', } diff --git a/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py b/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py index 111ec703d1..bb7359008a 100644 --- a/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py +++ b/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py @@ -942,7 +942,8 @@ class EdgeManager(object): net, ip = opt_val.split(',') opt121['staticRoutes'].append({'destinationSubnet': net, 'router': ip}) - elif opt_name == 'tftp-server-address': + elif (opt_name == 'tftp-server-address' or + opt_name == 'tftp-server'): if 'option150' not in static_config['dhcpOptions']: static_config['dhcpOptions']['option150'] = { 'tftpServers': []} diff --git a/vmware_nsx/tests/unit/nsx_v/test_plugin.py b/vmware_nsx/tests/unit/nsx_v/test_plugin.py index 92f361c3a1..8daed785b2 100644 --- a/vmware_nsx/tests/unit/nsx_v/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v/test_plugin.py @@ -5506,7 +5506,7 @@ class DHCPOptsTestCase(test_dhcpopts.TestExtraDhcpOpt, def test_update_port_with_blank_string_extradhcpopt(self): opt_list = [{'opt_name': 'bootfile-name', 'opt_value': 'pxelinux.0'}, - {'opt_name': 'tftp-server-address', + {'opt_name': 'tftp-server', 'opt_value': '123.123.123.123'}] upd_opts = [{'opt_name': 'bootfile-name', 'opt_value': ' '}]