Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/netapp/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pyo

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
dd
ljjZddlmZddlmZej�Zydd
lZWnek
r�eZnXdefd��YZd�Zedkre�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys

module: na_elementsw_vlan

short_description: NetApp Element Software Manage VLAN
extends_documentation_fragment:
    - netapp.solidfire
version_added: '2.7'
author: NetApp Ansible Team (@carchi8py) <[email protected]>
description:
- Create, delete, modify VLAN

options:

    state:
      description:
      - Whether the specified vlan should exist or not.
      choices: ['present', 'absent']
      default: present

    vlan_tag:
      description:
      - Virtual Network Tag
      required: true

    name:
      description:
      - User defined name for the new VLAN
      - Name of the vlan is unique
      - Required for create

    svip:
      description:
      - Storage virtual IP which is unique
      - Required for create

    address_blocks:
      description:
      - List of address blocks for the VLAN
      - Each address block contains the starting IP address and size for the block
      - Required for create

    netmask:
      description:
      - Netmask for the VLAN
      - Required for create

    gateway:
      description:
      - Gateway for the VLAN

    namespace:
      description:
      - Enable or disable namespaces
      type: bool

    attributes:
      description:
      - Dictionary of attributes with name and value for each attribute

sO
- name: Create vlan
  na_elementsw_vlan:
    state: present
    name: test
    vlan_tag: 1
    svip: "{{ ip address }}"
    netmask: "{{ netmask }}"
    address_blocks:
      - start: "{{ starting ip_address }}"
        size: 5
      - start: "{{ starting ip_address }}"
        size: 5
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"

- name: Delete Lun
  na_elementsw_vlan:
    state: absent
    vlan_tag: 1
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
s

(t
AnsibleModule(t	to_nativeN(tNetAppModule(tNaElementSWModulet
ElementSWVlancB`sMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s! class to handle VLAN operations cC`s�tj�|_|jjtdtdtdddgdd�dtdtdd	�d
tdtdd	�dtdtdd	�dtdtdd	�d
tdtdd	�dtdtdd�dtdtdd�dtdtdd��	�td|jdt�|_t	tkr(|jj
dd�ntjd|j�|_t
�|_|jj|jj�|_t|j�|_|jjd�dk	r�|jdj|jjdd��n|jjdd�|jd<dS(sG
            Setup Ansible parameters and ElementSW connection
        tstatetrequiredtchoicestpresenttabsenttdefaulttnamettypetstrtvlan_tagtsviptnetmasktgatewayt	namespacetboolt
attributestdicttaddress_blockstlistt
argument_spectsupports_check_modetmsgs)Unable to import the SolidFire Python SDKtmoduletsourcetna_elementsw_vlanN(tnetapp_utilstontap_sf_host_argument_specR tupdateRtFalsetTrueRR#t
HAS_SF_SDKt	fail_jsontcreate_sf_connectiontelemR
t	na_helpertset_parameterstparamst
parametersRtelementsw_helpertgettNonetset_element_attributes(tself((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pyt__init__zs0		&c`s�ddddg}t�fd�|D��tkrN�jjdd|�ndd	g}xG�jdD]8}d|ks�d	|krh�jjdd
|�qhqhWdS(sO
            Validate if all required keys are present before creating
        RRRRc3`s$|]}|�jj�kVqdS(N(R2tkeys(t.0titem(R7(sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pys	<genexpr>�sR"s;One or more required fields %s for creating VLAN is missingtstarttsizes<One or more required fields %s for address blocks is missingN(tallR)R#R,R2(R7t
required_keystaddr_blk_fieldstaddress((R7sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pyt
validate_keys�s"cC`s�ya|j�|jj�}x$dddddgD]
}||=q2W|jjd|jd|�WnCtjjk
r�}|jj	dd|jdd	t
|��nXd
S(s
            Add VLAN
        tusernamethostnametpasswordR
Rtvirtual_network_tagR"sError creating VLAN %st	exceptionN(RBR2tcopyR.tadd_virtual_networkt	solidfiretcommontApiServerErrorR#R,R	(R7t
create_paramstkeyterr((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pytcreate_network�s
!cC`shy|jjd|jd�WnCtjjk
rc}|jjdd|jddt|��nXdS(s!
            Remove VLAN
        RFRR"sError deleting VLAN %sRGN(	R.tremove_virtual_networkR2RJRKRLR#R,R	(R7RO((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pytdelete_network�scC`sky!|jjd|jd|�WnCtjjk
rf}|jjdd|jddt|��nXdS(s%
            Modify the VLAN
        RFRR"sError modifying VLAN %sRGN(	R.tmodify_virtual_networkR2RJRKRLR#R,R	(R7tmodifyRO((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pytmodify_network�s!cC`s�|jjd|jd�}t�}x�|jD]�}|dk	r/|j|d<t�|d<x6|jD]+}|dj	i|j
d6|jd6�qeW|j|d<|j
|d<|j|d	<|j|d
<|j|d<|Sq/WdS(
s}
            Check existing VLANs
            :return: vlan details if found, None otherwise
            :type: dict
        RFRRRR<R=RRRRRN(R.tlist_virtual_networksR2Rtvirtual_networksR5RRRtappendR<R=RRRRR(R7tvlanstvlan_detailstvlanRA((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pytget_network_details�s"	








cC`s�|j�}|jj||j�}|jj||j�}|dkrU|j�n/|dkrn|j�n|r�|j|�n|jj	d|jj
�dS(s@
            Call create / delete / modify vlan methods
        tcreatetdeletetchangedN(R\R/t
get_cd_actionR2tget_modified_attributesRPRRRUR#t	exit_jsonR_(R7tnetworkt	cd_actionRT((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pytapply�s

(
t__name__t
__module__t__doc__R8RBRPRRRUR\Re(((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pyRws	'					cC`st�}|j�dS(s Apply vlan actions N(RRe(tnetwork_obj((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pytmain�s	t__main__( t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRtansible.module_utils._textR	tansible.module_utils.netapptmodule_utilstnetappR&t"ansible.module_utils.netapp_moduleR
t,ansible.module_utils.netapp_elementsw_moduleRt
has_sf_sdkR+tsolidfire.commonRJtImportErrorR)tobjectRRjRf(((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_vlan.pyt<module>s*


?

�	

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