def _test_ext_gw_updated_dvr_agent_mode(self, host, agent_mode, expected_call_count):
    router = l3_test_common.prepare_router_data(num_internal_ports=2)
    agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
    self._set_ri_kwargs(agent, router['id'], router)
    ri = dvr_router.DvrLocalRouter(HOSTNAME, **self.ri_kwargs)
    (interface_name, ex_gw_port) = l3_test_common.prepare_ext_gw_test(self, ri)
    ri._external_gateway_added = mock.Mock()
    router['gw_port_host'] = host
    agent.conf.agent_mode = agent_mode
    ri.external_gateway_updated(ex_gw_port, interface_name)
    self.assertEqual(expected_call_count, ri._external_gateway_added.call_count)
def _test_ext_gw_updated_dvr_agent_mode(self, host, agent_mode, expected_call_count):
    router = l3_test_common.prepare_router_data(num_internal_ports=2)
    agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
    self._set_ri_kwargs(agent, router['id'], router)
    ri = dvr_router.DvrLocalRouter(HOSTNAME, **self.ri_kwargs)
    (interface_name, ex_gw_port) = l3_test_common.prepare_ext_gw_test(self, ri)
    ri._external_gateway_added = mock.Mock()
    router['gw_port_host'] = host
    agent.conf.agent_mode = agent_mode
    ri.external_gateway_updated(ex_gw_port, interface_name)
    self.assertEqual(expected_call_count, ri._external_gateway_added.call_count)