'Bulk create floating IPs.'

@wsgi.Controller.api_version('2.1', MAX_PROXY_API_SUPPORT_VERSION)
@extensions.expected_errors((400, 409))
@validation.schema(floating_ips_bulk.create)
def create(self, req, body):

    context = req.environ['nova.context']
    context.can(fib_policies.BASE_POLICY_NAME)
    params = body['floating_ips_bulk_create']
    ip_range = params['ip_range']
    pool = params.get('pool', CONF.default_floating_pool)
    interface = params.get('interface', CONF.public_interface)
    try:
        ips = [objects.FloatingIPList.make_ip_info(addr, pool, interface) for addr in self._address_to_hosts(ip_range)]
    except exception.InvalidInput as exc:
        raise webob.exc.HTTPBadRequest(explanation=exc.format_message())
    try:
        objects.FloatingIPList.create(context, ips)
    except exception.FloatingIpExists as exc:
        raise webob.exc.HTTPConflict(explanation=exc.format_message())
    return {'floating_ips_bulk_create': {'ip_range': ip_range, 'pool': pool, 'interface': interface}}
