Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/onyx/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddl
mZdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysG
---
module: onyx_vxlan
version_added: "2.8"
author: "Anas Badaha (@anasb)"
short_description: Configures Vxlan
description:
  - This module provides declarative management of Vxlan configuration
    on Mellanox ONYX network devices.
notes:
  - Tested on ONYX evpn_dev.031.
  - nve protocol must be enabled.
options:
  nve_id:
    description:
      - nve interface ID.
    required: true
  loopback_id:
    description:
      - loopback interface ID.
  bgp:
    description:
      - configure bgp on nve interface.
    type: bool
    default: true
  mlag_tunnel_ip:
    description:
      - vxlan Mlag tunnel IP
  vni_vlan_list:
    description:
      - Each item in the list has two attributes vlan_id, vni_id.
  arp_suppression:
    description:
      - A flag telling if to configure arp suppression.
    type: bool
    default: false
s�
- name: configure Vxlan
  onyx_vxlan:
    nve_id: 1
    loopback_id: 1
    bgp: yes
    mlag-tunnel-ip: 100.0.0.1
    vni_vlan_list:
      - vlan_id: 10
        vni_id: 10010
      - vlan_id: 6
        vni_id: 10060
    arp_suppression: yes
s�
commands:
  description: The list of configuration mode commands to send to the device.
  returned: always
  type: list
  sample:
    - interface nve 1
    - interface nve 1 vxlan source interface loopback 1
    - interface nve 1 nve controller bgp
    - interface nve 1 vxlan mlag-tunnel-ip 100.0.0.1
    - interface nve 1 nve vni 10010 vlan 10
    - interface nve 1 nve vni 10060 vlan 6
    - interface nve 1 nve neigh-suppression
    - interface vlan 6
    - interface vlan 10
N(t
AnsibleModule(tshow_cmd(tBaseOnyxModuletOnyxVxlanModulecB`s�eZejd�Zejd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�ZRS(s^loopback (\d+).*s^Interface NVE (\d+).*cC`s�tdtdt�dtdt��}tdtdt�dtdt�dtdtdd�d	tdd
�dtddd
dd|�dtdtdd��}t�}|j|�td|dt�|_dS(s initialize module
        tvlan_idttypetvni_idtnve_idtloopback_idtbgptdefaulttbooltmlag_tunnel_iptstrt
vni_vlan_listtlisttelementstdicttoptionstarp_suppressiont
argument_spectsupports_check_modeN(RtinttTruetFalsetupdateRt_module(tselft
vni_vlan_spectelement_specR((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pytinit_module^s 		
cC`s/|jj}t|�|_|j|j�dS(N(R"tparamsRt_required_configtvalidate_param_values(R#t
module_params((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pytget_required_configsscC`s�|d}|sdS|jd�}|jj|�}|r�t|jd��}||jd<t|�|jjd�kr�dSn|jd�|jd<|jd�}|dkr�t|jd	<n
t|jd	<|jd
�}|j	j|�}|r|jd�}t|�|jd<n|jd�|jd
<t
�}|jd<|j�}	|	dk	r�|	d}	|	r�xX|	D]M}
t
dt|	|
djd��d|	|
djd��|t|
�<quWq�ndS(NitheaderiRsMlag tunnel IPRsController modetBGPRsSource interfaceRsGlobal Neigh-Suppressiontglobal_neigh_suppressiontvni_vlan_mappingRtVNIRsNeigh Suppression(
tgettNVE_ID_REGEXtmatchRtgroupt_current_configR(RR tLOOPBACK_REGEXRt_show_nve_detailtNone(R#tvxlan_configt
nve_headerR3tcurrent_nve_idtcontroller_modetloopback_strRR/t
nve_detailR((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyt_set_vxlan_configxs<




cC`s"d}t|j|dtdt�S(Nsshow interfaces nvetjson_fmtt
fail_on_error(R	R"RR (R#tcmd((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyt_show_vxlan_config�scC`s7dj|jjd��}t|j|dtdt�S(Nsshow interface nve {0} detailRR@RA(tformatR(R1R	R"RR (R#RB((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyR7�scC`s2t�|_|j�}|r.|j|�ndS(N(RR5RCR?(R#R9((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pytload_current_config�scC`s�|jjd�}|jjd�}|dkr@|j|�n)||kri|j|�|j|�n|jjd�}|dk	r�|jjd�}|r�||kr�|jjdj|��q�n|jjd�}|dk	r(|jjd�}||kr(|jjdj||��q(n|jjd�}|dk	r�|jjd�}||kr�|jjdj||��q�n|jjd�}	|jjd	�}
|	dk	r�|j	|	||
�ndS(
NRRs$interface nve {0} nve controller bgpRs6interface nve {0} vxlan source interface loopback {1} Rs*interface nve {0} vxlan mlag-tunnel-ip {1}RR(
R(R1R5R8t_add_nve_commandst_add_no_nve_commandst	_commandstappendRDt_generate_vni_vlan_cmds(R#RR;Rtcurr_bgpRtcurr_loopback_idRtcurr_mlag_tunnel_ipRR((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pytgenerate_commands�s8
cC`s�|jjd�}|tkrF|dkrF|jjdj|��n|jjd�}|dkr�x'|D]G}|jd�}|jd�}|j|||�|j||�qkWn�x�|D]�}|jd�}|jd�}|j|�}	|	dkr%|j|||�|j||�q�|	jd�}
|	jd�}t	|
�|krk|j|||�n|dkr�|j||�q�q�WdS(	NR.tEnables'interface nve {0} nve neigh-suppressionR/RRRtDisable(
R5R1RRHRIRDR8t_add_vni_vlan_cmdst_add_arp_suppression_cmdsR(R#RRRtcurrent_global_arp_suppressiontcurrent_vni_vlan_mappingtvni_vlanRRt
currt_vlan_idtcurrent_vni_idtcurrent_arp_suppression((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyRJ�s.

cC`s|jjdj|��dS(Nsno interface nve {0}(RHRIRD(R#R;((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyRG�scC`s-|jjdj|��|jjd�dS(Nsinterface nve {0}texit(RHRIRD(R#R((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyRF�scC`s#|jjdj|||��dS(Ns&interface nve {0} nve vni {1} vlan {2}(RHRIRD(R#RRR((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyRQ�scC`s<|tkr8|jjdj|��|jjd�ndS(Nsinterface vlan {0}RY(RRHRIRD(R#RR((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyRR�s(t__name__t
__module__tretcompileR6R2R&R+R?RCR7RERNRJRGRFRQRR(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyRYs			'				#	!			cC`stj�dS(s+ main entry point for module execution
    N(Rtmain(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyR^st__main__(t
__future__RRRR
t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR\tansible.module_utils.basicRt&ansible.module_utils.network.onyx.onyxR	R
RR^RZ(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vxlan.pyt<module>s


&�	

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