'Add a floating IP to a project from a pool.'

def allocate_floating_ip(self, context, pool=None):

    client = get_client(context)
    pool = (pool or self._get_default_floating_ip_pool_name())
    pool_id = self._get_floating_ip_pool_id_by_name_or_id(client, pool)
    param = {'floatingip': {'floating_network_id': pool_id}}
    try:
        fip = client.create_floatingip(param)
    except (neutron_client_exc.IpAddressGenerationFailureClient, neutron_client_exc.ExternalIpAddressExhaustedClient) as e:
        raise exception.NoMoreFloatingIps(six.text_type(e))
    except neutron_client_exc.OverQuotaClient as e:
        raise exception.FloatingIpLimitExceeded(six.text_type(e))
    except neutron_client_exc.BadRequest as e:
        raise exception.FloatingIpBadRequest(six.text_type(e))
    return fip['floatingip']['floating_ip_address']
