'Associates a floating IP with a fixed IP.
Ensures floating IP is allocated to the project in context.
Does not verify ownership of the fixed IP. Caller is assumed to have
checked that the instance is properly owned.'

@base_api.refresh_cache
def associate_floating_ip(self, context, instance, floating_address, fixed_address, affect_auto_assigned=False):

    orig_instance_uuid = self.floating_manager.associate_floating_ip(context, floating_address, fixed_address, affect_auto_assigned)
    if orig_instance_uuid:
        msg_dict = dict(address=floating_address, instance_id=orig_instance_uuid)
        LOG.info(_LI('re-assign    floating    IP    %(address)s    from    instance    %(instance_id)s'), msg_dict)
        orig_instance = objects.Instance.get_by_uuid(context, orig_instance_uuid, expected_attrs=['flavor'])
        base_api.update_instance_cache_with_nw_info(self, context, orig_instance)
