Anons79 Mini Shell

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

�
�Udac@sidd6dgd6dd6ZdZdZdZd	d
lZd	dlmZd	dlmZm	Z	m
Z
d	d
lmZd	dlm
Z
d	dlmZd	dlmZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zedkre�nd
S(s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�
---
module: nxos_static_route
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages static route configuration
description:
  - Manages static route configuration
author: Gabriele Gerbino (@GGabriele)
notes:
  - Tested against NXOSv 7.3.(0)D1(1) on VIRL
  - If no vrf is supplied, vrf is set to default.
  - If C(state=absent), the route will be removed, regardless of the
    non-required parameters.
options:
  prefix:
    description:
      - Destination prefix of static route.
    required: true
    aliases:
      - address
  next_hop:
    description:
      - Next hop address or interface of static route.
        If interface, it must be the fully-qualified interface name.
    required: true
  vrf:
    description:
      - VRF for static route.
    default: default
  tag:
    description:
      - Route tag value (numeric) or keyword 'default'.
  route_name:
    description:
      - Name of the route or keyword 'default'. Used with the name parameter on the CLI.
  pref:
    description:
      - Preference or administrative difference of route (range 1-255) or keyword 'default'.
    aliases:
      - admin_distance
  aggregate:
    description: List of static route definitions
    version_added: 2.5
  track:
    description:
      - Track value (range 1 - 512). Track must already be configured on the device before adding the route.
    version_added: "2.8"
  state:
    description:
      - Manage the state of the resource.
    choices: ['present','absent']
    default: 'present'
su
- nxos_static_route:
    prefix: "192.168.20.64/24"
    next_hop: "192.0.2.3"
    route_name: testing
    pref: 100
s�
commands:
    description: commands sent to the device
    returned: always
    type: list
    sample: ["ip route 192.168.20.0/24 192.0.2.3 name testing 100"]
i����N(tdeepcopy(t
get_configtload_configtrun_commands(tnxos_argument_spec(t
AnsibleModule(tCustomNetworkConfig(tremove_default_speccCs�|d|d}}|dkr0g}d}n%dj|�g}dj|d�}tdd	d
t|d|g��}t|�jd�}	g|	D]}
|
j�^q�}	d
j||d�}g|	D]}
|
j|�r�|
^q�}t|||�}
g}|dkr)|r)d|dg}nB|dkrk|
|	krk|r[d|dg}n|j|
�n|r�|j	|d|�ndS(Ntstatetvrftdefaults | include '^ip route'svrf context {0}s( | section '{0}' | include '^  ip route'itindentitcontentstflagss
sip route {0} {1}tnext_hoptabsentsno tpresenttparents(
tformatRRtstrtsplittstript
startswithtset_route_commandtappendtadd(tmodulet	candidatetprefixtwantR
RRRtnetcfgtroutestit
prefix_and_nhtexistingtproposedtcommands((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_static_route.pytreconcile_candidategs*	$(cCs�dj|�}t}d}y7t|i|d6dd6�}tjd|d�}Wntk
rfdSX||kr|t}n|S(Ns{0}s
show tracktcommandttexttoutputs
Track\s+(\d+)i(RtFalseRtretfindallt
IndexErrortNonetTrue(Rtctracktcheck_trackttrack_existsR+tbodytmatch((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_static_route.pytget_configured_track�s
	cCsLdj||d�}|dr�|dtdd�kr�t||d�rf|dj|d�7}q�|jddj|d��q�|jdd	�n|d
r�|d
dkr�|dj|d
�7}n|d
r|d
dkr|d
dkr|dj|d
�7}qn|drH|ddkrH|dj|d�7}n|S(Nsip route {0} {1}Rttrackiis
 track {0}tmsgs"Track {0} not configured on devices+Invalid track number, valid range is 1-512.t
route_nameRs	 name {0}ttagt0s tag {0}tprefs {0}(RtrangeR9t	fail_json(R!twRt	route_cmd((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_static_route.pyR�s
 
 cCshd}x)td|d�D]}|d|>O}qWd|d@d?|d@d?|d	@d
?|d@f}|S(Nii is%d.%d.%d.%dI�ii�ii�ii�(R@(tmasktbitsR%((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_static_route.pytget_dotted_mask�s
2cCs\|jd�}|jd�}gtdd�D]*}tt||�t||�@�^q.S(Nt.ii(RR@Rtint(taddresstnetmasktx((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_static_route.pytget_network_start�scCsI|jd�}t|�dkr:|jddd|�nxy|D]q}yAt|�dksnt|�dkr�|jddd|�nWqAtk
r�|jdd	d|�qAXqAWyAt|�dks�t|�d
kr�|jddd|�nWn'tk
r |jdd
d|�nXtt|��}djt||��S(NRGiR;sIncorrect address format.RIii�s#Address may contain invalid values.s'Address may contain non-integer values.i sIncorrect mask value.RDs$Mask may contain non-integer values.(RtlenRARHt
ValueErrorRFtjoinRL(RIRDRtoctectstoctectRJ((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_static_route.pytnetwork_from_string�s$
$
$
cCs�|jd�}|d}t|�dkrD|jddd|�n_t|�dkr�|d}t|||�}t|�dt|�}n|dtd�}|S(	Nt/iiR;sIncorrect address format.RIii (RRMRARRR(RR!tsplitted_prefixRIRDRtnormalized_prefix((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_static_route.pytnormalize_prefix�s

cCsg}|jjd�}|r�x�|D]Y}x7|D]/}|j|�dkr2|j|||<q2q2W|j�}|j|�q%Wn}|ji|jdd6|jdd6|jdd6|jdd6|jdd6|jdd6|jdd6|jd	d	6�|S(
Nt	aggregateR!RRR=R<R?R
R:(tparamstgetR2tcopyR(RtobjRWtitemtkeytd((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_static_route.pytmap_params_to_obj�s&

	c
Cstdtddddg�dtdd�dtdddd�d	tdd�d
tdd�dtddddg�d
tdddgdd�dtdd��}t|�}tdt�|d<tdt�|d<t|�tdtddddd|��}|j|�|jt�td|dt�}t�}itd6gd6}|rd||d<nt	|�}x�|D]�}t
||d�}tdd�}	t||	||�|j
rw|	rw|	j�}	t||	�|dj|	�t|d<qwqwW|j|�dS( NR!ttypeRtaliasesRIRRRR=R<R?tadmin_distanceR
tchoicesRRR:RHtrequiredRWtlisttelementstdicttoptionst
argument_spectsupports_check_modetchangedR)twarningsRi(RgRR3RtupdateR	R
ReR.R_RVRR*t
check_modet
items_textRtextendt	exit_json(
telement_spectaggregate_specRiRRltresultR"RBR!R ((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_static_route.pytmain�sF


		


t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR/RZRt&ansible.module_utils.network.nxos.nxosRRRR	tansible.module_utils.basicR
t*ansible.module_utils.network.common.configRt)ansible.module_utils.network.common.utilsRR*R9RRFRLRRRVR_Rut__name__(((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_static_route.pyt<module>s.


8									3

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