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_traffic_class.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_traffic_class
version_added: "2.9"
author: "Anas Badaha (@anasb)"
short_description: Configures Traffic Class
description:
  - This module provides declarative management of Traffic Class configuration
    on Mellanox ONYX network devices.
options:
  state:
    description:
      - enable congestion control on interface.
    choices: ['enabled', 'disabled']
    default: enabled
  interfaces:
    description:
      - list of interfaces name.
    required: true
  tc:
    description:
      - traffic class, range 0-7.
    required: true
  congestion_control:
    description:
      - configure congestion control on interface.
    suboptions:
      control:
        description:
          - congestion control type.
        choices: ['red', 'ecn', 'both']
        required: true
      threshold_mode:
        description:
          - congestion control threshold mode.
        choices: ['absolute', 'relative']
        required: true
      min_threshold:
        description:
          - Set minimum-threshold value (in KBs) for marking traffic-class queue.
        required: true
      max_threshold:
        description:
          - Set maximum-threshold value (in KBs) for marking traffic-class queue.
        required: true
  dcb:
    description:
      - configure dcb control on interface.
    suboptions:
      mode:
        description:
          - dcb control mode.
        choices: ['strict', 'wrr']
        required: true
      weight:
        description:
          - Relevant only for wrr mode.
s
- name: configure traffic class
  onyx_traffic_class:
    interfaces:
      - Eth1/1
      - Eth1/2
    tc: 3
    congestion_control:
      control: ecn
      threshold_mode: absolute
      min_threshold: 500
      max_threshold: 1500
    dcb:
      mode: strict
sE
commands:
  description: The list of configuration mode commands to send to the device.
  returned: always
  type: list
  sample:
    - interface ethernet 1/15 traffic-class 3 congestion-control ecn minimum-absolute 150 maximum-absolute 1500
    - interface ethernet 1/16 traffic-class 3 congestion-control ecn minimum-absolute 150 maximum-absolute 1500
    - interface mlag-port-channel 7 traffic-class 3 congestion-control ecn minimum-absolute 150 maximum-absolute 1500
    - interface port-channel 1 traffic-class 3 congestion-control ecn minimum-absolute 150 maximum-absolute 1500
    - interface ethernet 1/15 traffic-class 3 dcb ets strict
    - interface ethernet 1/16 traffic-class 3 dcb ets strict
    - interface mlag-port-channel 7 traffic-class 3 dcb ets strict
    - interface port-channel 1 traffic-class 3 dcb ets strict
