[NSX-p] Check for a LB before enabling/disabling service router

Change-Id: I7db94c9290dd4c7876f008f7cd82c66cbcd39d63
This commit is contained in:
Salvatore Orlando 2019-06-19 14:13:05 -07:00 committed by Adit Sarfaty
parent 732ba2a2c8
commit cff03595a1
3 changed files with 8 additions and 1 deletions

View File

@ -1563,8 +1563,9 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
router_subnets = self._find_router_subnets(
context.elevated(), router_id)
sr_currently_exists = self.verify_sr_at_backend(router_id)
lb_exist = False
lb_exist = self.service_router_has_loadbalancers(context, router_id)
fw_exist = self._router_has_edge_fw_rules(context, router)
# TODO(asarfaty): Add vpnaas check here
actions = self._get_update_router_gw_actions(
org_tier0_uuid, orgaddr, org_enable_snat,
new_tier0_uuid, newaddr, new_enable_snat,

View File

@ -1435,6 +1435,9 @@ class NsxPTestL3NatTestCase(NsxPTestL3NatTest,
def setUp(self, *args, **kwargs):
super(NsxPTestL3NatTestCase, self).setUp(*args, **kwargs)
mock.patch.object(self.plugin.nsxpolicy, 'search_by_tags',
return_value={'results': []}).start()
def test__notify_gateway_port_ip_changed(self):
self.skipTest('not supported')

View File

@ -540,6 +540,9 @@ class TestVpnaasDriver(test_plugin.NsxPPluginTestCaseMixin):
self.policy_vpn = self.plugin.nsxpolicy.ipsec_vpn
self.l3plugin = self.plugin
mock.patch.object(self.plugin.nsxpolicy, 'search_by_tags',
return_value={'results': []}).start()
@contextlib.contextmanager
def router(self, name='vpn-test-router', tenant_id=_uuid(),
admin_state_up=True, **kwargs):