Anons79 Mini Shell

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

�
�Udac@`s&ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZddlmZmZddlmZddlmZeZd�Zd�Zd�Zd�Zd�Zed�Z d�Z!e"dkr"e!�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�
---
module: junos_netconf
version_added: "2.1"
author: "Peter Sprygada (@privateip)"
short_description: Configures the Junos Netconf system service
description:
  - This module provides an abstraction that enables and configures
    the netconf system service running on Junos devices.  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. If the C(netconf_port) is not
    mentioned in the task by default netconf will be enabled on port 830
    only.
extends_documentation_fragment: junos
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']
    version_added: "2.2"
  state:
    description:
      - Specifies the state of the C(junos_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:
  - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4.
  - Recommended connection is C(network_cli). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html).
  - This module also works with C(local) connections for legacy playbooks.
  - If C(netconf_port) value is not mentioned in task by default it will be enabled on port 830 only.
    Although C(netconf_port) value can be from 1 through 65535, avoid configuring access on a port
    that is normally assigned for another service. This practice avoids potential resource conflicts.
s�
- name: enable netconf service on port 830
  junos_netconf:
    listens_on: 830
    state: present

- name: disable netconf service
  junos_netconf:
    state: absent
s�
commands:
  description: Returns the command sent to the remote device
  returned: when changed is True
  type: str
  sample: 'set system services netconf ssh port 830'
N(tto_text(tConnectionError(t
AnsibleModule(tjunos_argument_spectget_connection(tto_list(t	iteritemscC`s�|\}}t�}|ddkrH|ddkr�|jd�q�nA|ddksq|d|jd�kr�|jd|d�n|S(Ntstatetabsenttpresentsdelete system services netconftnetconf_ports'set system services netconf ssh port %s(tlisttappendtget(tupdatestmoduletwantthavetcommands((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_netconf.pytmap_obj_to_commandsZs	)cC`s/tjd|�}|r+t|jd��SdS(Ns
port (\d+)i(tretsearchtinttgroup(tconfigtmatch((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_netconf.pyt
parse_portjscC`s�t|�}|jdd�}|dkr=|jdd�nt|�j�}idd6}d|kr�|jidd6t|�d	6�n|S(
Ntcommands*show configuration system services netconftmsgs!unable to retrieve current configRRtsshRR(RRtNonet	fail_jsontstrtstriptupdateR"(RtconntoutR tobj((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_netconf.pytmap_config_to_objps
	cC`s3d|kodkns/|jdd�ndS(Nii��R$s(netconf_port must be between 1 and 65535(R'(tvalueR((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_netconf.pytvalidate_netconf_port�scC`sui|jdd6|jdd6}xLt|�D]>\}}t�jd|�}t|�r/|||�q/q/W|S(NRRsvalidate_%s(tparamsRtglobalsRtcallable(RR-tkeyR/t	validator((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_netconf.pytmap_params_to_obj�scC`s�t|�}y#|jt|�dg|�}Wn/tk
r`}|jdt|dd��nX|jdd�}t|dd�j�S(NttopR$terrorstsurrogate_then_replacetdifft(Rtedit_configR
R	R'RRR)(RR tcommitR+tresptexcR:((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_netconf.pytload_config�s# c	
C`s!tdtddddddg�dtdd	d
d	dg��}|jt�td|d
t�}t�}itd6|d6}t|�}t|�}t	||f|�}||d<|r|j
}t||d|�}|r|jri|d6|d<nt|d<qn|j
|�dS(s*main entry point for module execution
    RttypeRtdefaulti>taliasest
listens_onRRtchoicesRt
argument_spectsupports_check_modetchangedtwarningsRR=tpreparedR:N(tdictR*RR
tTrueRtFalseR6R.Rt
check_modeR@t_difft	exit_json(	RFRRItresultRRRR=R:((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_netconf.pytmain�s(
		

	t__main__(#t
__future__RRRRAt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRtansible.module_utils._textRtansible.module_utils.connectionR	tansible.module_utils.basicR
t(ansible.module_utils.network.junos.junosRRt)ansible.module_utils.network.common.utilsR
tansible.module_utils.sixRRLtUSE_PERSISTENT_CONNECTIONRR"R.R0R6RMR@RRt__name__(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_netconf.pyt<module>s0


-						!

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