NSX|P: Fix router interface removal

With Policy DHCP, subnets should not allways be removed from the
segment.

Change-Id: I80344e506e225b13838bc06999dbc72930414c68
(cherry picked from commit e567073dfb)
This commit is contained in:
asarfaty 2020-04-14 10:36:35 +02:00 committed by Adit Sarfaty
parent f2af846e5a
commit f9ed36ec04
1 changed files with 12 additions and 5 deletions

View File

@ -2716,16 +2716,23 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
seg_subnets = self._get_segment_subnets(
context, network_id, interface_subnets=net_rtr_subnets)
if not net_rtr_subnets:
if not net_rtr_subnets and not seg_subnets:
# Remove the tier1 connectivity of this segment
# This must be done is a separate call as it uses PUT
self.nsxpolicy.segment.remove_connectivity_and_subnets(
segment_id)
else:
#TODO(asarfaty): Try to combine the 2 backend calls
if not net_rtr_subnets:
# Remove connectivity path
# This must be done is a separate call as it uses PUT
self.nsxpolicy.segment.remove_connectivity_path(
segment_id)
# update remaining (DHCP/ipv4/6) subnets
if seg_subnets:
self.nsxpolicy.segment.update(segment_id,
subnets=seg_subnets)
# update remaining (DHCP/ipv4/6) subnets
if seg_subnets:
self.nsxpolicy.segment.update(segment_id,
subnets=seg_subnets)
# will update the router only if needed
self._update_slaac_on_router(context, router_id,