From c9079f15231e25f4ea6b0056fbf88727737695db Mon Sep 17 00:00:00 2001 From: Anna Khmelnitsky Date: Wed, 1 May 2019 16:37:53 -0700 Subject: [PATCH] NSX|P: Cleanup partial update workaround Partial update is fully handled in nsxlib, so workarounds in plugin can be deleted. Change-Id: I523a9bfa13117186879ab36473b497945f203973 --- vmware_nsx/plugins/nsx_p/plugin.py | 14 +------------- vmware_nsx/tests/unit/nsx_p/test_plugin.py | 3 +-- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/vmware_nsx/plugins/nsx_p/plugin.py b/vmware_nsx/plugins/nsx_p/plugin.py index 6399b17ff1..76744ca63b 100644 --- a/vmware_nsx/plugins/nsx_p/plugin.py +++ b/vmware_nsx/plugins/nsx_p/plugin.py @@ -1506,8 +1506,6 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base): new_enable_snat = router.enable_snat newaddr, newmask, _newnexthop = self._get_external_attachment_info( context, router) - router_name = utils.get_name_and_uuid(router['name'] or 'router', - router['id']) router_subnets = self._find_router_subnets( context.elevated(), router_id) sr_currently_exists = self.verify_sr_at_backend(router_id) @@ -1531,10 +1529,7 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base): if (actions['remove_router_link_port'] or actions['add_router_link_port']): # GW was changed - #TODO(asarfaty): adding the router name even though it was not - # changed because otherwise the NSX will set it to default. - # This code should be removed once NSX supports it. - self.nsxpolicy.tier1.update(router_id, name=router_name, + self.nsxpolicy.tier1.update(router_id, tier0=new_tier0_uuid) # Set/Unset the router TZ to allow vlan switches traffic @@ -1804,12 +1799,6 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base): subnet = self.get_subnet(context, info['subnet_ids'][0]) if overlay_net: # overlay interface - #TODO(asarfaty): adding the segment name even though it was not - # changed because otherwise the NSX will set it to default. - # This code should be removed once NSX supports it. - net = self._get_network(context, network_id) - net_name = utils.get_name_and_uuid( - net['name'] or 'network', network_id) pol_subnets = [] for rtr_subnet in subnets: # For dual stack, we allow one v4 and one v6 @@ -1821,7 +1810,6 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base): policy_defs.Subnet(gateway_address=gw_addr)) self.nsxpolicy.segment.update(segment_id, - name=net_name, tier1_id=router_id, subnets=pol_subnets) diff --git a/vmware_nsx/tests/unit/nsx_p/test_plugin.py b/vmware_nsx/tests/unit/nsx_p/test_plugin.py index 89003121e1..ecb41360d9 100644 --- a/vmware_nsx/tests/unit/nsx_p/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_p/test_plugin.py @@ -1647,14 +1647,13 @@ class NsxPTestL3NatTestCase(NsxPTestL3NatTest, # We expect two subnet objects on segment seg_update.assert_called_with( n['network']['id'], - name=mock.ANY, subnets=[mock.ANY, mock.ANY], tier1_id=r['router']['id']) def test_router_add_v4_v6_subnets(self): self._test_router_add_dual_stack_subnets() - def test_router_add_v6_4_subnets(self): + def test_router_add_v6_v4_subnets(self): self._test_router_add_dual_stack_subnets(s6_first=True) def test_router_remove_dual_stack_subnets(self):