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

�
�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_qos
version_added: "2.9"
author: "Anas Badaha (@anasb)"
short_description: Configures QoS
description:
  - This module provides declarative management of Onyx QoS configuration
    on Mellanox ONYX network devices.
notes:
  - Tested on ONYX 3.6.8130
options:
  interfaces:
    description:
      - list of interfaces name.
    required: true
  trust:
    description:
      - trust type.
    choices: ['L2', 'L3', 'both']
    default: L2
  rewrite_pcp:
    description:
      - rewrite with type pcp.
    choices: ['enabled', 'disabled']
    default: disabled
  rewrite_dscp:
    description:
      - rewrite with type dscp.
    choices: ['enabled', 'disabled']
    default: disabled
s$
- name: configure QoS
  onyx_QoS:
    interfaces:
      - Mpo7
      - Mpo7
    trust: L3
    rewrite_pcp: disabled
    rewrite_dscp: enabled

- name: configure QoS
  onyx_QoS:
    interfaces:
      - Eth1/1
      - Eth1/2
    trust: both
    rewrite_pcp: disabled
    rewrite_dscp: enabled
s�
commands:
  description: The list of configuration mode commands to send to the device.
  returned: always
  type: list
  sample:
    - interface ethernet 1/16 qos trust L3
    - interface mlag-port-channel 7 qos trust L3
    - interface port-channel 1 qos trust L3
    - interface mlag-port-channel 7 qos trust L2
    - interface mlag-port-channel 7 qos rewrite dscp
    - interface ethernet 1/16 qos rewrite pcp
    - interface ethernet 1/1 no qos rewrite pcp
N(t	iteritems(t
AnsibleModule(tshow_cmd(tBaseOnyxModulet
OnyxQosModulecB`s�eZdZdZdZdZdZdZdZe	j
d�Ze	j
d�Ze	j
d	�Z
d
ZdZdZiee6ee6e
e6Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(sinterface {0} {1} qos trust {2}s$interface {0} {1} no qos rewrite pcps%interface {0} {1} no qos rewrite dscps!interface {0} {1} qos rewrite pcps"interface {0} {1} qos rewrite dscptpcptdscps^Eth(\d+\/\d+|Eth\d+\/\d+\d+)$s	^Po(\d+)$s
^Mpo(\d+)$tethernetsport-channelsmlag-port-channelc
C`s�tdtdddt�dtdddd	gd
d�dtddd
gd
d
�dtddd
gd
d
��}t�}|j|�td|dt�|_dS(s initialize module
        t
interfacesttypetlisttrequiredttrusttchoicestL2tL3tbothtdefaulttrewrite_pcptenabledtdisabledtrewrite_dscpt
argument_spectsupports_check_modeN(tdicttTruetupdateR	t_module(tselftelement_specR((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pytinit_moduleps	
cC`s/|jj}t|�|_|j|j�dS(N(R#tparamsR t_required_configtvalidate_param_values(R$t
module_params((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pytget_required_configscC`sdd}d}xKt|j�D]:\}}|j|�}|r|}|jd�}PqqW||fS(Ni(tNoneRtIF_TYPE_MAPtmatchtgroup(R$tif_nametif_typetif_idtinterface_typetinterface_regexR.((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pyt_get_interface_type�scC`s~|dj|�}|djd�}|djd�}|djd�}td|d|d|d|d	|�|j|<dS(
Nis
Trust modesDSCP rewritesPCP,DEI rewriteRRRR1R2(tgetR t_current_config(R$tinterface_qos_configt	interfaceR1R2RRR((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pyt_set_interface_qos_config�scC`s.dj||�}t|j|dtdt�S(Nsshow qos interface {0} {1}tjson_fmtt
fail_on_error(tformatR
R#R!tFalse(R$R1R9tcmd((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pyt_show_interface_qos�scC`s�t�|_x�|jjd�D]�}|j|�\}}|s_|jjddj|��n|j||�}|dk	r�|j
||||�q|jjddj|��qWdS(NRtmsgsunsupported interface: {0}s&Interface {0} does not exist on switch(R R7R(R6R5R#t	fail_jsonR=R@R,R:(R$R9R1R2R8((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pytload_current_config�sc
C`s�|jjd�}|jjd�}|jjd�}xj|jjd�D]V}|j|�\}}}}}	|j||	|||�|j||	|||�qIWdS(NRRRR(R(R6t_get_current_rewrite_configt_add_interface_trust_cmdst_add_interface_rewrite_cmds(
R$RRRR9tignored1tignored2t
current_trustR1R2((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pytgenerate_commands�scC`sp|jj|�}|jd�}|jd�}|jd�}|jd�}|jd�}|||||fS(NRRR1R2R(R7R6(R$R9tcurrent_interface_qos_configtcurrent_rewrite_pcptcurrent_rewrite_dscpR1R2RI((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pyRD�sc	C`sI|j|�\}}}}	}
|dkrw||krw|j||||j|�|jj|jj|||��n�|dkr�||kr�|j||||j|�|jj|jj|||��nu|dkrE||krE|j||||j|�|j||||j|�|jj|jj|||��ndS(NRRR(RDt_add_no_rewrite_cmdtREWRITE_DSCPt	_commandstappendt	TRUST_CMDR=tREWRITE_PCP(R$R1R2R9RRIRLRMRGRHtignored3((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pyRE�s%%cC`s
|j|�\}}}}	}
|dkrX||krX|jj|jj||��n:|dkr�||kr�|jj|jj||��n|dkr�||kr�|jj|jj||��n:|dkr||kr|jj|jj||��ndS(NRR(RDRPRQtREWRITE_PCP_CMDR=tNO_REWRITE_PCP_CMDtREWRITE_DSCP_CMDtNO_REWRITE_DSCP_CMD(R$R1R2R9RRRLRMRGRHRT((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pyRF�s"""cC`s�||jkrN|dkrN|jj|jj||��d|j|d<nN||jkr�|dkr�|jj|jj||��d|j|d<ndS(NRRRR(RSRPRQRVR=R7RORX(R$R1R2R9trewrite_typetcurrent_rewrite((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pyRN�s(t__name__t
__module__RRRVRXRURWRSROtretcompiletIF_ETH_REGEXtIF_PO_REGEXtMLAG_NAME_REGEXtIF_TYPE_ETHtPORT_CHANNELtMLAG_PORT_CHANNELR-R&R+R5R:R@RCRJRDRERFRN(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pyRXs8
								
	
		cC`stj�dS(s+ main entry point for module execution
    N(Rtmain(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pyRe�st__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR]tansible.module_utils.sixRtansible.module_utils.basicR	t&ansible.module_utils.network.onyx.onyxR
RRReR[(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_qos.pyt<module>s 


!�	

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