Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/nxos/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_ping.pyc

�
�Udac@s�idd6dgd6dd6ZdZdZdZd	d
lmZd	dlmZmZd	dlm	Z	d
�Z
d�Zd�Zd�Z
d�Zedkr�e�ndS(s1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: nxos_ping
extends_documentation_fragment: nxos
version_added: "2.1"
short_description: Tests reachability using ping from Nexus switch.
description:
    - Tests reachability using ping from switch to a remote destination.
    - For a general purpose network module, see the M(net_ping) module.
    - For Windows targets, use the M(win_ping) module instead.
    - For targets running Python, use the M(ping) module instead.
author:
    - Jason Edelman (@jedelman8)
    - Gabriele Gerbino (@GGabriele)
options:
    dest:
        description:
            - IP address or hostname (resolvable by switch) of remote node.
        required: true
    count:
        description:
            - Number of packets to send.
        default: 5
    source:
        description:
            - Source IP Address or hostname (resolvable by switch)
    vrf:
        description:
            - Outgoing VRF.
    state:
        description:
            - Determines if the expected result is success or fail.
        choices: [ absent, present ]
        default: present
notes:
    - For a general purpose network module, see the M(net_ping) module.
    - For Windows targets, use the M(win_ping) module instead.
    - For targets running Python, use the M(ping) module instead.
sQ
- name: Test reachability to 8.8.8.8 using mgmt vrf
  nxos_ping:
    dest: 8.8.8.8
    vrf: management
    host: 68.170.147.165

- name: Test reachability to a few different public IPs using mgmt vrf
  nxos_ping:
    dest: nxos_ping
    vrf: management
    host: 68.170.147.165
  with_items:
    - 8.8.8.8
    - 4.4.4.4
    - 198.6.1.4
sU
commands:
    description: Show the command sent
    returned: always
    type: list
    sample: ["ping 8.8.8.8 count 2 vrf management"]
rtt:
    description: Show RTT stats
    returned: always
    type: dict
    sample: {"avg": 6.264, "max": 6.564, "min": 5.978}
packets_rx:
    description: Packets successfully received
    returned: always
    type: int
    sample: 2
packets_tx:
    description: Packets successfully transmitted
    returned: always
    type: int
    sample: 2
packet_loss:
    description: Percentage of packets lost
    returned: always
    type: str
    sample: "0.00%"
i����(trun_commands(tnxos_argument_spect
check_args(t
AnsibleModulecCs�||d}|jd�}tdt|djd�dj��dt|djd�dj��d|djd	�dj��}d
||dkr�t}nt}||fS(Nit,t
packets_txitpacketst
packets_rxtpacket_lossitpackets
bytes from(tsplittdicttinttstriptFalsetTrue(tresults_listtreference_pointtsummary_stringtsummary_listtsummaryt	ping_pass((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_ping.pytget_summaryrs## 	cCs�tdddddd�}|dkr�||}|jd�d}|jd�}t|dj��|d<t|d�|d<t|d	d
 �|d<n|S(Ntmintavgtmaxs100.00%t=it/iii����(RtNoneRtfloattlstrip(RR
tlocationtrttt
rtt_stringtbasetrtt_list((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_ping.pytget_rtt�s
cCs3x,|D]$}d|kr|j|�}qqW|S(Ns---(tindex(tresponse_as_listteachR*((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_ping.pytget_statistics_summary_line�s
c	Csi|d6dd6}t||g�d}|sp|jddd|d|jdd	|jd	d
|jd
�n�d|kr�|jddd|�n|d
|kr�|jddd|d	|jd	�nJ|jd�}t|�}t||�\}}t||d|d�}|||fS(Ntcommandttexttoutputitmsgs/An unexpected error occurred. Check all params.tdestinationtdesttvrftsourcescan't bind to addresssCan't bind to source address.sbad contextsWrong VRF name inserted.s
R
i(Rt	fail_jsontparamsRR-RR)(	R.tmoduletcmdtpingt
splitted_pingRRRR%((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_ping.pytget_ping_results�s"
c
Cs�tdtdt�dtdtdddd�dtdt�d	tdt�d
tdtddd
gdd��}|jt�td|dt�}t�}t||�|jd}|jd}|jd
}dj	|�}xCdd	dgD]2}|j|}|r�|dj	||�7}q�q�Wt
||�\}	}
}|	}|
|d<|g|d<|r�|d
kr�|jdd�n&|r�|dkr�|jdd�n|j|�dS(NR3trequiredtcounttdefaultittypeRR4R5tstatetchoicestpresenttabsentt
argument_spectsupports_check_modesping {0}s {0} {1}R%tcommandsR1sPing succeeded unexpectedlysPing failed unexpectedly(
RRRtupdateRRtlistRR7tformatR<R6t	exit_json(
RER8twarningsR2R>RAtping_commandR.targRR%Rtresults((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_ping.pytmain�s6$
	






t__main__N(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNt&ansible.module_utils.network.nxos.nxosRRRtansible.module_utils.basicRRR)R-R<RPt__name__(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_ping.pyt<module>s


)					(

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