Merge "NSX|P: Cleanup partial update workaround"

This commit is contained in:
Zuul 2019-05-12 09:46:45 +00:00 committed by Gerrit Code Review
commit ab3fd27f15
2 changed files with 2 additions and 15 deletions

View File

@ -1537,8 +1537,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)
@ -1562,10 +1560,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
@ -1834,12 +1829,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
@ -1851,7 +1840,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)

View File

@ -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):