Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/f5/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyo

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZyTddlm
Z
dd
lmZddlmZddlmZddlmZWnaek
rddlm
Z
dd
lmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd ��YZ d!efd"��YZ!d#�Z"e#d$kr�e"�nd%S(&i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_trunk
short_description: Manage trunks on a BIG-IP
description:
  - Manages trunks on a BIG-IP.
version_added: 2.6
options:
  name:
    description:
      - Specifies the name of the trunk.
    type: str
    required: True
  interfaces:
    description:
      - The interfaces that are part of the trunk.
      - To clear the list of interfaces, specify an empty list.
    type: list
  description:
    description:
      - Description of the trunk.
    type: str
    version_added: 2.7
  link_selection_policy:
    description:
      - Specifies, once the trunk is configured, the policy that the trunk uses to determine
        which member link (interface) can handle new traffic.
      - When creating a new trunk, if this value is not specific, the default is C(auto).
      - When C(auto), specifies that the system automatically determines which interfaces
        can handle new traffic. For the C(auto) option, the member links must all be the
        same media type and speed.
      - When C(maximum-bandwidth), specifies that the system determines which interfaces
        can handle new traffic based on the members' maximum bandwidth.
    type: str
    choices:
      - auto
      - maximum-bandwidth
  frame_distribution_hash:
    description:
      - Specifies the basis for the hash that the system uses as the frame distribution
        algorithm. The system uses the resulting hash to determine which interface to
        use for forwarding traffic.
      - When creating a new trunk, if this parameter is not specified, the default is
        C(source-destination-ip).
      - When C(source-destination-mac), specifies that the system bases the hash on the
        combined MAC addresses of the source and the destination.
      - When C(destination-mac), specifies that the system bases the hash on the MAC
        address of the destination.
      - When C(source-destination-ip), specifies that the system bases the hash on the
        combined IP addresses of the source and the destination.
    type: str
    choices:
      - destination-mac
      - source-destination-ip
      - source-destination-mac
  lacp_enabled:
    description:
      - When C(yes), specifies that the system supports the link aggregation control
        protocol (LACP), which monitors the trunk by exchanging control packets over
        the member links to determine the health of the links.
      - If LACP detects a failure in a member link, it removes the link from the link
        aggregation.
      - When creating a new trunk, if this parameter is not specified, LACP is C(no).
      - LACP is disabled by default for backward compatibility. If this does not apply
        to your network, we recommend that you enable LACP.
    type: bool
  lacp_mode:
    description:
      - Specifies the operation mode for link aggregation control protocol (LACP),
        if LACP is enabled for the trunk.
      - When creating a new trunk, if this parameter is not specified, the default
        is C(active).
      - When C(active), specifies that the system periodically sends control packets
        regardless of whether the partner system has issued a request.
      - When C(passive), specifies that the system sends control packets only when
        the partner system has issued a request.
    type: str
    choices:
      - active
      - passive
  lacp_timeout:
    description:
      - Specifies the rate at which the system sends the LACP control packets.
      - When creating a new trunk, if this parameter is not specified, the default is
        C(long).
      - When C(long), specifies that the system sends an LACP control packet every 30 seconds.
      - When C(short), specifies that the system sends an LACP control packet every 1 seconds.
    type: str
    choices:
      - long
      - short
  qinq_ethertype:
    description:
      - Specifies the ether-type value used for the packets handled on this trunk when
        it is a member in a QinQ vlan.
      - The ether-type can be set to any string containing a valid hexadecimal 16 bits
        number, or any of the well known ether-types; C(0x8100), C(0x9100), C(0x88a8).
      - This parameter is not supported on Virtual Editions.
      - You should always wrap this value in quotes to prevent Ansible from interpreting
        the value as a literal hexadecimal number and converting it to an integer.
    type: raw
    version_added: 2.7
  state:
    description:
      - When C(present), ensures that the resource exists.
      - When C(absent), ensures the resource is removed.
    type: str
    choices:
      - present
      - absent
    default: present
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
sy
- name: Create a trunk on hardware
  bigip_trunk:
    name: trunk1
    interfaces:
      - 1.1
      - 1.2
    link_selection_policy: maximum-bandwidth
    frame_distribution_hash: destination-mac
    lacp_enabled: yes
    lacp_mode: passive
    lacp_timeout: short
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s�
lacp_mode:
  description: Operation mode for LACP if the lacp option is enabled for the trunk.
  returned: changed
  type: str
  sample: active
