@mock.patch.object(ip_lib, 'add_ip_rule')
def test_floating_ip_moved_dist(self, mock_add_ip_rule):
    router = mock.MagicMock()
    ri = self._create_router(router)
    floating_ip_address = '0.0.0.0'
    fixed_ip = '192.168.0.1'
    fip = {'floating_ip_address': floating_ip_address, 'fixed_ip_address': fixed_ip}
    ri.floating_ips_dict['0.0.0.0'] = (fixed_ip, FIP_PRI)
    ri.fip_ns = mock.Mock()
    ri.fip_ns.allocate_rule_priority.return_value = FIP_PRI
    ri.floating_ip_moved_dist(fip)
    self.mock_delete_ip_rule.assert_called_once_with(ri.router_namespace.name, ip=fixed_ip, table=16, priority=FIP_PRI)
    ri.fip_ns.deallocate_rule_priority.assert_called_once_with(floating_ip_address)
    ri.fip_ns.allocate_rule_priority.assert_called_once_with(floating_ip_address)
    mock_add_ip_rule.assert_called_with(namespace=ri.router_namespace.name, ip=fixed_ip, table=16, priority=FIP_PRI)
@mock.patch.object(ip_lib, 'add_ip_rule')
def test_floating_ip_moved_dist(self, mock_add_ip_rule):
    router = mock.MagicMock()
    ri = self._create_router(router)
    floating_ip_address = '0.0.0.0'
    fixed_ip = '192.168.0.1'
    fip = {'floating_ip_address': floating_ip_address, 'fixed_ip_address': fixed_ip}
    ri.floating_ips_dict['0.0.0.0'] = (fixed_ip, FIP_PRI)
    ri.fip_ns = mock.Mock()
    ri.fip_ns.allocate_rule_priority.return_value = FIP_PRI
    ri.floating_ip_moved_dist(fip)
    self.mock_delete_ip_rule.assert_called_once_with(ri.router_namespace.name, ip=fixed_ip, table=16, priority=FIP_PRI)
    ri.fip_ns.deallocate_rule_priority.assert_called_once_with(floating_ip_address)
    ri.fip_ns.allocate_rule_priority.assert_called_once_with(floating_ip_address)
    mock_add_ip_rule.assert_called_with(namespace=ri.router_namespace.name, ip=fixed_ip, table=16, priority=FIP_PRI)