N(t	iteritems(t
AnsibleModule(tshow_cmd(tBaseOnyxModuletOnyxTrafficClassModulecB`s�eZejd�Zejd�Zejd�ZdZdZdZ	iee6ee6ee	6Z
d�Zd�Zd�Z
dd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�ZRS(s^Eth(\d+\/\d+|Eth\d+\/\d+\d+)$s	^Po(\d+)$s
^Mpo(\d+)$tethernetsport-channelsmlag-port-channelcC`sItdtddddgdt�dtddd	gdt�d
tdtdt�dtdtdt��}td
tdddgdt�dtdt��}tdtdddt�dtdtdt�dtddd|�dtddd|�dtdddgdd��}t�}|j|�td|dt�|_dS(s initialize module
        tcontroltchoicestredtecntbothtrequiredtthreshold_modetabsolutetrelativet
min_thresholdttypet
max_thresholdtmodetstricttwrrtweightt
interfacestlistttctcongestion_controltdicttoptionstdcbtstatetenabledtdisabledtdefaultt
argument_spectsupports_check_modeN(R"tTruetinttupdateR	t_module(tselftcongestion_control_spectdcb_spectelement_specR)((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pytinit_modules"$!	
cC`s/|jj}t|�|_|j|j�dS(N(R.tparamsR"t_required_configtvalidate_param_values(R/t
module_params((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pytget_required_config�scC`sC|r?dt|�ko#dknr?|jjdd�ndS(Niitmsgs tc value must be between 0 and 7(R,R.t	fail_json(R/tvalue((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pytvalidate_tc�s)cC`s�|jd�}|dk	rj|jd�}|jd�}|dkrj|dkrj|jjdd�qjntt|�j||�dS(NR$RRRR9s6User should send weight attribute when dcb mode is wrr(tgettNoneR.R:tsuperRR6(R/tobjtparamR$tdcb_modeR((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pyR6�scC`sdd}d}xKt|j�D]:\}}|j|�}|r|}|jd�}PqqW||fS(Ni(R>RtIF_TYPE_MAPtmatchtgroup(R/tif_nametif_typetif_idtinterface_typetinterface_regexRD((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pyt_get_interface_type�scC`s�|jjd�}|j||�dj|�}|dkrIt�}ns|djd�}|djt|��}	|	djd�}
t|	djd��}td|
j�d|�}||d	}|jd
�}|dkrtdd
d|d|d|�|j|<dS|jd�}
|jd�}|jd�}|
dkrSd}nd}t|j	|�d�}t|j	|�d�}td|j�d|
d|d|�}tddd|d|d|d|�|j|<dS(NR iis
ETS per TCsS.ModetWRRitModetnoneR%R'R$RGRHsThreshold modesMaximum thresholdsMinimum thresholdRt t%RRRRR&R!(
R5R=t_show_interface_dcb_etsR>R"tstrR,tlowert_current_configtsplit(R/t#interface_congestion_control_configt	interfaceRGRHR tinterface_dcb_etsR$t
ets_per_tct	tc_configRBt
dcb_weightRRRRt	delimitert	min_valuet	max_malueR!((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pyt(_set_interface_congestion_control_config�s4(	cC`s.dj||�}t|j|dtdt�S(Ns*show interfaces {0} {1} congestion-controltjson_fmtt
fail_on_error(tformatR
R.R+tFalse(R/RGRWtcmd((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pyt"_show_interface_congestion_control�scC`s.dj||�}t|j|dtdt�S(Nsshow dcb ets interface {0} {1}R`Ra(RbR
R.R+Rc(R/RGRWRd((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pyRQ�scC`s�t�|_x�|jjd�D]�}|j|�\}}|s_|jjddj|��n|j||�}|dk	r�|j
||||�q|jjddj|��qWdS(NRR9sunsupported interface: {0}s&Interface {0} does not exist on switch(R"RTR5R=RKR.R:RbReR>R_(R/RWRGRHRV((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pytload_current_config�s	cC`s.|jjd�}|jjd�}|jjd�}x�|D]�}|jj|�}|jd�}|jd�}|jd�}|dkr�|dkr=|jjdj|||��q=q=n|jjd	�}	|	dk	r.|	jd
�}
|jd	�}|	jd�}|	jd�}
|	jd
�}|dkrY|j|||||
|
|�q.|jd
�}|jd�}|jd�}|jd
�}|
|kr�|j|||||
|
|�q.||kr�|j|||||
|
|�q.|
|ks	||kr.|j|||||
|
|�q.n|jjd�}|dk	r=|jd�}|jd�}|jd�}|dkr�||kr�|jjdj||||��q&|dkr&|jd�}|jd�}||ks�||kr#|jjdj|||||��q#q&q=q=WdS(NR%R RRGRHR'R&s9interface {0} {1} no traffic-class {2} congestion-controlR!RRRRR$RRs/interface {0} {1} traffic-class {2} dcb ets {3}RRs3interface {0} {1} traffic-class {2} dcb ets {3} {4}(R5R=RTt	_commandstappendRbR>t%_threshold_mode_generate_cmds_mappers(R/R%R RRWtcurrent_interfacet
current_stateRGRHR!Rtcurrent_congestion_controlRRRtcurrent_controltcurr_threshold_modetcurr_min_thresholdtcurr_max_thresholdR$RBtcurrent_dcbtcurrent_dcb_modeRtcurrent_weight((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pytgenerate_commands�sb
"cC`sK|dkr+|j||||||�n|j||||||�dS(NR(t*_generate_congestion_control_absolute_cmdst*_generate_congestion_control_relative_cmds(R/RRGRHR RRR((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pyRi's

cC`s,|jjdj||||||��dS(Nsdinterface {0} {1} traffic-class {2} congestion-control {3} minimum-absolute {4} maximum-absolute {5}(RgRhRb(R/RGRHR Rtmin_absolutetmax_absolute((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pyRu0scC`s,|jjdj||||||��dS(Nsdinterface {0} {1} traffic-class {2} congestion-control {3} minimum-relative {4} maximum-relative {5}(RgRhRb(R/RGRHR Rtmin_relativetmax_relative((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pyRv7sN(t__name__t
__module__tretcompiletIF_ETH_REGEXtIF_PO_REGEXtMLAG_NAME_REGEXtIF_TYPE_ETHtPORT_CHANNELtMLAG_PORT_CHANNELRCR3R8R<R>R6RKR_ReRQRfRtRiRuRv(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pyRos.
						#				9			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_traffic_class.pyR�?st__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR}tansible.module_utils.sixRtansible.module_utils.basicR	t&ansible.module_utils.network.onyx.onyxR
RRR�R{(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_traffic_class.pyt<module>s 


;�	

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