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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
lm
Z
ddlmZy�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
rddl mZddl!mZddl!mZddl!mZddl!mZddl!mZddl"mZddl"mZddl#mZddl#mZddl#mZnXdefd��YZ$de$fd��YZ%de$fd��YZ&d e$fd!��YZ'd"e$fd#��YZ(d$e$fd%��YZ)d&e*fd'��YZ+d(e*fd)��YZ,d*e*fd+��YZ-d,�Z.e/d-kr�e.�ndS(.i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatust	certifiedtsupported_bys

---
module: bigip_static_route
short_description: Manipulate static routes on a BIG-IP
description:
  - Manipulate static routes on a BIG-IP.
version_added: 2.5
options:
  name:
    description:
      - Name of the static route.
    type: str
    required: True
  description:
    description:
      - Descriptive text that identifies the route.
    type: str
  destination:
    description:
      - Specifies an IP address for the static entry in the routing table.
        When creating a new static route, this value is required.
      - This value cannot be changed once it is set.
    type: str
  netmask:
    description:
      - The netmask for the static route. When creating a new static route, this value
        is required.
      - This value can be in either IP or CIDR format.
      - This value cannot be changed once it is set.
    type: str
  gateway_address:
    description:
      - Specifies the router for the system to use when forwarding packets
        to the destination host or network. Also known as the next-hop router
        address. This can be either an IPv4 or IPv6 address. When it is an
        IPv6 address that starts with C(FE80:), the address will be treated
        as a link-local address. This requires that the C(vlan) parameter
        also be supplied.
    type: str
  vlan:
    description:
      - Specifies the VLAN or Tunnel through which the system forwards packets
        to the destination. When C(gateway_address) is a link-local IPv6
        address, this value is required.
    type: str
  pool:
    description:
      - Specifies the pool through which the system forwards packets to the
        destination.
    type: str
  reject:
    description:
      - Specifies that the system drops packets sent to the destination.
    type: bool
  mtu:
    description:
      - Specifies a specific maximum transmission unit (MTU).
    type: str
  route_domain:
    description:
      - The route domain id of the system. When creating a new static route, if
        this value is not specified, a default value of C(0) will be used.
      - This value cannot be changed once it is set.
    type: int
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
    version_added: 2.6
  state:
    description:
      - When C(present), ensures that the static route exists.
      - When C(absent), ensures that the static does not exist.
    type: str
    choices:
      - present
      - absent
    default: present
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
s=
- name: Create static route with gateway address
  bigip_static_route:
    destination: 10.10.10.10
    netmask: 255.255.255.255
    gateway_address: 10.2.2.3
    name: test-route
    provider:
      password: secret
      server: lb.mydomain.come
      user: admin
      validate_certs: no
  delegate_to: localhost
s�
vlan:
  description: Whether the banner is enabled or not.
  returned: changed
  type: str
  sample: true
gateway_address:
  description: Whether the banner is enabled or not.
  returned: changed
  type: str
  sample: true
destination:
  description: Whether the banner is enabled or not.
  returned: changed
  type: str
  sample: true
route_domain:
  description: Route domain of the static route.
  returned: changed
  type: int
  sample: 1
netmask:
  description: Netmask of the destination.
  returned: changed
  type: str
  sample: 255.255.255.255
pool:
  description: Whether the banner is enabled or not.
  returned: changed
  type: str
  sample: true
partition:
  description: The partition that the static route was created on.
  returned: changed
  type: str
  sample: Common
description:
  description: Whether the banner is enabled or not.
  returned: changed
  type: str
  sample: true
reject:
  description: Whether the banner is enabled or not.
  returned: changed
  type: str
  sample: true
