Merge "NSX|P: Fix DHCP server onfig for migrated networks"

This commit is contained in:
Zuul 2020-07-06 14:56:06 +00:00 committed by Gerrit Code Review
commit a486e558c5
2 changed files with 7 additions and 2 deletions

View File

@ -1197,10 +1197,11 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
segment_id = self._get_network_nsx_segment_id(context, net_id)
seg_subnets = self._get_segment_subnets(context, net_id, net_az=az)
dhcp_config = self._get_segment_dhcp_server_config(segment_id, az)
# Update dhcp server config on the segment
self.nsxpolicy.segment.update(
segment_id=segment_id,
dhcp_server_config_id=az._policy_dhcp_server_config,
dhcp_server_config_id=dhcp_config,
subnets=seg_subnets)
def _get_net_dhcp_subnets(self, context, net_id):

View File

@ -1221,6 +1221,8 @@ class NsxPTestSubnets(common_v3.NsxV3TestSubnets,
def test_create_dhcpv6_subnet(self):
with mock.patch("vmware_nsxlib.v3.policy.core_resources."
"NsxPolicySegmentApi.update") as seg_update,\
mock.patch("vmware_nsxlib.v3.policy.core_resources."
"NsxPolicySegmentApi.get", return_value={}),\
self.subnet(ip_version=constants.IP_VERSION_6, cidr='fe80::/64',
enable_dhcp=True) as subnet:
self.assertEqual(True, subnet['subnet']['enable_dhcp'])
@ -1238,7 +1240,9 @@ class NsxPTestSubnets(common_v3.NsxV3TestSubnets,
enable_dhcp=False) as subnet:
data = {'subnet': {'enable_dhcp': True}}
with mock.patch("vmware_nsxlib.v3.policy.core_resources."
"NsxPolicySegmentApi.update") as seg_update:
"NsxPolicySegmentApi.update") as seg_update,\
mock.patch("vmware_nsxlib.v3.policy.core_resources."
"NsxPolicySegmentApi.get", return_value={}):
req = self.new_update_request('subnets', data,
subnet['subnet']['id'])
res = self.deserialize('json', req.get_response(self.api))