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

�
�Udac@sidd6dgd6dd6ZdZdZdZd	d
lZd	dlmZd	dlmZm	Z	d	d
lm
Z
d	dlmZd	dlm
Z
d	dlmZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zedkre�nd
S(s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys]
---
module: nxos_nxapi
extends_documentation_fragment: nxos
version_added: "2.1"
author: "Peter Sprygada (@privateip)"
short_description: Manage NXAPI configuration on an NXOS device.
description:
  - Configures the NXAPI feature on devices running Cisco NXOS.  The
    NXAPI feature is absent from the configuration by default.  Since
    this module manages the NXAPI feature it only supports the use
    of the C(Cli) transport.
options:
  http_port:
    description:
      - Configure the port with which the HTTP server will listen on
        for requests.  By default, NXAPI will bind the HTTP service
        to the standard HTTP port 80.  This argument accepts valid
        port values in the range of 1 to 65535.
    required: false
    default: 80
  http:
    description:
      - Controls the operating state of the HTTP protocol as one of the
        underlying transports for NXAPI.  By default, NXAPI will enable
        the HTTP transport when the feature is first configured.  To
        disable the use of the HTTP transport, set the value of this
        argument to False.
    required: false
    default: yes
    type: bool
    aliases: ['enable_http']
  https_port:
    description:
      - Configure the port with which the HTTPS server will listen on
        for requests.  By default, NXAPI will bind the HTTPS service
        to the standard HTTPS port 443.  This argument accepts valid
        port values in the range of 1 to 65535.
    required: false
    default: 443
  https:
    description:
      - Controls the operating state of the HTTPS protocol as one of the
        underlying transports for NXAPI.  By default, NXAPI will disable
        the HTTPS transport when the feature is first configured.  To
        enable the use of the HTTPS transport, set the value of this
        argument to True.
    required: false
    default: no
    type: bool
    aliases: ['enable_https']
  sandbox:
    description:
      - The NXAPI feature provides a web base UI for developers for
        entering commands.  This feature is initially disabled when
        the NXAPI feature is configured for the first time.  When the
        C(sandbox) argument is set to True, the developer sandbox URL
        will accept requests and when the value is set to False, the
        sandbox URL is unavailable. This is supported on NX-OS 7K series.
    required: false
    default: no
    type: bool
    aliases: ['enable_sandbox']
  state:
    description:
      - The C(state) argument controls whether or not the NXAPI
        feature is configured on the remote device.  When the value
        is C(present) the NXAPI feature configuration is present in
        the device running-config.  When the values is C(absent) the
        feature configuration is removed from the running-config.
    choices: ['present', 'absent']
    required: false
    default: present
  ssl_strong_ciphers:
    description:
      - Controls the use of whether strong or weak ciphers are configured.
        By default, this feature is disabled and weak ciphers are
        configured.  To enable the use of strong ciphers, set the value of
        this argument to True.
    required: false
    default: no
    type: bool
    version_added: "2.7"
  tlsv1_0:
    description:
      - Controls the use of the Transport Layer Security version 1.0 is
        configured.  By default, this feature is enabled.  To disable the
        use of TLSV1.0, set the value of this argument to True.
    required: false
    default: yes
    type: bool
    version_added: "2.7"
  tlsv1_1:
    description:
      - Controls the use of the Transport Layer Security version 1.1 is
        configured.  By default, this feature is disabled.  To enable the
        use of TLSV1.1, set the value of this argument to True.
    required: false
    default: no
    type: bool
    version_added: "2.7"
  tlsv1_2:
    description:
      - Controls the use of the Transport Layer Security version 1.2 is
        configured.  By default, this feature is disabled.  To enable the
        use of TLSV1.2, set the value of this argument to True.
    required: false
    default: no
    type: bool
    version_added: "2.7"
sI
- name: Enable NXAPI access with default configuration
  nxos_nxapi:
    state: present

- name: Enable NXAPI with no HTTP, HTTPS at port 9443 and sandbox disabled
  nxos_nxapi:
    enable_http: false
    https_port: 9443
    https: yes
    enable_sandbox: no

- name: remove NXAPI configuration
  nxos_nxapi:
    state: absent
s�
updates:
  description:
    - Returns the list of commands that need to be pushed into the remote
      device to satisfy the arguments
  returned: always
  type: list
  sample: ['no feature nxapi']
