+
    lj3                         ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RIH
t
 ^ RIHt ]P                  t R tRR
 ltR tRR ltR tR tRRRRRR/tRR ltRR lt ! R R]P,                  4      tR	# )    )	lockutils)clients)config)auth)dynamic_creds)preprov_creds)
exceptionsc                 ,   V R 8X  d   \         P                  P                  pM9V R8X  d   \         P                  P                  pM\        P
                  ! V R7      hRV RVR\         P                  P                  R\         P                  P                  /# )v3v2)identity_versionr   identity_uricredentials_domain
admin_role)	CONFidentityuri_v3urir	   InvalidIdentityVersionr   default_credentials_domain_namer   )r   r   s   & f/Users/user/workspace/sujinbaek/cqa-test-app/flava-qa/cqa-cloud-api-test/common/credentials_factory.py_get_common_provider_paramsr   *   s{    4}}++	T	!}}((//-/ 	/ 	,diiGGdmm..	     Nc                   \        V 4      pT;'       g    \        RV R7      pV R8X  d   \        P                  P                  pM!V R8X  d   \        P                  P
                  p\        V3/ \        RV3R\        P                  P                  3R\        P                  P                  3R\        P                  P                  3R	\        P                  P                  3R
\        P                  P                  3R\        P                  P                  3R\        P                  P                   3R\        P                  P"                  ;'       d     \        P                  P$                  '       * 3RRX3.4      B # )a  Dynamic provider parameters setup from config

This helper returns a dict of parameter that can be used to initialise
a `DynamicCredentialProvider` according to tempest configuration.
Parameters that are not configuration specific (name, network_resources)
are not returned.

:param identity_version: 'v2' or 'v3'
:param admin_creds: An object of type `auth.Credentials`. If None, it
                    is built from the configuration file as well.
:return: A dict with the parameters
Tfill_inr   r   r   admin_credsidentity_admin_domain_scopeidentity_admin_roleextra_rolesneutron_availableproject_network_cidrproject_network_mask_bitspublic_network_idcreate_networksidentity_admin_endpoint_type)resource_prefixtempest)r    get_configured_admin_credentialsr   r   v3_endpoint_typev2_admin_endpoint_typedictadmin_domain_scoper   r   tempest_rolesservice_availableneutronnetworkr"   r#   r$   create_isolated_networksshared_physical_network)r   r   _common_paramsendpoint_types   &&  r   get_dynamic_provider_paramsr6   :   sB    11ABN 9 9!A'7"9K466	T	!<< $	$	&(H(HI	 8 89			//0	d44<<=	!B!BC	$dll&L&LM	dll<<=	TYY?? B B!\\AAEB 	D&	'7( #  r   c                   \        V 4      p\        P                  P                  p\	        V3/ \	        R\
        P                  ! \        4      3R\        P                  P                  3R\        P                  P                  3RV3.4      B # )aZ  Pre-provisioned provider parameters setup from config

This helper returns a dict of parameter that can be used to initialise
a `PreProvisionedCredentialProvider` according to tempest configuration.
Parameters that are not configuration specific (name) are not returned.

:param identity_version: 'v2' or 'v3'
:return: A dict with the parameters
accounts_lock_dirtest_accounts_fileobject_storage_operator_role"object_storage_reseller_admin_role)
r   r   object_storagereseller_admin_roler,   r   get_lock_pathr   r9   operator_role)r   r4   r=   s   &  r   get_preprov_provider_paramsr@   ^   s     11ABN--AA $	i55d;<	tyy;;<	')<)<)J)JK	-/BC	( #  r   c                   T;'       g    \         P                  P                  p\         P                  P                  '       g	   V'       d$   \
        P                  ! RRV RV/\        V4      B # \         P                  P                  '       d"   \        P                  ! RRV /\        V4      B # \        P                  ! R4      h)a1  Return the right implementation of CredentialProvider based on config

This helper returns the right implementation of CredentialProvider based on
config and on the value of force_tenant_isolation.

:param name: When provided, it makes it possible to associate credential
             artifacts back to the owner (test class).
:param network_resources: Dictionary of network resources to be allocated
                          for each test account. Only valid for the dynamic
                          credentials provider.
:param force_tenant_isolation: Always return a `DynamicCredentialProvider`,
                               regardless of the configuration.
:param identity_version: Use the specified identity API version, regardless
                         of the configuration. Valid values are 'v2', 'v3'.
namenetwork_resources%A valid credential provider is needed )r   r   auth_versionr   use_dynamic_credentialsr   DynamicCredentialProviderr6   r9   r    PreProvisionedCredentialProviderr@   r	   InvalidConfiguration)rB   rC   force_tenant_isolationr   s   &&&&r   get_credentials_providerrL   r   s    , (EE4==+E+Eyy(((,B66 ==/= **:;= 	=
 99''' AA AA-.>?A A 1179 9r   c                \   Rp\         P                  P                  '       d   V# \         P                  P                  '       d<   \        P
                  ! RRR/\        V 4      B pVP                  4       '       g   RpV#  \        RV R7       V#   \        P                   d    Rp T# i ; i)a*  Helper to check for admin credentials

Helper function to check if a set of admin credentials is available so we
can do a single call from skip_checks.
This helper depends on identity_version as there may be admin credentials
available for v2 but not for v3.

:param identity_version: 'v2' or 'v3'
TrB   check_adminFr   rE   )r   r   rG   r9   r   rI   r@   admin_availabler)   r	   rJ   )r   is_admincheck_accountss   &  r   is_admin_availablerR      s     Hyy(((		%	%	%&GG ==)*:;= --//H O	,U>NP O .. 	HO	s   B B+*B+c                d   \         P                  P                  '       d   R# \         P                  P                  '       d#   \        P
                  ! RRR/\        V 4      B pM\        P                  ! R4      h VP                  4       '       g   R# R#   \        P                   d     R# i ; i)a=  Helper to check for alt credentials

Helper function to check if a second set of credentials is available (aka
alt credentials) so we can do a single call from skip_checks.
This helper depends on identity_version as there may be alt credentials
available for v2 but not for v3.

:param identity_version: 'v2' or 'v3'
TrB   	check_altrD   FrE   )
r   r   rG   r9   r   rI   r@   r	   rJ   is_multi_user)r   rQ   s   & r   is_alt_availablerV      s     yy(((yy###&GG ==)*:;= --35 	5++--** s   <B B/.B/identity_adminuseralt_userc                L   T;'       g    \         P                  P                  pVR9  d   \        P                  ! RV,          4      h. ROpVR8X  dE   VP                  R4       VP                  R4       VP                  R4       VP                  R4       \        P                  ! 4       pV F&  p\        \         P                  RV,           4      W4&   K(  	  \        RRV R	V/VB pV '       g5   VP                  4       '       g   R
p\        P                  ! Wa,          4      hV# )a"  Get admin credentials from the config file

Read credentials from configuration, builds a Credentials object based on
the specified or configured version

:param fill_in: If True, a request to the Token API is submitted, and the
                credential object is filled in with all names and IDs from
                the token API response.
:param identity_version: The identity version to talk to and the type of
                         credentials object to be created. 'v2' or 'v3'.
:returns: An object of a sub-type of `auth.Credentials`
r   zUnsupported auth version: %sdomain_nameuser_domain_nameproject_domain_namesystemadmin_r   r   zThe admin credentials are incorrectly set in the config file for identity version %s. Double check that all required values are assigned.)r   r   )usernamepasswordproject_namerE   )r   r   rF   r	   rJ   appendr   service_client_configgetattrr   get_credentialsis_valid)r   r   conf_attributesparamsattrcredentialsmsgs   &&     r   r)   r)      s    (EE4==+E+E|+--*-==? 	?'O 4}-1245x())+Ftyy(T/:   " O' O3COGMOK##%%3C 11#2HIIr   c                >   \        \        P                  ! 4       3/ VB pT;'       g    \        P                  P
                  pVR8X  d   \        R \        P                  P                   4       4      pVP                  R4      '       gD   VP                  VP                  4       4      '       g   \        P                  P                  pWSR&   \        P                  P                  pM\        P                  P                  p\        P                   ! V3RV RV/VB # )aZ  Get credentials from dict based on config

Wrapper around auth.get_credentials to use the configured identity version
if none is specified.

:param fill_in: If True, a request to the Token API is submitted, and the
                credential object is filled in with all names and IDs from
                the token API response.
:param identity_version: The identity version to talk to and the type of
                         credentials object to be created. 'v2' or 'v3'.
:param kwargs: Attributes to be used to build the Credentials object.
:returns: An object of a sub-type of `auth.Credentials`
r   c              3   8   "   T F  pR V9   g   K  Vx  K  	  R# 5i)domainNrE   ).0xs   & r   	<genexpr>"get_credentials.<locals>.<genexpr>   s       .'L!'1} A'Ls   	
r^   r[   r   r   )r,   r   rd   r   r   rF   setr   KeystoneV3Credentials
ATTRIBUTESgetintersectionkeysr   r   r   rf   )r   r   kwargsri   domain_fieldsr[   auth_urls   &&,    r   rf   rf     s     &..0;F;F'EE4==+E+E 4 .t'A'A'L'L . .

8$$!..v{{}==))CCK %0=!==''==$$ *(/*1A* #)* *r   c                   6   a a ] tR tRt oRtV 3R ltRtVtV ;t# )AdminManageri4  zBManager that uses admin credentials for its managed client objectsc                @   < \         \        V `  \        4       R 7       R# ))rk   N)superr~   __init__r)   )self	__class__s   &r   r   AdminManager.__init__7  s    lD*8: 	+ 	<r   rE   )	__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classdictcell____classcell__)r   __classdict__s   @@r   r~   r~   4  s     L< <r   r~   )N)NFN)r   admin)r   N)r   alt)TN)oslo_concurrencyr   testsr   configsr   libr   
lib.commonr   r   r	   r   r   r6   r@   rL   rR   rV   CREDENTIAL_TYPESr)   rf   Managerr~   rE   r   r   <module>r      s    '    $ $ {{
#  !H($9N<F '
# )X#*P<7?? <r   