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

�
�Udac@sidd6dgd6dd6ZdZdZdZd	d
lZd	dlmZmZmZd	dlm	Z	m
Z
d	d
lmZd	dl
mZidd6dd6dd6dd6dd6Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed kre�nd
S(!s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�
---
module: nxos_evpn_vni
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages Cisco EVPN VXLAN Network Identifier (VNI).
description:
  - Manages Cisco Ethernet Virtual Private Network (EVPN) VXLAN Network
    Identifier (VNI) configurations of a Nexus device.
author: Gabriele Gerbino (@GGabriele)
notes:
  - Tested against NXOSv 7.3.(0)D1(1) on VIRL
  - default, where supported, restores params default value.
  - RD override is not permitted. You should set it to the default values
    first and then reconfigure it.
  - C(route_target_both), C(route_target_import) and
    C(route_target_export valid) values are a list of extended communities,
    (i.e. ['1.2.3.4:5', '33:55']) or the keywords 'auto' or 'default'.
  - The C(route_target_both) property is discouraged due to the inconsistent
    behavior of the property across Nexus platforms and image versions.
    For this reason it is recommended to use explicit C(route_target_export)
    and C(route_target_import) properties instead of C(route_target_both).
  - RD valid values are a string in one of the route-distinguisher formats,
    the keyword 'auto', or the keyword 'default'.
options:
  vni:
    description:
      - The EVPN VXLAN Network Identifier.
    required: true
  route_distinguisher:
    description:
      - The VPN Route Distinguisher (RD). The RD is combined with
        the IPv4 or IPv6 prefix learned by the PE router to create a
        globally unique address.
    required: true
  route_target_both:
    description:
      - Enables/Disables route-target settings for both import and
        export target communities using a single property.
  route_target_import:
    description:
      - Sets the route-target 'import' extended communities.
  route_target_export:
    description:
      - Sets the route-target 'export' extended communities.
  state:
    description:
      - Determines whether the config should be present or not
        on the device.
    default: present
    choices: ['present','absent']
s�
- name: vni configuration
  nxos_evpn_vni:
    vni: 6000
    route_distinguisher: "60:10"
    route_target_import:
      - "5000:10"
      - "4100:100"
    route_target_export: auto
    route_target_both: default
s�
commands:
    description: commands sent to the device
    returned: always
    type: list
    sample: ["evpn", "vni 6000 l2", "route-target import 5001:10"]
i����N(t
get_configtload_configtrun_commands(tnxos_argument_spect
check_args(t
AnsibleModule(tCustomNetworkConfigtvnitrdtroute_distinguishersroute-target bothtroute_target_bothsroute-target importtroute_target_importsroute-target exporttroute_target_exportcCs^tj|�}tjdj|�tj�}d}||krZ|j|�jd�}n|S(Ns(?:{0}\s)(?P<value>.*)$ttvalue(tPARAM_TO_COMMAND_KEYMAPtgettretcompiletformattMtsearchtgroup(targtconfigtmoduletcommandt
command_reR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pyt	get_valueqsc	Cs�|j�}g}tj|�}tjdj|�tj�}xN|D]F}d}||j�krF|j|�j	d�}|j
|�qFqFW|S(Ns(?:{0}\s)(?P<value>.*)$RR(t
splitlinesRRRRRRtstripRRtappend(	RRRtsplitted_configt
value_listRR tlineR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pytget_route_target_valuezs
cCs�i}tdddt|��}ddj|jd�g}|j|�}|r�xX|D]P}|dkrY|dkr�t|||�||<q�t|||�||<qYqYWtd�|j�D��}|s�|}n|jd|d<n|S(	Ntindentitcontentstevpns
vni {0} l2RRcss'|]\}}|r||fVqdS(N((t.0tktv((sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pys	<genexpr>�s(	RRRtparamstget_sectionR!R(tdicttitems(RtargstexistingtnetcfgtparentsRRtexisting_fix((sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pytget_existing�s
	cCsFi}x9|D]1}|j|�}|r
|j|�||<q
q
W|S(N(R(tkey_mapttabletnew_dicttkeytnew_key((sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pyt
apply_key_map�s
cCsTi}xG|j�D]9\}}|dkrB||d<||d<q|||<qW|S(Nsroute-target bothsroute-target exportsroute-target import(R2(tproposed_commandstnew_proposedR<R((sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pytfix_proposed�s

c
Cs�t�}t�}tt|�}tt|�}|jd�rNt|�}nx|j�D]�\}}|jd�r�|dgkr�|j|�}	|	r�x*|	D]}
|jdj||
��q�Wq�nt	|t�s�|g}nx�|D]�}
|
dkrq�n|rV|
|j|j
dd�j
dd��kro|jdj||
��qoq�|jdj||
��q�W|j|j
dd�j
dd��rYxZ|j|j
dd�j
dd��D].}||kr�|jdj||��q�q�WqYq[|dkr:|j|�}	|	rY|jdj||	��qYq[dj||�}|j|�q[W|r�d	d
j|jd�g}n||fS(Nsroute-target bothsroute-targettdefaults
no {0} {1}t-t_t s{0} {1}R+s
vni {0} l2R(tlistR>RRRAR2t
startswithR$Rt
isinstancetreplaceR/(
RR4tproposedtcommandsR6R?texisting_commandsR<Rtexisting_valuettargettexiR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pyt
state_present�sF		
#
-'.&cCs,dj|jd�g}dg}||fS(Ns
no vni {0} l2RR+(RR/(RR4RJRKR6((sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pytstate_absent�s	c
s�tdtdtdd�dtdtdd�dtdtdd�dtdtdd�d	tdtdd�d
tddd
gdddt��}|jt�td|dt�}t�}t||�tdtd|�}|jd
}t	j
��t|��}t�fd�|jj�D��}g}g}i}	xu|j�D]g\}
}|
dkrL|dkryt}n|dkr�t}n|j
|
�|kr�||	|
<q�qLqLW|dkr�t|||	�\}}n-|d
kr|rt|||	�\}}n|rotdd�}|j|d|�|j�}|jsbt||�t|d<n||d<n
g|d<|j|�dS(NRtrequiredttypetstrRRRFRRtstatetchoicestpresenttabsentRBt
argument_spectsupports_check_modetchangedtwarningsc3s9|]/\}}|dk	r|�kr||fVqdS(N(tNone(R,R-R.(R3(sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pys	<genexpr>�s	ttruetfalseR)iR6RK(R1tTruetFalsetupdateRR
RFR	R/RtkeysR8R2RRPRQRtaddt
items_textt
check_modeRt	exit_json(
RYRR\tresultsRUR4t
proposed_argsRKR6RJR<Rt	candidate((R3sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pytmain�sR$
	

%			



t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRt&ansible.module_utils.network.nxos.nxosRRRRR	tansible.module_utils.basicR
t*ansible.module_utils.network.common.configRRR!R(R8R>RARPRQRkt__name__(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.pyt<module>s4


6
								0		6

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