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

�
�Udac@s�idd6dgd6dd6ZdZdZdZd	d
lZd	dlmZd	dlmZd	d
l	m
Z
mZd	dl	mZm
Z
d�Zd�Zdd�Zd�Zedkr�e�nd
S(s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�
---
module: nxos_feature
extends_documentation_fragment: nxos
version_added: "2.1"
short_description: Manage features in NX-OS switches.
description:
  - Offers ability to enable and disable features in NX-OS.
author:
  - Jason Edelman (@jedelman8)
  - Gabriele Gerbino (@GGabriele)
options:
  feature:
    description:
      - Name of feature.
    required: true
  state:
    description:
      - Desired state of the feature.
    required: false
    default: 'enabled'
    choices: ['enabled','disabled']
s�
- name: Ensure lacp is enabled
  nxos_feature:
    feature: lacp
    state: enabled

- name: Ensure ospf is disabled
  nxos_feature:
    feature: ospf
    state: disabled

- name: Ensure vpc is enabled
  nxos_feature:
    feature: vpc
    state: enabled
s�
commands:
    description: The set of commands to be sent to the remote device
    returned: always
    type: list
    sample: ['nv overlay evpn']
i����N(t
AnsibleModule(tConnectionError(tload_configtrun_commands(tget_capabilitiestnxos_argument_speccCs8i}d}idd6dd6}y&t||g�d}|j�}Wnttfk
r`iSXx�|D]�}y<tj||tj�}|j�}	|	d}|	d}
Wntk
r�d	}d	}
nX|rh|
rhd
|
kr�d
}
n||kr|
||<q0||dkr0|
d
kr0|
||<q0qhqhW|S(Ns&(?P<feature>\S+)\s+\d+\s+(?P<state>.*)sshow featuretcommandttexttoutputitfeaturetstatettenabledtdisabled(	Rt
splitlinestKeyErrort
IndexErrortretmatchtDOTALLt	groupdicttAttributeError(Rtmoduletavailable_featurest
feature_regexRtbodyt
split_bodytlinet
match_featuret
feature_groupR((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_feature.pytget_available_featuresPs2



	
cCs�t|dd�}g}||k}|s�|dkrUdj|�}|j|�q�|dkr�dj|�}|j|�q�n|S(NtmodetconfigRsfeature {0}Rsno feature {0}(tvalidate_featuretformattappend(tproposedtexistingRRRtcommandst
feature_checkR((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_feature.pytget_commandsrstshowcCs|jd}y4t|�}|jdi�}|jdd�}Wntk
rZd}nXd|kr&iidd6dd	6d
d6dd
6dd6dd6dd6dd6dd6dd6dd6dd6d6idd6d	d6dd
6d
d6dd6dd6dd6dd6dd6dd6dd6dd6d6}n�ii
dd6dd	6d
d6dd
6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d6i
dd6d	d6dd
6d
d6dd6dd6dd6dd6dd6dd6dd6dd6d!d 6d6}|||kr|||}n|S("s�Some features may need to be mapped due to inconsistency
    between how they appear from "show feature" output and
    how they are configuredRtdevice_infotnetwork_os_versionRs8.1tnves
nv overlayt
vnseg_vlansvn-segment-vlan-basedthsrp_enginethsrptfabric_mcastsfabric multicastt	scpServers
scp-servert
sftpServerssftp-servert
sla_responders
sla respondert
sla_senders
sla sendert	sshServertsshttacacsstacacs+ttelnetServerttelnettelosethernet-link-oamR.R%teth_port_secs
port-security(tparamsR	tgetR(RR$RtinfoR/t
os_versiontfeature_to_be_mapped((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_feature.pyR&�s�


c	Csptdtdddt�dtdddgd	d��}|jt�td
|dt�}t�}tdtd
|�}t|�}|jdj	�}t
||�}||kr�|jddd|d|�n�||}td|�}td|�}	t|d<t|	|||�}
|
rU|
j
dd�|jsHt||
�nt|d<n|
|d<|j|�dS(NRttypetstrtrequiredRtchoicesRRtdefaultt
argument_spectsupports_check_modetchangedtwarningstmsgsInvalid feature name.tfeatures_currently_supportedtinvalid_featureisterminal dont-askR+(tdicttTruetupdateR
RtlisttFalseR&RAtlowerR#t	fail_jsonR-tinsertt
check_modeRt	exit_json(RKRRNtresultsRRRt
existstateR*R)tcmds((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_feature.pytmain�s6
		


	

t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRtansible.module_utils.basicRtansible.module_utils.connectionRt&ansible.module_utils.network.nxos.nxosRRR	R
R#R-R&R_t__name__(((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_feature.pyt<module>s 


	"	U	+

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