def _build_client(token=None):
    'Utility function to create Neutron client.'
    params = {'timeout': CONF.neutron.url_timeout, 'retries': CONF.neutron.retries, 'insecure': CONF.keystone_authtoken.insecure, 'ca_cert': CONF.keystone_authtoken.certfile}
    if (CONF.neutron.auth_strategy not in ['noauth', 'keystone']):
        raise exception.ConfigInvalid(_('Neutron auth_strategy should be either "noauth" or "keystone".'))
    if (CONF.neutron.auth_strategy == 'noauth'):
        params['endpoint_url'] = CONF.neutron.url
        params['auth_strategy'] = 'noauth'
    elif ((CONF.neutron.auth_strategy == 'keystone') and (token is None)):
        params['endpoint_url'] = (CONF.neutron.url or keystone.get_service_url('neutron'))
        params['username'] = CONF.keystone_authtoken.admin_user
        params['tenant_name'] = CONF.keystone_authtoken.admin_tenant_name
        params['password'] = CONF.keystone_authtoken.admin_password
        params['auth_url'] = (CONF.keystone_authtoken.auth_uri or '')
        if CONF.keystone.region_name:
            params['region_name'] = CONF.keystone.region_name
    else:
        params['token'] = token
        params['endpoint_url'] = CONF.neutron.url
        params['auth_strategy'] = None
    return clientv20.Client(**params)
Utility function to create Neutron client.
def _build_client(token=None):
    
    params = {'timeout': CONF.neutron.url_timeout, 'retries': CONF.neutron.retries, 'insecure': CONF.keystone_authtoken.insecure, 'ca_cert': CONF.keystone_authtoken.certfile}
    if (CONF.neutron.auth_strategy not in ['noauth', 'keystone']):
        raise exception.ConfigInvalid(_('Neutron auth_strategy should be either "noauth" or "keystone".'))
    if (CONF.neutron.auth_strategy == 'noauth'):
        params['endpoint_url'] = CONF.neutron.url
        params['auth_strategy'] = 'noauth'
    elif ((CONF.neutron.auth_strategy == 'keystone') and (token is None)):
        params['endpoint_url'] = (CONF.neutron.url or keystone.get_service_url('neutron'))
        params['username'] = CONF.keystone_authtoken.admin_user
        params['tenant_name'] = CONF.keystone_authtoken.admin_tenant_name
        params['password'] = CONF.keystone_authtoken.admin_password
        params['auth_url'] = (CONF.keystone_authtoken.auth_uri or )
        if CONF.keystone.region_name:
            params['region_name'] = CONF.keystone.region_name
    else:
        params['token'] = token
        params['endpoint_url'] = CONF.neutron.url
        params['auth_strategy'] = None
    return clientv20.Client(**params)