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/netapp_e_iscsi_interface.pyc

�
�Udac@`s	ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
ddlZdd
lmZddlmZmZddlmZidd6dd6Zdefd��YZd�Zedkre�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�

---
module: netapp_e_iscsi_interface
short_description: NetApp E-Series manage iSCSI interface configuration
description:
    - Configure settings of an E-Series iSCSI interface
version_added: '2.7'
author: Michael Price (@lmprice)
extends_documentation_fragment:
    - netapp.eseries
options:
    controller:
        description:
            - The controller that owns the port you want to configure.
            - Controller names are presented alphabetically, with the first controller as A,
             the second as B, and so on.
            - Current hardware models have either 1 or 2 available controllers, but that is not a guaranteed hard
             limitation and could change in the future.
        required: yes
        choices:
            - A
            - B
    name:
        description:
            - The channel of the port to modify the configuration of.
            - The list of choices is not necessarily comprehensive. It depends on the number of ports
              that are available in the system.
            - The numerical value represents the number of the channel (typically from left to right on the HIC),
              beginning with a value of 1.
        required: yes
        aliases:
            - channel
    state:
        description:
            - When enabled, the provided configuration will be utilized.
            - When disabled, the IPv4 configuration will be cleared and IPv4 connectivity disabled.
        choices:
            - enabled
            - disabled
        default: enabled
    address:
        description:
            - The IPv4 address to assign to the interface.
            - Should be specified in xx.xx.xx.xx form.
            - Mutually exclusive with I(config_method=dhcp)
    subnet_mask:
        description:
            - The subnet mask to utilize for the interface.
            - Should be specified in xx.xx.xx.xx form.
            - Mutually exclusive with I(config_method=dhcp)
    gateway:
        description:
            - The IPv4 gateway address to utilize for the interface.
            - Should be specified in xx.xx.xx.xx form.
            - Mutually exclusive with I(config_method=dhcp)
    config_method:
        description:
            - The configuration method type to use for this interface.
            - dhcp is mutually exclusive with I(address), I(subnet_mask), and I(gateway).
        choices:
            - dhcp
            - static
        default: dhcp
    mtu:
        description:
            - The maximum transmission units (MTU), in bytes.
            - This allows you to configure a larger value for the MTU, in order to enable jumbo frames
              (any value > 1500).
            - Generally, it is necessary to have your host, switches, and other components not only support jumbo
              frames, but also have it configured properly. Therefore, unless you know what you're doing, it's best to
              leave this at the default.
        default: 1500
        aliases:
            - max_frame_size
    log_path:
        description:
            - A local path to a file to be used for debug logging
        required: no
notes:
    - Check mode is supported.
    - The interface settings are applied synchronously, but changes to the interface itself (receiving a new IP address
      via dhcp, etc), can take seconds or minutes longer to take effect.
    - This module will not be useful/usable on an E-Series system without any iSCSI interfaces.
    - This module requires a Web Services API version of >= 1.3.
s�
    - name: Configure the first port on the A controller with a static IPv4 address
      netapp_e_iscsi_interface:
        name: "1"
        controller: "A"
        config_method: static
        address: "192.168.1.100"
        subnet_mask: "255.255.255.0"
        gateway: "192.168.1.1"
        ssid: "1"
        api_url: "10.1.1.1:8443"
        api_username: "admin"
        api_password: "myPass"

    - name: Disable ipv4 connectivity for the second port on the B controller
      netapp_e_iscsi_interface:
        name: "2"
        controller: "B"
        state: disabled
        ssid: "{{ ssid }}"
        api_url: "{{ netapp_api_url }}"
        api_username: "{{ netapp_api_username }}"
        api_password: "{{ netapp_api_password }}"

    - name: Enable jumbo frames for the first 4 ports on controller A
      netapp_e_iscsi_interface:
        name: "{{ item | int }}"
        controller: "A"
        state: enabled
        mtu: 9000
        config_method: dhcp
        ssid: "{{ ssid }}"
        api_url: "{{ netapp_api_url }}"
        api_username: "{{ netapp_api_username }}"
        api_password: "{{ netapp_api_password }}"
      loop:
        - 1
        - 2
        - 3
        - 4
s�
msg:
    description: Success message
    returned: on success
    type: str
    sample: The interface settings have been updated.
enabled:
    description:
        - Indicates whether IPv4 connectivity has been enabled or disabled.
        - This does not necessarily indicate connectivity. If dhcp was enabled without a dhcp server, for instance,
          it is unlikely that the configuration will actually be valid.
    returned: on success
    sample: True
    type: bool
N(tpformat(t
AnsibleModule(trequestteseries_host_argument_spec(t	to_nativesapplication/jsonsContent-TypetAccepttIscsiInterfacecB`sMeZd�Zed��Zd�Zd�Zd�Zd�Zd�Z	RS(cC`s�t�}|jtdtdddtdddg�dtdd	d
dg�dtdddtd
ddddg�dtdddt�dtdddt�dtdddt�dtdddtd
ddddg�dtdd	d
ddtd
dg�dtdddt��	�ddddggg}td|dtd|�|_|jj}|d|_|d|_	|d|_
|d|_|d|_|d|_
|d|_|d|_|d|_|d|_td|d d!|d!d"|d#�|_|jj|_t�|_t�|_|d}tj|jj�|_|r}tjd$tjd%|d&d'd(d)�n|jjd*�s�|jd*7_n|j
dks�|j
d+kr�|jjd,d-�n|jdkrt |j|j
|jg�r|jjd,d.�nt!j"d/�}|jrY|j#|j�rY|jjd,d0�n|j
r�|j#|j
�r�|jjd,d1�n|jr�|j#|j�r�|jjd,d2�ndS(3Nt
controllerttypetstrtrequiredtchoicestAtBtnametinttaliasestchanneltstatetdefaulttenabledtdisabledtaddresstsubnet_masktgatewayt
config_methodtdhcptstatictmtui�tmax_frame_sizetlog_patht
argument_spectsupports_check_modetrequired_iftssidtapi_urlturl_passwordtapi_passwordtvalidate_certsturl_usernametapi_usernametleveltfilenametfilemodetwtformatsS%(relativeCreated)dms %(levelname)s %(module)s.%(funcName)s:%(lineno)d
 %(message)st/i(#tmsgs@The provided mtu is invalid, it must be > 1500 and < 9000 bytes.saA config_method of dhcp is mutually exclusive with the address, subnet_mask, and gateway options.s"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}s/An invalid ip address was provided for address.s3An invalid ip address was provided for subnet_mask.s/An invalid ip address was provided for gateway.($RtupdatetdicttTruetFalseR	tmoduletparamsRRR$RRRR R!R*turltcredst
check_modet	post_bodytlisttcontrollerstloggingt	getLoggert	__class__t__name__t_loggertbasicConfigtDEBUGtendswitht	fail_jsontanytretcompiletmatch(tselfR'R)targsR&t
address_regex((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pyt__init__�sb	!''$











	
-cC`s�t�}y0t|jd|jdt|j�\}}Wn9tk
rt}|jjdd|jt	|�f�nXg|D] }|ddkr||d^q|}|S(NsFstorage-systems/%s/graph/xpath-filter?query=/controller/hostInterfacestheadersR7sFFailed to retrieve defined host interfaces. Array Id [%s]. Error [%s].t
interfaceTypetiscsi(
RBR
R>R*tHEADERSR?t	ExceptionR<RLR(RQtifacestrcterrtiface((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pyt
interfaces�s	$-cC`s�t�}y0t|jd|jdt|j�\}}Wn9tk
rt}|jjdd|jt	|�f�nX|j
�i}td�}x.|D]&}t|�}|||<|d7}q�W|S(s�Retrieve a mapping of controller labels to their references
        {
            'A': '070000000000000000000001',
            'B': '070000000000000000000002',
        }
        :return: the controllers defined on the system
        s:storage-systems/%s/graph/xpath-filter?query=/controller/idRUR7s>Failed to retrieve controller list! Array Id [%s]. Error [%s].Ri(
RBR
R>R*RXR?RYR<RLRtsorttordtchr(RQRCR[R\tcontrollers_dicttiRtlabel((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pytget_controllerss 	$


c`s��j}x?|D]7}|d�jkr�j�j|dkr|SqWtt�fd�|D���}�jjdd�jdj|�f�dS(NRtcontrollerIdc3`s9|]/}�j�j|dkrt|d�VqdS(RfRN(RCRR(t.0R](RQ(s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pys	<genexpr>'sR7sEThe requested channel of %s is not valid. Valid channels include: %s.s, (	R^RRCRtsortedtsetR<RLtjoin(RQR^R]tchannels((RQs[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pytfetch_target_interface s	
-"cC`sDtd|d�}t}|jjd|j�|jjd|dd|j�|jdkr�t�}|ds�t}tg|d<n|j|d	d
dkr�t}|jg|d<n|jdkr�|dd
}|d|jkrt}|jg|d<n|d|j	kr1t}|j	g|d<n|j
dk	rl|d|j
krlt}|j
g|d<n|dddkr�t}dg|d<q�n?|dddkr�t}|jtdtgddg��n||d<n)|drt}tdtg�|d<n|jjd|�|jjdt
|��||fS(NtiscsiInterfacetidsRequested state=%s.s'config_method: current=%s, requested=%stipv4Datatipv4AddressConfigMethodRtipv4Enabledt
interfaceDatatethernetDatatmaximumFramePayloadSizeR#tipv4AddressDatatipv4Addresstipv4SubnetMasktipv4GatewayAddresstconfigStatict
configDhcptsettingssUpdate required ?=%ssUpdate body: %s(R9R;RHtinfoRR!R:R$RRR tNoneR8R(RQttarget_ifacetbodytupdate_requiredR{Ro((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pytmake_update_body-sL	
"

c	C`s�|j�|_|j|jkrM|jjdddj|jj���n|j�}|j|�\}}|r�|j	r�y�|j
d|j}t|dddt
j|�dtd	d
dt|j�\}}|dkr|d
dkr|jjdd|j|f�n5|dkrH|jjdd|jt|�f�n|jjd�Wq�tk
r�}|jjdd|jt|�f�q�Xn|j�}|jjddd|d|d�dS(NR7s?The provided controller name is invalid. Valid controllers: %s.s, s5storage-systems/%s/symbol/setIscsiInterfacePropertiestmethodtPOSTtdataRUttimeouti,t
ignore_errorsi�tretcodetbusyt3s�The interface is currently busy (probably processing a previously requested modification request). This operation cannot currently be completed. Array Id [%s]. Error [%s].i�s:Failed to modify the interface! Array Id [%s]. Error [%s].s&Update request completed successfully.sQConnection failure: we failed to modify the interface! Array Id [%s]. Error [%s].s)The interface settings have been updated.tchangedRRq(R�R�(ReRCRR<RLRjtkeysRlR�R@R>R*R
tjsontdumpsRXR:R?RRHtdebugRYt	exit_json(	RQtiface_beforeR�RR>R[tresultR\tiface_after((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pyR8^s8*cO`s|j�dS(N(R8(RQRRtkwargs((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pyt__call__�s(
RGt
__module__RTtpropertyR^ReRlR�R8R�(((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pyR�s	G		
	1	&cC`st�}|�dS(N(R(R]((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pytmain�s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR�RDtpprintRRNtansible.module_utils.basicR	tansible.module_utils.netappR
Rtansible.module_utils._textRRXtobjectRR�RG(((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_interface.pyt<module>s*


V*
�	

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