Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/iosxr/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_netconf.pyo

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddl
mZmZddlmZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�
---
module: iosxr_netconf
version_added: "2.5"
author: "Kedar Kekan (@kedarX)"
short_description: Configures NetConf sub-system service on Cisco IOS-XR devices
description:
  - This module provides an abstraction that enables and configures
    the netconf system service running on Cisco IOS-XR Software.
    This module can be used to easily enable the Netconf API. Netconf provides
    a programmatic interface for working with configuration and state
    resources as defined in RFC 6242.
extends_documentation_fragment: iosxr
options:
  netconf_port:
    description:
      - This argument specifies the port the netconf service should
        listen on for SSH connections.  The default port as defined
        in RFC 6242 is 830.
    required: false
    default: 830
    aliases: ['listens_on']
  netconf_vrf:
    description:
      - netconf vrf name
    required: false
    default: default
    aliases: ['vrf']
  state:
    description:
      - Specifies the state of the C(iosxr_netconf) resource on
        the remote device.  If the I(state) argument is set to
        I(present) the netconf service will be configured.  If the
        I(state) argument is set to I(absent) the netconf service
        will be removed from the configuration.
    required: false
    default: present
    choices: ['present', 'absent']
notes:
  - This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html).
  - Tested against Cisco IOS XR Software, Version 6.1.3
s�
- name: enable netconf service on port 830
  iosxr_netconf:
    listens_on: 830
    state: present

- name: disable netconf service
  iosxr_netconf:
    state: absent
s�
commands:
  description: Returns the command sent to the remote device
  returned: when changed is True
  type: str
  sample: 'ssh server netconf port 830'
N(t
AnsibleModule(tiosxr_argument_spec(t
get_configtload_config(t	iteritemscC`s@|\}}t�}|ddkr�|ddkrE|jd�nd|kri|jd|d�n|dr<x&|dD]}|jd|�q~Wq<n�|ddkr�|jd	�n|ddk	r|d|jd�kr|jd
|d�n|ddk	r<|d|dkr<|jd|d�n|S(Ntstatetabsenttpresentsno netconf-yang agent sshtnetconf_portsno ssh server netconf port %stnetconf_vrfsno ssh server netconf vrf %ssnetconf-yang agent sshsssh server netconf port %ssssh server netconf vrf %s(tlisttappendtNonetget(tupdatestwantthavetcommandstvrf((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_netconf.pytmap_obj_to_commandsVs&	
)$cC`s)tjd|�}|r%|jd�SdS(Ns	vrf (\w+)i(tretsearchtgroup(tconfigtmatch((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_netconf.pyt	parse_vrftscC`s/tjd|�}|r+t|jd��SdS(Ns
port (\d+)i(RRtintR(RR ((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_netconf.pyt
parse_portzscC`s6idd6}t|dd�}t|dd�}gd�|j�D�D]}|rH|^qH}g|d<x]|D]U}d|kr�|jit|�d	6�nd
|krq|djt|��qqqqWd|krd	|ks�|dr|jidd6�nd|kr2d	|kr2|jid
d	6�n|S(NRR
t
config_filtersnetconf-yang agents
ssh servercs`s|]}|j�VqdS(N(tstrip(t.0tline((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_netconf.pys	<genexpr>�sRsnetconf portRsnetconf vrftsshRi>(R
t
splitlinestupdateR#RR!(tmoduletobjtnetconf_configt
ssh_configtconfig_lineR((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_netconf.pytmap_config_to_obj�s
/

"cC`s3d|kodkns/|jdd�ndS(Nii��tmsgs(netconf_port must be between 1 and 65535(t	fail_json(tvalueR+((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_netconf.pytvalidate_netconf_port�scC`s�i|jdd6|jdd6|jdd6}xLt|�D]>\}}t�jd|�}t|�r=|||�q=q=W|S(NRRR
svalidate_%s(tparamsRtglobalsRtcallable(R+R,tkeyR3t	validator((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_netconf.pytmap_params_to_obj�sc	C`s,tdtddddddg�dtdd	gdd�d
tddddd
g��}|jt�td|dt�}t�}itd6|d6}t|�}t|�}t	||f�}||d<|r|j
}t||d|�}|rtd|�|d<nt|d<n|j|�dS(s*main entry point for module execution
    RttypeR"tdefaulti>taliasest
listens_onRRR
RtchoicesRt
argument_spectsupports_check_modetchangedtwarningsRtcommittpreparedtdiffN(
tdictR*R	RtTrueRtFalseR:R0Rt
check_modeRt	exit_json(	R@R+RCtresultRRRRDRF((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_netconf.pytmain�s(
		


t__main__(t
__future__RRRR;t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRtansible.module_utils.basicRt(ansible.module_utils.network.iosxr.iosxrR	R
Rtansible.module_utils.sixRRHtUSE_PERSISTENT_CONNECTIONRR!R#R0R4R:RMt__name__(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_netconf.pyt<module>s,


+							 

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