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

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
dd
lmZmZddlmZeZyddlmZmZWn'ek
r�ddlmZmZnXd�Zedkre�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatustnetworktsupported_bysl
---
module: junos_rpc
version_added: "2.3"
author: "Peter Sprygada (@privateip)"
short_description: Runs an arbitrary RPC over NetConf on an Juniper JUNOS device
description:
  - Sends a request to the remote device running JUNOS to execute the
    specified RPC using the NetConf transport.  The reply is then
    returned to the playbook in the C(xml) key.  If an alternate output
    format is requested, the reply is transformed to the requested output.
extends_documentation_fragment: junos
options:
  rpc:
    description:
      - The C(rpc) argument specifies the RPC call to send to the
        remote devices to be executed.  The RPC Reply message is parsed
        and the contents are returned to the playbook.
    required: true
  args:
    description:
      - The C(args) argument provides a set of arguments for the RPC
        call and are encoded in the request message.  This argument
        accepts a set of key=value arguments.
  attrs:
    description:
      - The C(attrs) arguments defines a list of attributes and their values
        to set for the RPC call. This accepts a dictionary of key-values.
    version_added: "2.5"
  output:
    description:
      - The C(output) argument specifies the desired output of the
        return data.  This argument accepts one of C(xml), C(text),
        or C(json).  For C(json), the JUNOS device must be running a
        version of software that supports native JSON output.
    default: xml
requirements:
  - ncclient (>=v0.5.2)
notes:
  - This module requires the netconf system service be enabled on
    the remote device being managed.
  - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4.
  - Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html).
  - This module also works with C(local) connections for legacy playbooks.
sg
- name: collect interface information using rpc
  junos_rpc:
    rpc: get-interface-information
    args:
      interface-name: em0
      media: True

- name: get system information
  junos_rpc:
    rpc: get-system-information

- name: load configuration
  junos_rpc:
    rpc: load-configuration
    attrs:
      action: override
      url: /tmp/config.conf
s2
xml:
  description: The xml return string from the rpc request.
  returned: always
  type: str
output:
  description: The rpc rely converted to the output format.
  returned: always
  type: str
output_lines:
  description: The text output split into lines for readability.
  returned: always
  type: list
(t
AnsibleModule(texec_rpc(tjunos_argument_specttostring(t	iteritems(tElementt
SubElementcC`s�tdtdt�dtdd�dtdd�dtdd	d
d	ddg��}|jt�td
|dt�}t�}itd6|d6}t|jd�j	dd�}t
|j|jd�f�r�|j
dd�n|jdp�i}|jdpi}i|jdd6}x.t|�D] \}}	|ji|	|6�q+Wt|jd|�}
x�t|�D]�\}}	t|�j	dd�}t|	t�r�x_|	D]-}t|
|�}|tk	r�||_q�q�Wqrt|
|�}|	tk	rr|	|_qrqrWt|t|
�dt�}
t|
�|d	<|jddkr�|
jd�}|jj�|d<|djd�|d<nK|jddkr�|j|
jj��|d<nt|
�jd�|d<|j|�dS(s(main entry point for Ansible module
    trpctrequiredtargsttypetdicttattrstoutputtdefaulttxmltchoicestjsonttextt
argument_spectsupports_check_modetchangedtwarningst_t-tgettmsgs%invalid rpc for running in check_modetformattignore_warnings	.//outputs
toutput_linesN(RtTruetupdateR
RtFalsetlisttstrtparamstreplacetallt
check_modet
startswitht	fail_jsonRR
t
isinstanceRRR	Rtfindtstriptsplitt	from_jsont	exit_json(RtmoduleRtresultRRRtxattrstkeytvaluetelementtitemtchildtreplytdata((sK/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_rpc.pytmainmsN!
		
t__main__N(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRt+ansible.module_utils.network.common.netconfR	t(ansible.module_utils.network.junos.junosR
Rtansible.module_utils.sixRR&tUSE_PERSISTENT_CONNECTIONt
lxml.etreeR
RtImportErrortxml.etree.ElementTreeRAt__name__(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_rpc.pyt<module>s&


/
	?

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