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

�
�Udac@`sSddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZytdd
l
mZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
ridd
lmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZd efd!��YZ d"efd#��YZ!d$efd%��YZ"d&�Z#e$d'krOe#�nd(S()i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_tunnel
short_description: Manage tunnels on a BIG-IP
description:
  - Manages tunnels on a BIG-IP. Tunnels are usually based upon a tunnel profile which
    defines both default arguments and constraints for the tunnel.
  - Due to this, this module exposes a number of settings that may or may not be related
    to the type of tunnel you are working with. It is important that you take this into
    consideration when declaring your tunnel config.
  - If a specific tunnel does not support the parameter you are considering, the documentation
    of the parameter will usually make mention of this. Otherwise, when configuring that
    parameter on the device, the device will notify you.
version_added: 2.7
options:
  name:
    description:
      - Specifies the name of the tunnel.
    type: str
    required: True
  description:
    description:
      - Description of the tunnel.
    type: str
  profile:
    description:
      - Specifies the profile to associate with the tunnel for handling traffic.
      - Depending on your selection, other settings become available or disappear.
      - This parameter may not be changed after it is set.
    type: str
  key:
    description:
      - When applied to a GRE tunnel, this value specifies an optional field in the GRE header,
        used to authenticate the source of the packet.
      - When applied to a VXLAN or Geneve tunnel, this value specifies the Virtual Network
        Identifier (VNI).
      - When applied to an NVGRE tunnel, this value specifies the Virtual Subnet Identifier (VSID).
      - When creating a new tunnel, if this parameter is supported by the tunnel profile but not
        specified, the default value is C(0).
    type: int
  local_address:
    description:
      - Specifies the IP address of the local endpoint of the tunnel.
    type: str
  remote_address:
    description:
      - Specifies the IP address of the remote endpoint of the tunnel.
      - For C(dslite), C(fec) (when configuring the FEC tunnel for receiving traffic only),
        C(v6rd) (configured as a border relay), or C(map), the tunnel must have an unspecified
        remote address (any).
    type: str
  secondary_address:
    description:
      - Specifies a non-floating IP address for the tunnel, to be used with host-initiated traffic.
    type: str
  mtu:
    description:
      - Specifies the maximum transmission unit (MTU) of the tunnel.
      - When creating a new tunnel, if this parameter is supported by the tunnel profile but not
        specified, the default value is C(0).
      - The valid range is from C(0) to C(65515).
    type: int
  use_pmtu:
    description:
      - Enables or disables the tunnel to use the PMTU (Path MTU) information provided by ICMP
        NeedFrag error messages.
      - If C(yes) and the tunnel C(mtu) is set to C(0), the tunnel will use the PMTU information.
      - If C(yes) and the tunnel C(mtu) is fixed to a non-zero value, the tunnel will use the
        minimum of PMTU and MTU.
      - If C(no), the tunnel will use fixed MTU or calculate its MTU using tunnel encapsulation
        configurations.
    type: bool
  tos:
    description:
      - Specifies the Type of Service (TOS) value to insert in the encapsulating header of
        transmitted packets.
      - When creating a new tunnel, if this parameter is supported by the tunnel profile but not
        specified, the default value is C(preserve).
      - When C(preserve), the system copies the TOS value from the inner header to the outer header.
      - You may also specify a numeric value. The possible values are from C(0) to C(255).
    type: str
  auto_last_hop:
    description:
      - Allows you to configure auto last hop on a per-tunnel basis.
      - When creating a new tunnel, if this parameter is supported by the tunnel profile but not
        specified, the default is C(default).
      - When C(default), means that the system uses the global auto-lasthop setting to send back
        the request.
      - When C(enabled), allows the system to send return traffic to the MAC address that transmitted
        the request, even if the routing table points to a different network or interface. As a
        result, the system can send return traffic to clients even when there is no matching route.
    type: str
    choices:
      - default
      - enabled
      - disabled
  traffic_group:
    description:
      - Specifies the traffic group to associate with the tunnel.
      - This value cannot be changed after it is set. This is a limitation of BIG-IP.
    type: str
  mode:
    description:
      - Specifies how the tunnel carries traffic.
      - When creating a new tunnel, if this parameter is supported by the tunnel profile but not
        specified, the default is C(bidirectional).
      - When C(bidirectional), specifies that the tunnel carries both inbound and outbound traffic.
      - When C(inbound), specifies that the tunnel carries only incoming traffic.
      - When C(outbound), specifies that the tunnel carries only outgoing traffic.
    type: str
    choices:
      - bidirectional
      - inbound
      - outbound
  transparent:
    description:
      - Specifies that the tunnel operates in transparent mode.
      - When C(yes), you can inspect and manipulate the encapsulated traffic flowing through the BIG-IP
        system.
      - A transparent tunnel terminates a tunnel while presenting the illusion that the tunnel transits
        the device unmodified (that is, the BIG-IP system appears as if it were an intermediate router
        that simply routes IP traffic through the device).
    type: bool
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
  state:
    description:
      - When C(present), ensures that the tunnel exists.
      - When C(absent), ensures the tunnel is removed.
    type: str
    choices:
      - present
      - absent
    default: present
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
s�
- name: Create a VXLAN tunnel
  bigip_tunnel:
    name: openshift-tunnel
    local_address: 192.1681.240
    key: 0
    secondary_address: 192.168.1.100
    mtu: 0
    use_pmtu: yes
    tos: preserve
    auto_last_hop: default
    traffic_group: traffic-group-1
    state: present
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s�
param1:
  description: The new param1 value of the resource.
  returned: changed
  type: bool
  sample: true
param2:
  description: The new param2 value of the resource.
  returned: changed
  type: str
  sample: Foo is bar
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tf5_argument_spec(tflatten_boolean(ttransform_namet
Parametersc
B`s�eZidd6dd6dd6dd6dd	6d
d6Zddd
dddd	ddddddg
Zddddddd
dddddd
g
Zdddddddd
ddddd
g
ZRS(t
auto_last_hoptautoLasthopt
local_addresstlocalAddresstremote_addresst
remoteAddresstsecondary_addresstsecondaryAddresstuse_pmtutusePmtut
traffic_groupttrafficGrouptdescriptiontkeytmtutprofilettransparentttostmode(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR�s\
		t
ApiParameterscB`seZRS((R%R&(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR+stModuleParameterscB`sDeZed��Zed��Zed��Zed��ZRS(cC`s7t|jd�}|dkr#dS|dkr3dSdS(NR"tyestenabledtnotdisabled(Rt_values(tselftresult((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR"s
cC`s7t|jd�}|dkr#dS|dkr3dSdS(NRR-R.R/R0(RR1(R2R3((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRs
cC`s.|jddkrdSt|j|jd�S(NR!(R1tNoneR
t	partition(R2((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR!#scC`sE|jddkrdS|jddkr.dSt|j|jd�S(NRttnone(R6R7(R1R4R
R5(R2((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR)s
(R%R&tpropertyR"RR!R(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR,stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R)tgetattrt_filter_paramst	Exception(R2R3t
returnable((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyt	to_return3s
(R%R&R>(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR92st
UsableChangescB`seZRS((R%R&(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR?>stReportableChangescB`s&eZed��Zed��ZRS(cC`st|jd�}|S(NR"(RR1(R2R3((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR"CscC`st|jd�}|S(NR(RR1(R2R3((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRHs(R%R&R8R"R(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR@Bst
DifferencecB`sDeZdd�Zd�Zd�Zed��Zed��ZRS(cC`s||_||_dS(N(twantthave(R2RBRC((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyt__init__Os	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R:tAttributeErrort_Difference__default(R2tparamR3((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pytcompareSs

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R:RBRCRE(R2RGtattr1tattr2((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyt	__defaultZs
cC`sA|jjdkrdS|jj|jjkr=td��ndS(Ns,'profile' cannot be changed after it is set.(RBR!R4RCR(R2((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR!cs
cC`si|jjdkrdS|jjdkr>|jjdkr>dS|jj|jjkretd��ndS(NR6s2'traffic_group' cannot be changed after it is set.(R6N(RBRR4RCR(R2((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRls$N(	R%R&R4RDRHRFR8R!R(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRANs
				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(tgetR4RMR
RNtclientR,RBR+RCR?tchanges(R2targstkwargs((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRDys
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRN(RR)R:RBR4R?RQ(R2tchangedR((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyt_set_changed_options�s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(NRN(RARBRCRR*tdictRHR4t
isinstancetupdateR?RQtTruetFalse(R2tdiffR*RTtktchange((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(R^RYRZ(R2R3((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyt
should_update�scC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRNRT(RZRVRBtstateR`RaR@RQR>RXt_announce_deprecations(R2RTR3Rbt
reportableRQ((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pytexec_module�s	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRPRMt	deprecate(R2R3twarningstwarning((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRc�s


cC`s$|j�r|j�S|j�SdS(N(texistsRXtcreate(R2((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR`�s
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns.https://{0}:{1}/mgmt/tm/net/tunnels/tunnel/{2}tservertserver_porti�tcode(tformatRPtproviderRRBR5tnametapiROtjsont
ValueErrorRZRRY(R2turitresptresponse((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRm�s


+cC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRCR_RZRMt
check_modeRYtupdate_on_device(R2((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRX�s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RMR|RYtremove_from_deviceRmR(R2((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pytremove�s
cC`s(|j�|jjrtS|j�tS(N(RURMR|RYtcreate_on_device(R2((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRn�s


cC`s�|jj�}|jj|d<|jj|d<dj|jjd|jjd�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j��n|dS(
NRtR5s+https://{0}:{1}/mgmt/tm/net/tunnels/tunnel/RoRpRvRqi�i�tmessagetselfLink(i�i�(RQt
api_paramsRBRtR5RrRPRsRutpostRvRwRtstrtcontent(R2RNRxRyRztex((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR��s 
cC`s�|jj�}dj|jjd|jjdt|jj|jj��}|jj	j
|d|�}y|j�}Wn%tk
r�}t
t|���nXd|kr�|ddkr�d|kr�t
|d��q�t
|j��ndS(Ns.https://{0}:{1}/mgmt/tm/net/tunnels/tunnel/{2}RoRpRvRqi�R�(RQR�RrRPRsRRBR5RtRutpatchRvRwRR�R�(R2RNRxRyRzR�((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR}�s

cC`s|j�r|j�StS(N(RmRRZ(R2((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRas
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
Sd|kr�|ddkr�d|kr�t|d��q�t|j��ndS(Ns.https://{0}:{1}/mgmt/tm/net/tunnels/tunnel/{2}RoRpi�Rqi�R�(
RrRPRsRRBR5RtRutdeleteRRYRR�(R2RxRz((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR~s

cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j
��ntd|�S(Ns.https://{0}:{1}/mgmt/tm/net/tunnels/tunnel/{2}RoRpRqi�R�RN(RrRPRsRRBR5RtRuRORvRwRR�R�R+(R2RxRyRzR�((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR{"s

(R%R&RDRUR^R_ReRcR`RmRXRRnR�R}RaR~R{(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRLxs 																tArgumentSpeccB`seZd�ZRS(c&C`s2t|_tdtdd�dt�dt�dtdd�d	t�d
t�dt�dtdd�d
tdd�dt�dtddddg�dt�dtddddg�dtdd�dtdddddg�dtddd td!gf��}i|_|jjt�|jj|�dS("NRttrequiredttrueR!RRttypetintRRRR RtboolR#RtchoicestdefaultR.R0RR$t
bidirectionaltinboundtoutboundR"RbR`RaR5tCommontfallbacktF5_PARTITION(RYtsupports_check_modeRVR	t
argument_specRXR(R2R�((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyRD7s6									(R%R&RD(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyR�6scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RMRg(
R�RR�R�RLRet	exit_jsonRt	fail_jsonR�(tspecRMtmmtresultsR�((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pytmainZs		t__main__N(%t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commonRR+R,R9R?R@tobjectRARLR�R�R%(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_tunnel.pyt<module>sJ


�

; *�$	

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