N(t
AnsibleModule(tenv_fallback(t
BOOLEANS_TRUE(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tf5_argument_spec(ttransform_name(tis_valid_ip(tipv6_netmask_to_cidr(t
ip_address(t
ip_network(tip_interfacet
Parametersc	B`s�eZidd6dd6dd6dd6Zdddd	d
ddddg	Zdddd	ddd
ddg	Zdddddd	d
gZd
�Zed��ZRS(tvlanttmInterfacetgateway_addresstgwtdestinationtnetworktrejectt	blackholetdescriptiontpooltmtutroute_domaintnetmaskcC`s@i}x$|jD]}t||�||<qW|j|�}|S(N(treturnablestgetattrt_filter_params(tselftresultt
returnable((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyt	to_return�s
cC`s|jdtkrtSdS(NR(t_valuesR
tTrue(R'((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR�s(	t__name__t
__module__tapi_mapt
updatablesR$tapi_attributesR*tpropertyR(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR�s@
				tModuleParameterscB`sbeZed��Zed��Zed��Zed��Zed��Zed��ZRS(cC`s.|jddkrdSt|j|jd�S(NR(R+tNoneRt	partition(R'((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR�scC`s�|jddkrdSyfd|jdkrJ|jdjd�d}n
|jd}tdt|��t|jd�SWntk
r�td��nXdS(NRt%iu%ss1The provided gateway_address is not an IP address(R+R4tsplitRtstrt
ValueErrorR(R'taddr((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRs

cC`s.|jddkrdSt|jd�}|S(NR"(R+R4tint(R'R(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR"scC`s�|jddkrdS|jdjd�r=d|jd<n|jdjd�rcd|jd<nydtdt|j��}|jr�djt|j�|j|j	�Sdjt|j�|j	�SWnt
k
r�td	��nXdS(
NRtdefaults	0.0.0.0/0s
default-inet6s::/0u%ss{0}%{1}/{2}s{0}/{1}s-The provided destination is not an IP address(R+R4t
startswithRR8tdestination_ipR"tformattnetwork_addresst	prefixlenR9R(R'tip((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRs	" 
cC`sO|jdrKtdj|jd|j��}djt|j�|j�SdS(NRu{0}/{1}s{0}/{1}(R+RR?R#R8R@RA(R'RB((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR>*s
"cC`s
|jddkrdSyCt|jd�}d|koDdknrM|Std��Wntk
rmnXt|jd�s�tdj|���ntdjt|jd���}|j	dkr�t
dt|jd��}|j}nt|jd�}|S(	NR#ii�sNThe provided netmask must be between 0 and 32 for IPv4, or 0 and 128 for IPv6.s8The provided netmask {0} is neither in IP or CIDR formatu{0}iu
0.0.0.0/%s(
R+R4R;RR9RR?RR8tversionRRAR(R'R(R:RB((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR#0s&

"(	R-R.R2RRR"RR>R#(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR3�st
ApiParameterscB`s>eZed��Zed��Zed��Zd�ZRS(cC`sS|jddkrdSd}tj||jd�}|rOt|jd��SdS(NRs#([0-9a-zA-Z\:\-\.]+%(?P<rd>[0-9]+))trdi(R+R4tretsearchR;tgroup(R'tpatterntmatches((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR"VscC`s�|jddkrdS|j�}yQd}tj|d|�}tdt|��}djt|j�|j	�SWnt
k
r�td��nXdS(NRs(?P<rd>%[0-9]+)tu%ss{0}/{1}s.The provided destination is not an IP address.(R+R4tdestination_to_networkRFtsubRR8R?R@RAR9R(R'RRIR:RB((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR>`s 
cC`s/|j�}tdt|��}t|j�S(Nu%s(RLRR8R;RA(R'RRB((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR#pscC`s�|jd}|jd�r;dj|jd�d�}n^|jd�ridj|jd�d�}n0|jd�r�d	}n|jd
�r�d}n|S(NRsdefault%s
0.0.0.0%{0}/0R6isdefault-inet6%s::%{0}/0s
default-inet6s::/0R<s	0.0.0.0/0(R+R=R?R7(R'R((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRLvs
		(R-R.R2R"R>R#RL(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRDUs
tChangescB`seZRS((R-R.(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRN�st
UsableChangescB`seZRS((R-R.(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRO�stReportableChangescB`seZRS((R-R.(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRP�st
DifferencecB`sSeZdd�Zd�Zd�Zed��Zed��Zed��Z	RS(cC`s||_||_dS(N(twantthave(R'RRRS((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R%tAttributeErrort_Difference__default(R'tparamR(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R%RRRSRU(R'RWtattr1tattr2((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyt	__default�s
cC`sA|jjdkrdS|jj|jjkr=td��ndS(Ns_The destination cannot be changed. Delete and recreate the static route if you need to do this.(RRR>R4RSR(R'((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR�s
cC`si|jjdkrdS|jjdkr>|jjdkr>dS|jj|jjkretd��ndS(Nis#You cannot change the route domain.(RRR"R4RSR(R'((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR"�s$cC`sA|jjdkrdS|jj|jjkr=td��ndS(Ns[The netmask cannot be changed. Delete and recreate the static route if you need to do this.(RRR#R4R>RSR(R'((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR#�s
N(
R-R.R4RTRXRVR2RR"R#(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRQ�s			
	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�|_d|_td|jj�|_t	�|_
dS(Ntmoduletparams(tgetR4R]RR^tclientRSR3RRROtchanges(R'targstkwargs((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRT�s
	cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NR^(RR$R%RRR4RORa(R'tchangedtkey((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyt_set_changed_options�scC`s�t|j|j�}tj}t�}xR|D]J}|j|�}|dkrUq.q.|dkrn||d<q.|||<q.W|r�td|�|_	t
StS(NR#R"taddressR^(snetmasksroute_domain(RQRRRSRR0tdictRXR4RORaR,tFalse(R'tdiffR0Rdtktchange((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyt_update_changed_options�s		

cC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentR^Rd(RiRhRRtstateRnRoRPRaR*tupdatet_announce_deprecations(R'RdR(Rpt
reportableRa((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pytexec_module�s	

cC`sH|jdg�}x/|D]'}|jjd|dd|d�qWdS(Nt
__warningstmsgRC(tpopR]t	deprecate(R'R(twarningstwarning((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRr�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/route/{2}tservertserver_porti�tcode(R?R`tproviderRRRR5tnametapiR_tjsonR9RiRR,(R'turitresptresponse((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pytexists�s


+cC`s$|j�r|j�S|j�SdS(N(R�Rqtcreate(R'((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRn
s
c`s�ddddg}�j��jjdkr=td��n�jjdkr^td��nt�fd�|D��r�tdd	j|���n�jj	r�t
S�j�t
S(
NR RRRs:destination must be specified when creating a static routes6netmask must be specified when creating a static routec3`s'|]}t�j|�dkVqdS(N(R%RRR4(t.0tv(R'(sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pys	<genexpr>ss!You must specify at least one of s, (RfRRRR4RR#talltjoinR]t
check_modeR,tcreate_on_device(R'trequired_resources((R'sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR�s

cC`s|j�}|rtStS(N(RmR,Ri(R'R(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyt
should_update'scC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRSR�RiR]R�R,tupdate_on_device(R'((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRq-s
cC`s|jj�}|jdd�dj|jjd|jjdt|jj|jj	��}|jj
j|d|�}y|j�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j��ndS(	NRs%https://{0}:{1}/mgmt/tm/net/route/{2}R{R|R�R}i�tmessage(RRt
api_paramsRwR4R?R`R~RR5RR�tpatchR�R9RR8tcontent(R'R^R�R�R�tex((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR�6s

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/route/{2}R{R|R}i�R�R^(R?R`R~RRRR5RR�R_R�R9RR8R�RD(R'R�R�R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR�Ms

cC`s�|jj�}|jj|d<|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(NRR5s"https://{0}:{1}/mgmt/tm/net/route/R{R|R�R}i�i�R�(i�i�(RRR�RR5R?R`R~R�tpostR�R9RR8R�(R'R^R�R�R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR�`s
cC`s|j�r|j�StS(N(R�tremoveRi(R'((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRots
cC`s9|jjrtS|j�|j�r5td��ntS(Ns!Failed to delete the static route(R]R�R,tremove_from_deviceR�R(R'((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR�ys
cC`sjdj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
SdS(Ns%https://{0}:{1}/mgmt/tm/net/route/{2}R{R|i�(R?R`R~RRRR5RR�tdeleteRR,(R'R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR��s

(R-R.RTRfRmRtRrR�RnR�R�RqR�R�R�RoR�R�(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR\�s 																tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dt�dt�dt�dt�dt�dt�d	t�d
tdd�d
tdddddg�dtdddtdgf�dtdd��}i|_|jjt�|jj|�ddd
gg|_dS(NRtrequiredRRR#RRR R!RttypetboolRpR<RntchoicesRoR5tCommontfallbacktF5_PARTITIONR"R;(R,tsupports_check_modeRhR	t
argument_specRqRtmutually_exclusive(R'R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyRT�s.										(R-R.RT(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyR��scC`s�t�}td|jd|jd|j�}y,td|�}|j�}|j|�Wn)tk
r�}|j	dt
|��nXdS(NR�R�R�R]Rv(R�RR�R�R�R\Rtt	exit_jsonRt	fail_jsonR8(tspecR]tmmtresultsR�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pytmain�s			t__main__(0t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRFtansible.module_utils.basicRR	t)ansible.module_utils.parsing.convert_boolR
t%library.module_utils.network.f5.bigipRt&library.module_utils.network.f5.commonRR
RRRt)library.module_utils.network.f5.ipaddressRRt%library.module_utils.compat.ipaddressRRRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont)ansible.module_utils.network.f5.ipaddresst%ansible.module_utils.compat.ipaddressRR3RDRNRORPtobjectRQR\R�R�R-(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_static_route.pyt<module>s^


T0
7\.4�!	

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