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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
dd
lmZddlmZddlmZddlmZdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: onyx_vlan
version_added: "2.5"
author: "Samer Deeb (@samerd) Alex Tabachnik (@atabachnik)"
short_description: Manage VLANs on Mellanox ONYX network devices
description:
  - This module provides declarative management of VLANs
    on Mellanox ONYX network devices.
options:
  name:
    description:
      - Name of the VLAN.
  vlan_id:
    description:
      - ID of the VLAN.
  aggregate:
    description: List of VLANs definitions.
  purge:
    description:
      - Purge VLANs not defined in the I(aggregate) parameter.
    default: no
    type: bool
  state:
    description:
      - State of the VLAN configuration.
    default: present
    choices: ['present', 'absent']
s�
- name: configure VLAN ID and name
  onyx_vlan:
    vlan_id: 20
    name: test-vlan

- name: remove configuration
  onyx_vlan:
    state: absent
s�
commands:
  description: The list of configuration mode commands to send to the device
  returned: always.
  type: list
  sample:
    - vlan 20
    - name test-vlan
    - exit
(tdeepcopy(t
AnsibleModule(t	iteritems(tremove_default_spec(tBaseOnyxModule(tshow_cmdtOnyxVlanModulecB`steZeZed��Zed��Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�ZRS(
cC`s@tdtdd�dtdd�dtddd	dd
g��S(Ntvlan_idttypetinttnametstrtstatetdefaulttpresenttchoicestabsent(tdict(tcls((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pyt_get_element_specNscC`s-t|�}tdt�|d<t|�|S(NtrequiredR(RRtTrueR(Rtelement_spectaggregate_spec((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pyt_get_aggregate_specVs
c	C`s�|j�}|j|�}tdtddddd|�dtdtdd	��}|j|�d
dgg}d
dgg}td|d|d
|dt�|_dS(s module initialization
        t	aggregateRtlisttelementsRtoptionstpurgeRtboolRt
argument_spectrequired_one_oftmutually_exclusivetsupports_check_modeN(RR RtFalsetupdateR	Rt_module(tselfRRR'R(R)((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pytinit_module_s	
cC`sC|r?dt|�ko#dknr?|jjdd�ndS(Nii�tmsgs"vlan id must be between 1 and 4094(RR-t	fail_json(R.tvalue((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pytvalidate_vlan_idrs)cC`st�|_|jj}|jd�}|jdt�|_|r�x�|D]}}x4|D],}|j|�dkrV||||<qVqVW|j||�|j	�}t
|d�|d<|jj|�qIWnDi|dd6|dd6|dd6}|j|�|jj|�dS(NR!R%RRR(R"t_required_configR-tparamstgetR+t_purgetNonetvalidate_param_valuestcopyRtappend(R.t
module_paramsR!titemtkeytreq_itemR5((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pytget_required_configvs&


cC`s=|j|jkr|d}ni|d6|j|d�d6S(NiRtNameR(t_os_versiontONYX_API_VERSIONtget_config_attr(R.Rt	vlan_data((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pyt_create_vlan_data�s

cC`st|jd�S(Ns	show vlan(R
R-(R.((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pyt_get_vlan_config�scC`s�|j�|_t�|_|j�}|s1dSxZt|�D]L\}}yt|�}Wntk
rpq>nX|j||�|j|<q>WdS(N(	t_get_os_versionRBRt_current_configRGR
Rt
ValueErrorRF(R.tvlan_configRRE((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pytload_current_config�s
cC`s�t�}xw|jD]l}|d}|d}|dkrb||jkr|jjd|�qq|j|�|j||�qW|jr�x7|jD])}||kr�|jjd|�q�q�WndS(NRRRs
no vlan %s(tsetR4RIt	_commandsR;taddt_generate_vlan_commandsR7(R.t	req_vlanstreq_confRR((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pytgenerate_commands�s	


	cC`s�|jj|i�}|sB|jjd|�|jjd�n|d}|jd�}|r�||kr�|jjd||f�q�n,|dk	r�|r�|jjd|�q�ndS(Nsvlan %stexitRsvlan %s name %ssvlan %s no name(RIR6RNR;R8(R.RRRt	curr_vlantreq_namet	curr_name((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pyRP�s
 (t__name__t
__module__R+R7tclassmethodRR R/R3R@RFRGRLRSRP(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pyRKs								cC`stj�dS(s+ main entry point for module execution
    N(Rtmain(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pyR[�st__main__N(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR:Rtansible.module_utils.basicR	tansible.module_utils.sixR
t)ansible.module_utils.network.common.utilsRt&ansible.module_utils.network.onyx.onyxRR
RR[RX(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_vlan.pyt<module>s"


{	

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