i����N(tLooseVersion(trun_commandstload_config(tnxos_argument_spec(tget_capabilities(t
AnsibleModule(t	iteritemscCs5|jdd�}|dkr1|jdd�n|dd}d|krk|jdrk|jdd	�n|jd
}|dkr�d|jd
<|jd
�n)|dkr�d|jd
<|jd�nxdddgD]V}|j|dk	r�d|j|kodkns-|jdd|�q-q�q�W|S(Ntnetwork_apitnxapitmsgs)module not supported over nxapi transporttdevice_infotnetwork_os_platformt7KtsandboxsEsandbox or enable_sandbox is supported on NX-OS 7K series of switcheststatetstartedtpresentshstate=started is deprecated and will be removed in a a future release.  Please use state=present insteadtstoppedtabsentsgstate=stopped is deprecated and will be removed in a a future release.  Please use state=absent insteadt	http_portt
https_portii��s%s must be between 1 and 65535(tgett	fail_jsontparamstappendtNone(tmoduletwarningstcapabilitiesRtos_platformRtkey((sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pyt
check_args�s$


#cs.t�}t�}d}d}|jd�}	|	rz|	jd�}|rU|d }n|	jd�}|rz|d }qzn��fd�}
|
d�r��ddkr�dgS|jd	�n�ddkr�|Sx�d
dgD]�}|d}|
|�rB�j|�tkr"d
|||<qBd|�j|�f||<n|
|�r��j|�tkr�d|�j|�f||<q�q�W|
d�r�d|d<�ds�d|d|d<q�n|r
|r
|dks�|dkrt|�dkr|
d�r+d|d<�dtkr+d|d<q+nd}
d}x�idd6dd6dd6j�D]u\}}|
|�r��j|�tkr�dj	||g�}q�qY�j|�tkrYdj	|
|g�}
qYqYWt
|�d krd!dj	||
g�|d"<qqn
|jd#�|j|j��|S($NRtnetwork_os_versioniRcs1�j|�dk	o0�j|��j|�kS(N(RR(tx(thavetwant(sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pytneeds_update�sRRsno feature nxapis
feature nxapithttpthttpst_portsno nxapi %ssnxapi %s port %sRs
nxapi sandboxsno %stN9KtN3Ks9.2tssl_strong_cipherssnxapi ssl ciphers weaksno nxapi ssl ciphers weaktsTLSv1.2ttlsv1_2sTLSv1.1ttlsv1_1tTLSv1ttlsv1_0t isnxapi ssl protocols%st
ssl_protocolss�os_version and/or os_platform keys from platform capabilities are not available.  Any NXAPI SSL optional arguments will be ignored(
tlisttdictRRRtFalsetTrueRtitemstjointlentextendtvalues(R(R'RR R!t
send_commandstcommandsR"t
os_versionRR)t	parametert
port_paramthave_ssl_protocolstwant_ssl_protocolsR#tvalue((R'R(sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pytmap_obj_to_commands�sd		

 !$

*
.&
cCsodg}d}xE|D]=}tj||tj�}|rt|jd��}PqqWi|dk	d6|d6S(Nsnxapi http port (\d+)iR*R(RtretsearchtMtinttgroup(tdatathttp_resRtregextmatch((sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pyt
parse_http
s	
cCsodg}d}xE|D]=}tj||tj�}|rt|jd��}PqqWi|dk	d6|d6S(Nsnxapi https port (\d+)iR+R(RRIRJRKRLRM(RNt	https_resRRPRQ((sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pytparse_httpss	
cCsdg|jd�D]}tjd|�r|^q}t}|rY|ddkrYt}ni|d6S(Ns
s.*sandbox.*is
nxapi sandboxR(tsplitRIRJR9R:(RNtitemRRG((sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pyt
parse_sandbox's
4	cCsbdg}d}x?|D]7}tj||tj�}|r|jd�}PqqWi|dkd6S(Ns(\w+) nxapi ssl ciphers weakitnoR/(RRIRJRKRM(RNtciphers_resRGRPRQ((sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pytparse_ssl_strong_ciphers/s	
cCsstjd|tj�dk	}tjd|tj�dk	}tjd|tj�dk	}i|d6|d6|d6S(Ns(?<!\S)TLSv1(?!\S)s(?<!\S)TLSv1.1(?!\S)s(?<!\S)TLSv1.2(?!\S)R4R2R1(RIRJRKR(RNR4R2R1((sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pytparse_ssl_protocols<scCs�t|dgdt�d}tjd|tj�}|sF|dkrQidd6St|�j�}idd6}|jt|��|jt	|��|jt
|��|jt|��|jt|��|S(	Nsshow run all | inc nxapitcheck_rcisno feature nxapiR0RRR(
RR9RIRJRKtstrtstriptupdateRRRTRWRZR[(RtoutRQtobj((sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pytmap_config_to_objDs
cCs�i
|jdd6|jdd6|jdd6|jdd6|jdd6|jdd6|jdd6|jdd6|jd	d	6|jd
d
6}|S(NR*RR+RRRR/R4R2R1(R(RRa((sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pytmap_params_to_objYsc	Cs�tdtddgdddt�dtdddd	�d
tddgdddt�dtdddd
�dtddgdd�dtdddddddg�dtdddt�dtdddt�dtdddt�dtdddt��
}|jt�td|dt�}t�}d}|d7}|d7}|jd|d d!�t|�}t	|||�t
|�}t|�}t|||||�}itd"6|d#6|d$6}|r�|j
s�t||�nt|d"<n|j|�d%S(&s+ main entry point for module execution
    R*taliasestenable_httpttypetbooltdefaultRRLiPR+tenable_httpsRi�Rtenable_sandboxRRtchoicesRRRR/R4R2R1t
argument_spectsupports_check_modesBModule nxos_nxapi currently defaults to configure 'http port 80'. s:Default behavior is changing to configure 'https port 443'sM when params 'http, http_port, https, https_port' are not set in the playbookRtversions2.11tchangedR RAN(R8R:R9R_RR
R7t	deprecateR	R$RcRbRHt
check_modeRt	exit_json(	RlRR twarning_msgR!R(R'RAtresult((sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pytmainjs<!
		

	
t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRItdistutils.versionRt&ansible.module_utils.network.nxos.nxosRRRR	tansible.module_utils.basicR
tansible.module_utils.sixRR$RHRRRTRWRZR[RbRcRut__name__(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pyt<module>s0


q
		E	
	
		
				.

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