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_global.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
dd
lmZdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys!
---
module: onyx_ptp_global
version_added: "2.8"
author: "Anas Badaha (@anasb)"
short_description: Configures PTP Global parameters
description:
  - This module provides declarative management of PTP Global configuration
    on Mellanox ONYX network devices.
notes:
  - Tested on ONYX 3.6.8130
    ptp and ntp protocols cannot be enabled at the same time
options:
  ptp_state:
    description:
      - PTP state.
    choices: ['enabled', 'disabled']
    default: enabled
  ntp_state:
    description:
      - NTP state.
    choices: ['enabled', 'disabled']
  domain:
    description:
      - "set PTP domain number Range 0-127"
  primary_priority:
    description:
      - "set PTP primary priority Range 0-225"
  secondary_priority:
    description:
      - "set PTP secondary priority Range 0-225"
s�
- name: configure PTP
  onyx_ptp_global:
    ntp_state: enabled
    ptp_state: disabled
    domain: 127
    primary_priority: 128
    secondary_priority: 128
s�
commands:
  description: The list of configuration mode commands to send to the device.
  returned: always
  type: list
  sample:
    - no ntp enable
    - protocol ptp
    - ptp domain 127
(t
AnsibleModule(tshow_cmd(tBaseOnyxModuletOnyxPtpGlobalModulecB`s�eZd�Zd�Zdd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�ZRS(c
C`s�tdtdddg�dtdddgdd�dtdt�d	tdt�d
tdt��}t�}|j|�td|dt�|_d
S(s initialize module
        t	ntp_statetchoicestenabledtdisabledt	ptp_statetdefaulttdomainttypetprimary_prioritytsecondary_priorityt
argument_spectsupports_check_modeN(tdicttinttupdateRtTruet_module(tselftelement_specR((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pytinit_moduleJs	
cC`s/|jj}t|�|_|j|j�dS(N(RtparamsRt_required_configt_validate_param_values(Rt
module_params((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pytget_required_configZscC`sStt|�j||�|ddkrO|ddkrO|jjdd�ndS(NRRRtmsgs;PTP State and NTP State Can not be enabled at the same time(tsuperRtvalidate_param_valuesRt	fail_json(Rtobjtparam((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyR"_s cC`sC|r?dt|�ko#dknr?|jjdd�ndS(NiiR%s domain must be between 0 and 127(RRR((Rtvalue((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pytvalidate_domainds)cC`sC|r?dt|�ko#dknr?|jjdd�ndS(Nii�R%s*Primary Priority must be between 0 and 255(RRR((RR+((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pytvalidate_primary_priorityhs)cC`sC|r?dt|�ko#dknr?|jjdd�ndS(Nii�R%s,Secondary Priority must be between 0 and 255(RRR((RR+((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pytvalidate_secondary_priorityls)cC`sP|d}|sdS|jd�}|dkr?d|jd<n
d|jd<dS(NisNTP enabledtyesRRR(tgett_current_config(Rt
ntp_configR((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyt_set_ntp_configps
cC`sr|dkrd|jd<nRd|jd<t|d�|jd<t|d�|jd<t|d�|jd	<dS(
NRRRtDomainRt	Priority1Rt	Priority2R(tNoneR1R(Rt
ptp_config((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyt_set_ptp_configzs
cC`s"d}t|j|dtdt�S(Nsshow ntp configuredtjson_fmtt
fail_on_error(R	RRtFalse(Rtcmd((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyt_show_ntp_config�scC`s"d}t|j|dtdt�S(Nsshow ptp clockR:R;(R	RRR<(RR=((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyt_show_ptp_config�scC`sBt�|_|j�}|j|�|j�}|j|�dS(N(RR1R>R3R?R9(RR2R8((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pytload_current_config�s

c	C`s�|jjd�}|dkr+|j�n|dkrD|j�n|jjdd�}|dkrr|j�n
|j�|jjd�}|dk	r�|jjd�}||kr�|jj	d|�q�n|jjd�}|dk	r(|jjd�}||kr(|jj	d|�q(n|jjd	�}|dk	r~|jjd	�}||kr~|jj	d
|�q~ndS(NRRRRRs
ptp domain %dRsptp priority1 %dRsptp priority2 %d(
R!R0t_enable_ntpt_disable_ntpt_enable_ptpt_disable_ptpR7R1t	_commandstappend(	RRRRtcurr_domainRtcurr_primary_priorityRtcurr_secondary_priority((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pytgenerate_commands�s0



cC`s0|jd}|dkr,|jjd�ndS(NRRsprotocol ptp(R1RERF(Rtcurr_ptp_state((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyRC�s
cC`s0|jd}|dkr,|jjd�ndS(NRRsno protocol ptp(R1RERF(RRK((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyRD�s
cC`s5|jjd�}|dkr1|jjd�ndS(NRRs
ntp enable(R1R0RERF(Rtcurr_ntp_state((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyRA�scC`s0|jd}|dkr,|jjd�ndS(NRRs
no ntp enable(R1RERF(RRL((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyRB�s
N(t__name__t
__module__RR$R7R"R,R-R.R3R9R>R?R@RJRCRDRARB(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyRHs 						
										cC`stj�dS(s+ main entry point for module execution
    N(Rtmain(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyRO�st__main__N(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRt&ansible.module_utils.network.onyx.onyxR	R
RRORM(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_ptp_global.pyt<module>s


!
�	

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