lacp_timeout:
  description: Rate at which the system sends the LACP control packets.
  returned: changed
  type: str
  sample: long
link_selection_policy:
  description:
    - LACP policy that the trunk uses to determine which member link (interface)
      can handle new traffic.
  returned: changed
  type: str
  sample: auto
frame_distribution_hash:
  description: Hash that the system uses as the frame distribution algorithm.
  returned: changed
  type: str
  sample: src-dst-ipport
lacp_enabled:
  description: Whether the system supports the link aggregation control protocol (LACP) or not.
  returned: changed
  type: bool
  sample: yes
interfaces:
  description: Interfaces that are part of the trunk.
  returned: changed
  type: list
  sample: ['int1', 'int2']
description:
  description: Description of the trunk.
  returned: changed
  type: str
  sample: My trunk
qinq_ethertype:
  description: Ether-type value used for the packets handled on this trunk when it is a member in a QinQ vlan.
  returned: changed
  type: str
  sample: 0x9100
(t
AnsibleModule(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(tcmp_simple_listt
ParameterscB`s�eZidd6dd6dd6dd6dd	6d
d6Zd	dddddd
dgZddddddd
d
gZddddddd
d
gZRS(t	lacp_modetlacpModetlacp_timeouttlacpTimeouttlink_selection_policytlinkSelectPolicytframe_distribution_hashtdistributionHashtlacp_enabledtlacptqinq_ethertypet
qinqEthertypet
interfacestdescription(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR�s>
		t
ApiParameterscB`s&eZed��Zed��ZRS(cC`s2|jddkrdS|jddkr.tStS(NRtenabled(t_valuestNonetTruetFalse(tself((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRs
cC`s>|jddkrdStt|jd��}|j�|S(NR(R%R&tlisttsettsort(R)tresult((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR	s

(RRtpropertyRR(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR#stModuleParameterscB`s&eZed��Zed��ZRS(cC`s`|jddkrdS|jddkr.dS|jddkrEdS|jddkr\dSdS(NRssource-destination-ipssrc-dst-ipportssource-destination-macssrc-dst-macsdestination-macsdst-mac(R%R&(R)((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRscC`s�|jddkrdSt|jd�dkrK|jdddkrKdSg|jdD]}t|�^qY}tt|��}|j�|S(NRiit(R%R&tlentstrR*R+R,(R)txR-((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRs0&
(RRR.RR(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR/stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R!tgetattrt_filter_paramst	Exception(R)R-t
returnable((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyt	to_return+s
(RRR9(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR4*st
UsableChangescB`seZed��ZRS(cC`s,|jddkrdS|jdr(dSdS(NRR$tdisabled(R%R&(R)((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR7s

(RRR.R(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR:6stReportableChangescB`s&eZed��Zed��ZRS(cC`s`|jddkrdS|jddkr.dS|jddkrEdS|jddkr\dSdS(NRssrc-dst-ipportssource-destination-ipssrc-dst-macssource-destination-macsdst-macsdestination-mac(R%R&(R)((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRAscC`s2|jddkrdS|jddkr.tStS(NRR$(R%R&R'R((R)((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRLs
(RRR.RR(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR<@st
DifferencecB`s5eZdd�Zd�Zd�Zed��ZRS(cC`s||_||_dS(N(twantthave(R)R>R?((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyt__init__Vs	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R5tAttributeErrort_Difference__default(R)tparamR-((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pytcompareZs

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R5R>R?RA(R)RCtattr1tattr2((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyt	__defaultas
cC`st|jj|jj�}|S(N(R
R>RR?(R)R-((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRjsN(RRR&R@RDRBR.R(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR=Us			t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(cO`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetR&RIR	RJtclientR/R>R#R?R:tchanges(R)targstkwargs((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR@qs
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRJ(RR!R5R>R&R:RM(R)tchangedtkey((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyt_set_changed_optionsxscC`s�t|j|j�}tj}t�}xX|D]P}|j|�}|dkrUq.q.t|t�rt|j	|�q.|||<q.W|r�t
d|�|_tSt
S(NRJ(R=R>R?RR"tdictRDR&t
isinstancetupdateR:RMR'R((R)tdiffR"RPtktchange((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(RYR'R((R)R-((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyt
should_update�scC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRJRP(R(RSR>tstateR[R\R<RMR9RUt_announce_deprecations(R)RPR-R]t
reportableRM((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pytexec_module�s	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRLRIt	deprecate(R)R-twarningstwarning((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR^�s


cC`s$|j�r|j�S|j�SdS(N(texistsRUtcreate(R)((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR[�s
cC`s|j�r|j�StS(N(RhtremoveR((R)((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR\�s
cC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceR?RZR(RIt
check_modeR'tupdate_on_device(R)((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRU�s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RIRlR'tremove_from_deviceRhR
(R)((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRj�s
cC`s|jjdkr,|jjidd6�n|jjdkrX|jjidd6�n|jjdkr�|jjitd6�n|jjdkr�|jjidd6�n|jjdkr�|jjidd	6�n|j	�|j
jr�tS|j
�tS(
NtautoRssource-destination-ipRRtactiveRtlongR(R>RR&RURRR(RRRRRIRlR'tcreate_on_device(R)((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRi�s

cC`s�dj|jjd|jjd|jj�}|jjj|�}y|j�}Wntk
rht	SX|j
dks�d|kr�|ddkr�t	StS(Ns%https://{0}:{1}/mgmt/tm/net/trunk/{2}tservertserver_porti�tcode(tformatRLtproviderR>tnametapiRKtjsont
ValueErrorR(RR'(R)turitresptresponse((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRh�s


+cC`s�|jj�}|jj|d<dj|jjd|jjd�}|jjj|d|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j
��ndS(NRxs"https://{0}:{1}/mgmt/tm/net/trunk/RsRtRzRui�i�i�tmessage(i�i�i�(RMt
api_paramsR>RxRvRLRwRytpostRzR{R
R2tcontent(R)RJR|R}R~tex((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRr�s
cC`s�|jj�}dj|jjd|jjd|jj�}|jjj|d|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j
��ndS(Ns%https://{0}:{1}/mgmt/tm/net/trunk/{2}RsRtRzRui�R(RMR�RvRLRwR>RxRytpatchRzR{R
R2R�(R)RJR|R}R~R�((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRms

cC`s[dj|jjd|jjd|jj�}|jjj|�}|jdkrWtSdS(Ns%https://{0}:{1}/mgmt/tm/net/trunk/{2}RsRti�(	RvRLRwR>RxRytdeleteRR'(R)R|R}((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRns

cC`s�dj|jjd|jjd|jj�}|jjj|�}y|j�}Wn%tk
r{}t	t
|���nXd|kr�|ddkr�d|kr�t	|d��q�t	|j��ntd|�S(Ns%https://{0}:{1}/mgmt/tm/net/trunk/{2}RsRtRui�RRJ(
RvRLRwR>RxRyRKRzR{R
R2R�R#(R)R|R}R~R�((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRks

(RRR@RRRYRZR`R^R[R\RURjRiRhRrRmRnRk(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyRHps 																
tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dtdd�dtddd	g�d
tdddd
g�dtdd�dtdddg�dtdddg�dt�dtdddddg�dtdd��
}i|_|jjt�|jj|�dS(NRxtrequiredRttypeR*RtchoicesRosmaximum-bandwidthRsdestination-macssource-destination-ipssource-destination-macRtboolRRptpassiveRtshortRqRR]tdefaultR[R\Rtraw(R'tsupports_check_modeRSt
argument_specRUR(R)R�((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR@2s&			(RRR@(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyR�1scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RIRb(
R�RR�R�RHR`t	exit_jsonR
t	fail_jsonR2(tspecRItmmtresultsR�((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pytmainLs		t__main__N($t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRt%library.module_utils.network.f5.bigipR	t&library.module_utils.network.f5.commonR
RRt'library.module_utils.network.f5.compareR
tImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont'ansible.module_utils.network.f5.compareRR#R/R4R:R<tobjectR=RHR�R�R(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_trunk.pyt<module>s@


u-
,
�	

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