Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZddlmZdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys
---
module: onyx_ptp_interface
version_added: '2.8'
author: 'Anas Badaha (@anasb)'
short_description: 'Configures PTP on interface'
description:
    - "This module provides declarative management of PTP interfaces configuration
on Mellanox ONYX network devices."
notes:
    - 'Tested on ONYX 3.6.8130'
    - 'PTP Protocol must be enabled on switch.'
    - 'Interface must not be a switch port interface.'
options:
    name:
        description:
            - 'ethernet or vlan interface name that we want to configure PTP on it'
        required: true
    state:
        description:
            - 'Enable/Disable PTP on Interface'
        default: enabled
        choices:
            - enabled
            - disabled
    delay_request:
        description:
            - 'configure PTP delay request interval, Range 0-5'
    announce_interval:
        description:
            - 'configure PTP announce setting for interval, Range -3-1'
    announce_timeout:
        description:
            - 'configure PTP announce setting for timeout, Range 2-10'
    sync_interval:
        description:
            - 'configure PTP sync interval, Range -7--1'
s�
- name: configure PTP interface
  onyx_ptp_interface:
    state: enabled
    name: Eth1/1
    delay_request: 0
    announce_interval: -2
    announce_timeout: 3
s
commands:
  description: The list of configuration mode commands to send to the device.
  returned: always
  type: list
  sample:
    - interface ethernet 1/16 ptp enable
    - interface ethernet 1/16 ptp delay-req interval 0
    - interface ethernet 1/16 ptp announce interval -1
N(t
AnsibleModule(t	iteritems(tshow_cmd(tBaseOnyxModuletOnyxPtpInterfaceModulecB`seZejd�Zejd�ZdZdZiee6ee6Zid!d6d"d	6d#d6d$d6Z	d%Zd%Zd�Z
ed��Zd�Zd�Zd�Zd%d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �ZRS(&s^Eth(\d+\/\d+|Eth\d+\/\d+\d+)$s^Vlan (\d+)$tethernettvlaniit
delay_requesti����i����tannounce_intervalii
tannounce_timeouti����t
sync_intervalcC`s�tdtdt�dtdddgdd�dtd	t�d
td	t�dtd	t�dtd	t��}t�}|j|�td
|dt�|_dS(s initialize module
        tnametrequiredtstatetchoicestenabledtdisabledtdefaultRttypeRRRt
argument_spectsupports_check_modeN(tdicttTruetinttupdateRt_module(tselftelement_specR((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pytinit_modulefs	
cC`sdd}d}xKt|j�D]:\}}|j|�}|r|}|jd�}PqqW||fS(Ni(tNoneR	tIF_TYPE_MAPtmatchtgroup(tclstif_nametif_typetif_idtinterface_typetinterface_regexR'((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyt_get_interface_typewscC`sL|d}|j|�\|_|_|jsH|jjdd|�ndS(NRtmsgs#unsupported interface name/type: %s(R/t_interface_typet
_interface_idR!t	fail_json(R"t
module_paramsR*((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyt_set_if_type�s

	cC`s?|jj}t|�|_|j|j�|j|j�dS(N(R!tparamsRt_required_configR5tvalidate_param_values(R"R4((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pytget_required_config�scC`s*|dk	r&|jjdd|�ndS(NR0s6Can not set %s value on switch while state is disabled(R%R!R3(R"t	attr_namet
attr_value((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyt_validate_attr_is_not_none�scC`sX|ddkr;x(|jD]}|j|||�qWntt|�j||�dS(NRR(t
RANGE_ATTRR<tsuperRR8(R"tobjtparamR:((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyR8�scC`sc|j|\}}|r_|t|�ko6|knr_|jjdd|||f�ndS(NR0s"%s value must be between %d and %d(R=RR!R3(R"tvalueR:t	min_valuet	max_value((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyt_validate_range�s)cC`s|j|d�dS(NR(RD(R"RA((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pytvalidate_delay_request�scC`s|j|d�dS(NR(RD(R"RA((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pytvalidate_announce_interval�scC`s|j|d�dS(NR(RD(R"RA((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pytvalidate_announce_timeout�scC`s|j|d�dS(NR(RD(R"RA((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pytvalidate_sync_interval�scC`s�|dkrd|jd<dS|d}d|jd<t|d�|jd<t|d�|jd<t|d	�|jd
<t|d�|jd<dS(
NRRiRs Delay request interval(log mean)RsAnnounce interval(log mean)RsAnnounce receipt time outRsSync interval(log mean)R(R%t_current_configR(R"tptp_interface_config((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyt_set_ptp_interface_config�s


cC`s2d|j|jf}t|j|dtdt�S(Nsshow ptp interface %s %stjson_fmtt
fail_on_error(R1R2R
R!RtFalse(R"tcmd((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyt_show_ptp_interface_config�scC`s)t�|_|j�}|j|�dS(N(RRIRPRK(R"RJ((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pytload_current_config�scC`sl|jj|�}|dk	rh|jj|�}||krh|jjd|j|j||f�qhndS(Nsinterface %s %s ptp %s %d(R7tgetR%RIt	_commandstappendR1R2(R"R:t
attr_cmd_nametattr_valtcurr_val((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyt_generate_attr_command�s	cC`sf|jjdd�}|j|�|jdd�|jdd�|jdd�|jd	d
�dS(NRRRsdelay-req intervalRsannounce intervalRsannounce timeoutRs
sync interval(R7RRt_gen_ptp_commandsRX(R"R((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pytgenerate_commands�s
cC`sO|dkr%d|j|jf}nd|j|jf}|jj|�dS(NRsinterface %s %s ptp enablesno interface %s %s ptp enable(R1R2RSRT(R"t	req_statet
if_ptp_cmd((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyt_add_if_ptp_cmd�scC`s2|jjd�}||kr.|j|�ndS(NR(RIRRR](R"R[t
curr_state((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyRY�s(ii(i����i����(ii
(i����i����N( t__name__t
__module__tretcompiletIF_ETH_REGEXt
IF_VLAN_REGEXtIF_TYPE_ETHtIF_TYPE_VLANR&R=R%R1R2R$tclassmethodR/R5R9R<R8RDRERFRGRHRKRPRQRXRZR]RY(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyRPs@

																cC`stj�dS(s+ main entry point for module execution
    N(Rtmain(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyRh�st__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRatansible.module_utils.basicRtansible.module_utils.sixR	t&ansible.module_utils.network.onyx.onyxR
RRRhR_(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_interface.pyt<module>s 


&
�	

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