Anons79 Mini Shell

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

�
�Udac@sddlZddlmZddlmZmZddlmZmZiZ	daiede
�d6e�d6e�d6Zd	�Zd
�Ze
d�Zdd
�Zd�Zd�Ze
e
d�Zde
d�Zd�Zd�Zdefd��YZdS(i����N(tto_text(t
ConnectiontConnectionError(tto_listtEntityCollectiontkeytcommandtprompttanswercCstr
tSt|j�atS(N(t_CONNECTIONRt_socket_path(tmodule((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytget_connection$scCs=t|t�std��nt|t�}||�}|S(Nsargument must be of type <list>(t
isinstancetlisttAssertionErrorRt
_COMMAND_SPEC(Rtcommandst	transform((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytto_commands,s
cCsgt|�}t|t|��}t�}x6|D].}|j|�}|jt|dd��q1W|S(Nterrorstsurrogate_then_replace(RRRRtgettappendR(RRtcheck_rct
connectiont	responsestcmdtout((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytrun_commands5s	
trunningcCs7t|�}|j|�}t|dd�j�}|S(NRR(Rt
get_configRtstrip(RtsourcetconnRtcfg((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyRCscCsMyt|�}|j|�Wn)tk
rH}|jdt|��nXdS(Ntmsg(Rtedit_configRt	fail_jsonR(RtconfigR"texc((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytload_configJs
c
Cs%|jd�}d}d}t|�}xR||kr{||j�}|s]|dd
krm|d7}q*n|d}Pq*W|s�dS|dkr�dnd}|d}t}xN||kr�||j�}	|	s�|	d|kr�|d8}q�nt}Pq�W|s
||Sd	j|||d!�S(Ns
it[t{itnullt]t}t(R*R+(tsplittNonetlenR tFalsetTruetjoin(
Rtout_listtfirst_indextopening_chartlines_countt
first_linetclosing_chart
last_indextfoundt	last_line((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyt_parse_json_outputRs4



cCs�|r|d7}nt|�}t|t|��d}y|j|�}Wntk
rk|rg�ndSX|r�t|�}ytj|�}Wq�t	k
r�|j
dddt|dd��q�Xnt|dd�j�}|S(Ns
 | json-printiR$sgot invalid jsontstderrRR(
RRRRRR1R?tjsontloadst
ValueErrorR&RR (RRtjson_fmtt
fail_on_errorR"tcommand_objRR#((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytshow_cmdos(


	cCs1d|}|r!|d|7}nt|||�S(Nsshow interfaces %ss %s(RG(Rtinterface_typetflagsRDR((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytget_interfaces_config�s
cCsd}t||dtdt�S(Ns show running-config protocol bgpRDRE(RGR3(RR((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytget_bgp_summary�scCs}t|d�r|jSt|�}y|j�}Wn/tk
rc}|jdt|dd��nXtj|�|_|jS(s/Returns platform info of the remove device
    t
_capabilitiesR$RR(	thasattrRLRtget_capabilitiesRR&RRARB(RRtcapabilitiesR(((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyRN�s tBaseOnyxModulecBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	dd�Zed	��Z
ed
��Zd�Zd�Zd
�Zd�Zed��ZRS(s3.6.6000cCs4d|_t�|_d|_d|_d|_dS(N(R1t_moduleRt	_commandst_current_configt_required_configt_os_version(tself((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyt__init__�s
			cCsdS(N((RV((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytinit_module�scCsdS(N((RV((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytload_current_config�scCsdS(N((RV((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytget_required_config�scCs!t|j�}|d}|dS(Ntdevice_infotnetwork_os_version(RNRQ(RVROR[((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyt_get_os_version�s
cCsdS(N(R1(RVtresult((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytcheck_declarative_intent_params�scCs9t|d|�}t|�r5||j|��ndS(Nsvalidate_%s(tgetattrtcallableR(RVtparamRt	validator((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyt
_validate_key�scCsX|dkr|jj}nx6|D].}y|j||�Wq"tk
rOq"Xq"WdS(N(R1RQtparamsRdtAttributeError(RVtobjRbR((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytvalidate_param_values�s

cCs
|j|�S(N(R(tclstitemtarg((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytget_config_attr�scCsI|j|d�}|j�}yt|d�SWntk
rDdSXdS(NtMTUi(RlR0tintRCR1(RiRjtmtut	mtu_parts((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytget_mtu�s
cCs_|dkrtS|t|�ko-|kns[d|||f}|jjd|�ndS(Ns%s must be between %s and %sR$(R1R4RnRQR&(RVt	attr_nametmin_valtmax_valtvalueR$((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyt_validate_range�s"cCs|jddd|�dS(NRoi�i�%(Rv(RVRu((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytvalidate_mtu�scCsdS(N((RV((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytgenerate_commands�scCs�|j�itd6}|j�|j�|j�|j|d<|jrz|jjsmt|j|j�nt	|d<n|j
|�}|r�d}|jjd|d|�n|jj|�dS(NtchangedRs:One or more conditional statements have not been satisfiedR$tfailed_conditions(
RXR3RZRYRxRRRQt
check_modeR)R4R_R&t	exit_json(RVR^RzR$((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytrun�s 





	

cCs|�}|j�dS(N(R}(Ritapp((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pytmains	N(t__name__t
__module__tONYX_API_VERSIONRWRXRYRZR]R_RdR1RhtclassmethodRlRqRvRwRxR}R(((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyRP�s 							
					(RAtansible.module_utils._textRtansible.module_utils.connectionRRt)ansible.module_utils.network.common.utilsRRt_DEVICE_CONFIGSR1R	tdictR4RRRRRR)R?RGRJRKRNtobjectRP(((sJ/usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyt<module>s(

							

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