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_pfc_interface.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlZdd
l
mZddlmZddlmZddlmZddlmZdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: onyx_pfc_interface
version_added: "2.5"
author: "Samer Deeb (@samerd)"
short_description: Manage priority flow control on ONYX network devices
description:
  - This module provides declarative management of priority flow control (PFC)
    on interfaces of Mellanox ONYX network devices.
notes:
  - Tested on ONYX 3.6.4000
options:
  name:
    description:
      - Name of the interface PFC should be configured on.
  aggregate:
    description: List of interfaces PFC should be configured on.
  purge:
    description:
      - Purge interfaces not defined in the aggregate parameter.
    type: bool
    default: false
  state:
    description:
      - State of the PFC configuration.
    default: enabled
    choices: ['enabled', 'disabled']
sQ
- name: configure PFC
  onyx_pfc_interface:
    name: Eth1/1
    state: enabled
s�
commands:
  description: The list of configuration mode commands to send to the device.
  returned: always
  type: list
  sample:
    - interface ethernet 1/17 dcb priority-flow-control mode on
(tdeepcopyN(t
AnsibleModule(tremove_default_spec(t	iteritems(tBaseOnyxModule(tshow_cmdtOnyxPfcInterfaceModulecB`s�eZejd�ZeZed��Zed��Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd	�Zd
�Zd�ZRS(s3^(Eth\d+\/\d+)|(Eth\d+\/\d+\/\d+)|(Po\d+)|(Mpo\d+)$c
C`s1tdtdd�dtdddddg��S(	Ntnamettypetstrtstatetdefaulttenabledtchoicestdisabled(tdict(tcls((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pyt_get_element_specJscC`s-t|�}tdt�|d<t|�|S(NtrequiredR(RRtTrueR
(Rtelement_spectaggregate_spec((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pyt_get_aggregate_specRs
c	C`s�|j�}|j|�}tdtddddd|�dtdtdd	��}|j|�d
dgg}d
dgg}td|d|d
|dt�|_dS(s module initialization
        t	aggregateRtlisttelementsRtoptionstpurgeRtboolRt
argument_spectrequired_one_oftmutually_exclusivetsupports_check_modeN(RRRtFalsetupdateR	Rt_module(tselfRRR%R&R'((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pytinit_module[s	
cC`s�t�|_|jj}|jd�}|jdt�|_|r�x�|D]i}x4|D],}|j|�dkrV||||<qVqVW|j||�|j	�}|jj
|�qIWn9i|dd6|dd6}|j|�|jj
|�dS(NRR#RR(R t_required_configR+tparamstgetR)t_purgetNonetvalidate_param_valuestcopytappend(R,t
module_paramsRtitemtkeytreq_itemR/((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pytget_required_configns"


cC`s1|j|d�}|j�}td|d|�S(NsPFC operRR(tget_config_attrtlowerR(R,tif_nametif_pfc_dataR((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pyt_create_if_pfc_data�s
cC`st|jd�S(Nsshow dcb priority-flow-control(R
R+(R,((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pyt_get_pfc_config�scC`s�|j�|_t�|_|j�}|s1dS|j|jkrnt|�dkrb|d}q�t�}nd|kr�|d}nxdt|�D]V\}}|jj	|�}|s�q�n|r�|d}|j
||�|j|<q�q�WdS(NiisTable 2i(t_get_os_versiont_os_versionRt_current_configR@tONYX_API_VERSIONtlenRtPFC_IF_REGEXtmatchR?(R,t
pfc_configR=R>RG((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pytload_current_config�s$


cC`sx|jd�r|jdd�S|jd�r>|jdd�S|jd�r]|jdd�S|jjdd|�dS(	NtEths	ethernet tPos
port-channel tMposmlag-port-channel tmsgsinvalid interface name: %s(t
startswithtreplaceR+t	fail_json(R,R=((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pyt_get_interface_cmd_name�scC`sFd|j|�}|dkr(d}nd}|jj||�dS(Ns
interface %s Rs'no dcb priority-flow-control mode forces'dcb priority-flow-control mode on force(RQt	_commandsR5(R,R=t	req_statet
cmd_prefixtpfc_cmd((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pyt_add_if_pfc_commands�s
	cC`s5|jdd�}||kr1|j||�ndS(NRR(R0RV(R,R=t	curr_confRSt
curr_state((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pyt_gen_pfc_commands�scC`s�t�}xi|jD]^}|d}|d}|dkrI|j|�n|jj|i�}|j|||�qW|jr�xHt|j�D]4\}}||kr�d}|j|||�q�q�WndS(NRRRR(tsetR.taddRCR0RYR1R(R,treq_interfacestreq_confRSR=RW((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pytgenerate_commands�s	

	(t__name__t
__module__tretcompileRFR)R1tclassmethodRRR-R:R?R@RIRQRVRYR^(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pyRDs								
			cC`stj�dS(s+ main entry point for module execution
    N(Rtmain(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pyRd�st__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR4RRatansible.module_utils.basicR	t)ansible.module_utils.network.common.utilsR
tansible.module_utils.sixRt&ansible.module_utils.network.onyx.onyxRR
RRdR_(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_pfc_interface.pyt<module>s$


	�	

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