Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZd
ddddgZ
dddgZdddddgZddgZdefd��YZd�Zedkr�e�ndS( i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysF

---
module: flowadm
short_description: Manage bandwidth resource control and priority for protocols, services and zones on Solaris/illumos systems
description:
    - Create/modify/remove networking bandwidth and associated resources for a type of traffic on a particular link.
version_added: "2.2"
author: Adam Števko (@xen0l)
options:
    name:
        description: >
            - A flow is defined as a set of attributes based on Layer 3 and Layer 4
            headers, which can be used to identify a protocol, service, or a zone.
        required: true
        aliases: [ 'flow' ]
    link:
        description:
            - Specifiies a link to configure flow on.
        required: false
    local_ip:
        description:
            - Identifies a network flow by the local IP address.
        required: false
    remote_ip:
        description:
            - Identifies a network flow by the remote IP address.
        required: false
    transport:
        description: >
            - Specifies a Layer 4 protocol to be used. It is typically used in combination with I(local_port) to
            identify the service that needs special attention.
        required: false
    local_port:
        description:
            - Identifies a service specified by the local port.
        required: false
    dsfield:
        description: >
            - Identifies the 8-bit differentiated services field (as defined in
            RFC 2474). The optional dsfield_mask is used to state the bits of interest in
            the differentiated services field when comparing with the dsfield
            value. Both values must be in hexadecimal.
        required: false
    maxbw:
        description: >
            - Sets the full duplex bandwidth for the flow. The bandwidth is
            specified as an integer with one of the scale suffixes(K, M, or G
            for Kbps, Mbps, and Gbps). If no units are specified, the input
            value will be read as Mbps.
        required: false
    priority:
        description:
            - Sets the relative priority for the flow.
        required: false
        default: 'medium'
        choices: [ 'low', 'medium', 'high' ]
    temporary:
        description:
            - Specifies that the configured flow is temporary. Temporary
              flows do not persist across reboots.
        required: false
        default: false
        type: bool
    state:
        description:
            - Create/delete/enable/disable an IP address on the network interface.
        required: false
        default: present
        choices: [ 'absent', 'present', 'resetted' ]
s�
# Limit SSH traffic to 100M via vnic0 interface
- flowadm:
    link: vnic0
    flow: ssh_out
    transport: tcp
    local_port: 22
    maxbw: 100M
    state: present

# Reset flow properties
- flowadm:
    name: dns
    state: resetted

# Configure policy for EF PHB (DSCP value of 101110 from RFC 2598) with a bandwidth of 500 Mbps and a high priority.
- flowadm:
    link: bge0
    dsfield: '0x2e:0xfc'
    maxbw: 500M
    priority: high
    flow: efphb-flow
    state: present
s�
name:
    description: flow name
    returned: always
    type: str
    sample: "http_drop"
link:
    description: flow's link
    returned: if link is defined
    type: str
    sample: "vnic0"
state:
    description: state of the target
    returned: always
    type: str
    sample: "present"
temporary:
    description: flow's persistence
    returned: always
    type: bool
    sample: "True"
priority:
    description: flow's priority
    returned: if priority is defined
    type: str
    sample: "low"
transport:
    description: flow's transport
    returned: if transport is defined
    type: str
    sample: "tcp"
maxbw:
    description: flow's maximum bandwidth
    returned: if maxbw is defined
    type: str
    sample: "100M"
local_Ip:
    description: flow's local IP address
    returned: if local_ip is defined
    type: str
    sample: "10.0.0.42"
local_port:
    description: flow's local port
    returned: if local_port is defined
    type: int
    sample: 1337
remote_Ip:
    description: flow's remote IP address
    returned: if remote_ip is defined
    type: str
    sample: "10.0.0.42"
dsfield:
    description: flow's differentiated services value
    returned: if dsfield is defined
    type: str
    sample: "0x2e:0xfc"
N(t
AnsibleModulettcptudptsctpticmpticmpv6tlowtmediumthightlocal_ipt	remote_ipt	transportt
local_porttdsfieldtmaxbwtprioritytFlowcB`s�eZd�Zed��Zed��Zed��Zed��Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
RS(cC`s�||_|jd|_|jd|_|jd|_|jd|_|jd|_|jd|_|jd|_|jd|_	|jd	|_
|jd
|_|jd|_it
d6t
d	6|_dS(NtnametlinkRRRRRRRt	temporarytstate(tmoduletparamsRRRRRRRRRRRtFalset_needs_updating(tselfR((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pyt__init__�s	cC`sdt|�kodkSS(Nii��(tint(tclstport((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pyt
is_valid_port�scC`s�|jd�dkr-|jd�\}}n|}t|jd��dkr�ytjtj|�Wntjk
r|tSXd|ko�dkns�tSnOytjtj|�Wntjk
r�tSXd|ko�dkns�tSt	S(Nt/it.iii i�(
tcounttsplittlentsockett	inet_ptontAF_INETterrorRtAF_INET6tTrue(R$tipt
ip_addresstnetmask((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pytis_valid_address�s"cC`s*yt|d�Wntk
r%tSXtS(Ni(R#t
ValueErrorRR1(R$tnumber((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pytis_hex�s

cC`s�d}|jd�dkr1|jd�d}n|jd�\}}|r�dt|d�koldknr�dt|d�ko�dknr�tSdt|d�ko�dkns�tStS(Nt:iiii�(tNoneR)R*R#RR1(R$Rtdsmasktdsval((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pytis_valid_dsfield�sR%cC`se|jjd�g}|jd�|j|j�|jj|�\}}}|dkr]tStSdS(Ntflowadms	show-flowi(Rtget_bin_pathtappendRtrun_commandR1R(R!tcmdtrct_((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pytflow_existss
cC`s[|jjd�g}|jd�|jr;|jd�n|j|j�|jj|�S(NR>sremove-flows-t(RR?R@RRRA(R!RB((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pytdelete_flows
	cC`s�|jjd�g}|jd�|jd�|j|j�|jrl|jd�|jd|j�n|jr�|jd�|jd|j�n|jr�|jd�|jd|j�n|jr�|jd�|jd|j�n|jr |jd�|jd	|j�n|j	rM|jd
�|jd|j	�n|j
rz|jd
�|jd|j
�n|jr�|jd
�n|j|j�|jj
|�S(NR>sadd-flows-ls-as	local_ip=s
remote_ip=s
transport=slocal_port=sdsfield=s-psmaxbw=s	priority=s-t(RR?R@RRRRRRRRRRRA(R!RB((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pytcreate_flows:

	
	
	
	
	
	
	
	cC`si|jjd�g}|jd�|jd�|jd�|jd�|j|j�|jj|�S(NR>s
show-flowprops-cs-osproperty,possible(RR?R@RRA(R!RB((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pyt_query_flow_propsFs



cC`s�|j�\}}}t}|dkr�d�|j�jd�D�}x�|D]�\}}|dkr�|j|kr�|jjit|6�t}qM|dkrM|j|krM|jjit|6�t}qMqMW|S|j	j
dd|d|d	|�dS(
Nics`s|]}|jd�VqdS(R9N(R*(t.0tline((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pys	<genexpr>Wss
RRtmsgs(Error while checking flow properties: %ststderrRC(RHRtrstripR*RR tupdateR1RRt	fail_json(R!RCtoutterrtNEEDS_UPDATINGt
propertiestproptvalue((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pytflow_needs_udpatingQs	
cC`s�|jjd�g}|jd�|jr\|jdr\|jd�|jd|j�n|jr�|jdr�|jd�|jd|j�n|jr�|jd�n|j|j�|jj|�S(	NR>sset-flowpropRs-psmaxbw=Rs	priority=s-t(	RR?R@RR RRRRA(R!RB((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pytupdate_flowgs


	(t__name__t
__module__R"tclassmethodR&R5R8R=RERFRGRHRVRW(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pyR�s			
	
	)		c!C`s	tdtdtdtddg�dtdt�dtdt�dtdt�d	tdtd
t�dtdt�dtdt�d
tdt�dtdtddd
t�dtdtdd�dtdtddd
dddg��dd(d)d*d+d,d-d.d/d0g	dt�}t|�}d}d}d}i}|j|d<|j	|d<|j
|d<|jrx|j|d<n|jr�|j|d
<n|j
r�|j
|d<n|jr�|j|j�r�|j|d<q�n|jr|j|j�r|j|d<qn|jr|j|d	<n|jrj|j|j�rJ|j|d<qj|jdd|jdd�n|jr�|j|j�r�|j|d<q�|jdd|jdd�n|j	dkr?|j�r�|jr�|jd t�n|j�\}}}|d!kr<|jdd"|d|jd#|d|�q<q�np|j	dkr%|j�s�|jrv|jd t�n|j�\}}}|d!kr"|jdd$|d|jd#|d|�q"q�|j�r�|j�\}}}|d!kr"|jdd%|d|jd#|d|�q"q�n�|j	dkr�|j�r�|jr\|jd t�n|j�\}}}|d!kr�|jdd&|d|jd#|d|�q�q�n|dkr�t|d <n
t|d <|r�||d'<n|r�||d#<n|j|�dS(1Nt
argument_specRtrequiredtaliasestflowRRRRtchoicesRRRRtdefaultRRttypetboolRtpresenttabsenttresettedtmutually_exclusivetsupports_check_modetRKsInvalid port: %sRCisInvalid dsfield: %stchangedisError while deleting flow: "%s"RLsError while creating flow: "%s"sError while updating flow: "%s"s Error while resetting flow: "%s"tstdout(RR(RR(RR(RR(RR(RR(RR(RR(RR(RtdictR1RtSUPPORTED_TRANSPORTStSUPPORTED_PRIORITIESRR:RRRRRRRR5RRRR&RORR=REt
check_modet	exit_jsonRFRGRVRWt
reset_flow(RR^RCRPRQtresult((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pytmain{s�			


							
	
				
			



t__main__(t
__future__RRRRat
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR,tansible.module_utils.basicRRlRmtSUPPORTED_ATTRIBUTEStSUPPORTPED_PROPERTIEStobjectRRrRX(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pyt<module>s"


H:�	�

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