Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/module_utils/network/junos/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyo

�
�Udac@s�ddlZddlZddlmZddlmZddlmZddlm	Z	m
Z
ddlmZddl
mZy&ddlmZmZmZeZWn3ek
r�ddlmZmZmZeZnXed	d
ddd
g�Zed	d
dg�Zedddg�Zedddd
g�Zie�d6edd�d6ededgf�d6ededgfde�d6ededgfdd�d6edd�d6edd d!d"d g�d#6Ziedd$d%e�d&6Z ied'd(�d6ed'd(dd�d6ed'd(�d6ed'd(de�d6ed'd(dd�d6ed'd(dd�d6ed'd(�d#6Z!e j"e!�d)d*�Zd+�Z#d,�Z$d-�Z%d.�Z&d/�Z'dd	ddd0�Z)edd1dd2�Z*eeddedd3�Z+ded4�Z,d5�Z-d6�Z.ed7��Z/d8�Z0d1d9�Z1d	dd:�Z2d;�Z3dd<�Z4ddd=�Z5d>�Z6dS(?i����N(tcontextmanager(tdeepcopy(tenv_fallback(t
ConnectiontConnectionError(tNetconfConnection(tto_text(tElementt
SubElementttostringtmergetoverridetreplacetupdatetsettxmlttexttjsonthostttypetinttporttfallbacktANSIBLE_NET_USERNAMEtusernametANSIBLE_NET_PASSWORDtno_logtpasswordtANSIBLE_NET_SSH_KEYFILEtpathtssh_keyfilettimeouttdefaulttnetconftchoicestclit	transporttdicttoptionstprovidertremoved_in_versiong333333@sUTF-8cCs3trt|dd�Stt||�d|�SdS(Ntencodingtunicode(tHAS_LXMLt
xml_to_stringR(telementR)((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyR	AscCstS(N(tjunos_provider_spec(((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pytget_provider_argspecHscCs�t|d�r|jSt|�}|jd�}|dkrRt|j�|_n5|dkrst|j�|_n|jdd|�|jS(Nt_junos_connectiontnetwork_apitcliconfR!tmsgsInvalid connection type %s(thasattrR0tget_capabilitiestgetRt_socket_pathRt	fail_json(tmoduletcapabilitiesR1((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pytget_connectionLscCszt|d�r|jSyt|j�j�}Wn/tk
r`}|jdt|dd��nXtj	|�|_|jS(Nt_junos_capabilitiesR3terrorstsurrogate_then_replace(
R4R<RR7R5RR8RRtloads(R9R:texc((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyR5\s cCs)t|�}|jd�dkr%tStS(NR1R!(R5R6tTruetFalse(R9R:((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyt
is_netconfhscCsWy/dt|�ko dkns.t�nWn!tk
rR|jdd�nXdS(Nii1R3s!rollback must be between 0 and 49(Rt
ValueErrorR8(R9tvalue((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyt_validate_rollback_idms
"

c
Cs�t|dk|dkf�r1|jdd�n1t|dk	|dk	f�rb|jdd�n|tkr�|jdd�n|dkr�|tkr�|jdd�n/|dkr�|tkr�|jdd	|�n|d
kr|dkr|jdd�nt|�}yk|dk	r`t||�tdit	|�d
6�}|j
t|��n|jd|d|d|�SWn/t
k
r�}|jdt|dd��nXdS(NR3s.one of candidate or rollback must be specifieds-candidate and rollback are mutually exclusivesinvalid format specifiedRsinvalid action for format jsonRRsinvalid action format %sRs&format must be text when action is setsload-configurationtrollbacktconfigtactiontformatR=R>(stextR(talltNoneR8tFORMATStJSON_ACTIONStACTIONSR;RFRtstrtexecute_rpcR	tload_configurationRR(R9t	candidateRIRGRJtconntobjR@((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyRRus*
 t0c	Cs�|tkr|jdd�nt|�}yw|r�i|d6}t||�d|d<t|�|d<|jttd|���}n|jd|d|�}Wn/t	k
r�}|jdt
|dd	��nX|S(
NR3sinvalid config format specifiedRJRGtcomparesget-configurationtfilterR=R>(tCONFIG_FORMATSR8R;RFRPRQR	Rtget_configurationRR(	R9RWRJRGRXRTtxattrstreplyR@((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyRZ�s


! c
Cs�t|�}yv|r$|j�}n]t|�r]|jd|d|d|d|d|�}n$|jd|d|d|d|�}Wn/tk
r�}	|jdt|	dd��nX|S(	Nt	confirmedRtcommenttsynchronizetat_timeR3R=R>(R;tvalidateRCtcommitRR8R(
R9tconfirmtcheckR^tconfirm_timeoutR_R`RTR\R@((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pytcommit_configuration�s-( cCsqt|�}|r|d7}ny|jd|d|�}Wn/tk
rl}|jdt|dd��nX|S(Ns | display xml rpctcommandRJR3R=R>(R;RgRR8R(R9tcmdRJtrpc_onlyRTtresponseR@((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyRg�s
 cCsRt|�}y|j�}Wn/tk
rM}|jdt|dd��nX|S(NR3R=R>(R;tlockRR8R(R9RTRjR@((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pytlock_configuration�s cCsRt|�}y|j�}Wn/tk
rM}|jdt|dd��nX|S(NR3R=R>(R;tunlockRR8R(R9RTRjR@((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pytunlock_configuration�s ccs%zt|�dVWdt|�XdS(N(RlRn(R9((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyt
locked_config�s
	cCsRt|�}y|j�}Wn/tk
rM}|jdt|dd��nX|S(NR3R=R>(R;tdiscard_changesRR8R(R9RTRjR@((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyRp�s cCsit|dtddd|�}t|t�r1dS|jd�}|dk	ret|jdd�j�SdS(NRWRJRRGs.//configuration-outputR)slatin-1(	RZRAt
isinstancetlistRLtfindRRtstrip(R9RGR\toutput((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pytget_diff�scCs�t|�|sdSt|t�r5dj|�}nt||d|d|�}t|t�ro|j|�n|jj�t|�S(Ns
RIRJ(	R;RqRrtjoinRRtextendR0RaRv(R9RStwarningsRIRJR\((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pytload_config�s

cCsW|jj|�r"|j|}n1|jjd�rM|jdj|�}nd}|S(NR'(tparamsR6RL(R9tkeyRE((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyt	get_param�scCs5|s|j}ntj�}x|j�D]\}}||kr+t}||}t|ttf�st|g}nt|t�r�|j	d�}t
}n|}|j	|�s�t�||<nxj|D]_}	|rt|�}
|
d=|
ji|	d6�||j
|
�q�||j
i|	d6�q�Wq+q+W|S(s�
    Creates a new dictionary with key as xpath corresponding
    to param and value is a list of dict with metadata and values for
    the xpath.
    Acceptable metadata keys:
        'value': Value of param.
        'tag_only': Value is indicated by tag only in xml hierarchy.
        'leaf_only': If operation is to be added at leaf node only.
        'value_req': If value(text) is required for leaf node.
        'is_key': If the field is key or not.
    eg: Output
    {
        'name': [{'value': 'ge-0/0/1'}]
        'disable': [{'value': True, tag_only': True}]
    }

    :param module:
    :param param_to_xpath_map: Modules params to xpath map
    :return: obj
    txpathRE(R{tcollectionstOrderedDicttitemsRBRqRrttupleR%R6RARR
tappend(R9tparam_to_xpath_maptparamRUR|t	attributetis_attribute_dictRER~tvaltattr((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pytmap_params_to_obj	s.
	
#cCsPts|jdd�n|s+|j}ntd�}|jd�}t||d�}t|�dkr�x'|dd!D]}t||�}qyWn|}	|jd�}
|jd	�}|r�d	}nd
}|	j|dkr�t|	|d�}
n|	}
xB|j	�D]4\}}x%|D]}|jdt
�}|jdt
�}|jd
t
�}|jdt
�}|jdt�}|jd�}|jd�}|
dkr�|p�|r�qn|r�||kr�||j|�}n|dk	s�|s�|r|
}|r�|j
|d|�}t|�s�|jd�}|
}xZ|D]E}|j
|d|�}t|�r{|d}qEt||�}qEWq�|d}n|dk	r�t|t�r�t|dd�}n|r|jd�}x |D]}t||�}q�Wn|r8|
dkr7|s5|jdd�q5q7q:|r�|
dkrf|j||�||_q7|jdd�|r�||_n|r7|j�}|jdd�q7q:||_|j�}|r:|
dkr$|jjd�s�|jdd�n|jj|�s4|j||�q4q7|jdd�q:qqWq
W|j�dS(NR3slxml is not installed.troott/iii����tstatetactivetinactivettag_onlyt	leaf_onlyt	value_reqtis_keyt
parent_attribREttoptabsentR=R>tpresenttdeleteR(R+R8R{RtsplitRtlenR6ttagR�RBRARLR~RqtboolRRRt	getparenttattribtgetchildren(R9twantR�t	value_mapR�R�ttop_eleteletitemt	containerR�R�topertnodetfxpatht
attributesR�R�R�R�R�R�REt	field_toptele_listtfieldst	inner_elettagstpar((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pytmap_obj_to_ele?s�	




	cCsC|jjd�}|r5t|t�r.|gS|Sn
|jgSdS(Nt	aggregate(R{R6RqR%(R9R�((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyt
to_param_list�s(7RRt
contextlibRtcopyRtansible.module_utils.basicRtansible.module_utils.connectionRRt+ansible.module_utils.network.common.netconfRtansible.module_utils._textRt
lxml.etreeRRR	R,RAR+tImportErrortxml.etree.ElementTreeRBt	frozensetRORNRMRYR%R.tjunos_argument_spectjunos_top_specR
R/R;R5RCRFRLRRRZRfRgRlRnRoRpRvRzR}R�R�R�(((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/junos.pyt<module>sp




													
6v

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]