@mock.patch.object(dvr_edge_rtr.DvrEdgeRouter, 'remove_centralized_floatingip')
def test_remove_centralized_floatingip(self, super_remove_centralized_floatingip):
    agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
    agent.conf.agent_mode = lib_constants.L3_AGENT_MODE_DVR_SNAT
    router = l3_test_common.prepare_router_data(num_internal_ports=2)
    router['gw_port_host'] = HOSTNAME
    self.mock_driver.unplug.reset_mock()
    self._set_ri_kwargs(agent, router['id'], router)
    fip_cidr = '11.22.33.44/24'
    ri = dvr_edge_ha_rtr.DvrEdgeHaRouter(HOSTNAME, [], **self.ri_kwargs)
    ri.is_router_master = mock.Mock(return_value=False)
    ri._remove_vip = mock.Mock()
    ri.remove_centralized_floatingip(fip_cidr)
    ri._remove_vip.assert_called_once_with(fip_cidr)
    super_remove_centralized_floatingip.assert_not_called()
    ri1 = dvr_edge_ha_rtr.DvrEdgeHaRouter(HOSTNAME, [], **self.ri_kwargs)
    ri1.is_router_master = mock.Mock(return_value=True)
    ri1._remove_vip = mock.Mock()
    ri1.remove_centralized_floatingip(fip_cidr)
    ri1._remove_vip.assert_called_once_with(fip_cidr)
    super_remove_centralized_floatingip.assert_called_once_with(fip_cidr)
@mock.patch.object(dvr_edge_rtr.DvrEdgeRouter, 'remove_centralized_floatingip')
def test_remove_centralized_floatingip(self, super_remove_centralized_floatingip):
    agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
    agent.conf.agent_mode = lib_constants.L3_AGENT_MODE_DVR_SNAT
    router = l3_test_common.prepare_router_data(num_internal_ports=2)
    router['gw_port_host'] = HOSTNAME
    self.mock_driver.unplug.reset_mock()
    self._set_ri_kwargs(agent, router['id'], router)
    fip_cidr = '11.22.33.44/24'
    ri = dvr_edge_ha_rtr.DvrEdgeHaRouter(HOSTNAME, [], **self.ri_kwargs)
    ri.is_router_master = mock.Mock(return_value=False)
    ri._remove_vip = mock.Mock()
    ri.remove_centralized_floatingip(fip_cidr)
    ri._remove_vip.assert_called_once_with(fip_cidr)
    super_remove_centralized_floatingip.assert_not_called()
    ri1 = dvr_edge_ha_rtr.DvrEdgeHaRouter(HOSTNAME, [], **self.ri_kwargs)
    ri1.is_router_master = mock.Mock(return_value=True)
    ri1._remove_vip = mock.Mock()
    ri1.remove_centralized_floatingip(fip_cidr)
    ri1._remove_vip.assert_called_once_with(fip_cidr)
    super_remove_centralized_floatingip.assert_called_once_with(fip_cidr)