Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/plugins/netconf/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pyc

�
�Udac@`s"ddlmZmZmZeZdZddlZddlZddl	m
Z
mZddlm
Z
ddlmZddlmZmZy\ddlmZdd	lmZdd
lmZddlmZmZmZmZeZWne e!fk
re"ZnXdefd
��YZ#dS(i(tabsolute_importtdivisiontprint_functionsC
---
author: Ansible Networking Team
netconf: junos
short_description: Use junos netconf plugin to run netconf commands on Juniper JUNOS platform
description:
  - This junos plugin provides low level abstraction apis for
    sending and receiving netconf commands from Juniper JUNOS network devices.
version_added: "2.9"
options:
  ncclient_device_handler:
    type: str
    default: junos
    description:
      - Specifies the ncclient device handler name for Juniper junos network os. To
        identify the ncclient device handler name refer ncclient library documentation.
N(tto_textt	to_native(tstring_types(tAnsibleConnectionFailure(tNetconfBasetensure_ncclient(tmanager(tRPCError(tSSHUnknownHostError(tto_eletto_xmltnew_eletsub_eletNetconfcB`s�eZd�Zed��Zd�Zeddddd��Zd�Ze	ed���Z
ddd	�Zd
d�Zd�Z
d
�Zeeeddedd��ZRS(cC`s>y&t|j|�jdd�j�SWntk
r9nXdS(Nterrorstsurrogate_then_replace(RtfindttexttstriptAttributeError(tselftelettag((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pytget_text;s&
cC`s�t�}d|d<td�}|jt|��}t|�}|jd�}|j|d�|d<|j|d�|d<|j|d	�|d
<|S(Ntjunost
network_ossget-software-informations.//software-informations
junos-versiontnetwork_os_versions	host-nametnetwork_os_hostnames
product-modeltnetwork_os_model(tdictRtexecute_rpcR
RRR(Rtdevice_infoRtdatatreplytsw_info((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pytget_device_infoAs	
cC`s
|j|�S(s�
        RPC to be execute on remote device
        :param name: Name of rpc in string format
        :return: Received rpc response from remote host
        (trpc(Rtname((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pyR!Pstxmltmerget	candidatec	C`s|r$|dkr$t|�}q$ny,|jjd|d|d|d|�jSWn(tk
rz}tt|j���nXdS(s�
        Load given configuration on device
        :param format: Format of configuration (xml, text, set)
        :param action: Action to be performed (merge, replace, override, update)
        :param target: The name of the configuration datastore being edited
        :param config: The configuration to be loaded on remote host in string format
        :return: Received rpc response from remote host in string format
        R)tformattactionttargettconfigN(Rtmtload_configurationtdata_xmlR
t	ExceptionR
R)(RR,R-R.R/texc((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pyR1Xs
,c
C`s�t�}|j�ddddddddd	d
ddg|d
<d|d<|j�|d<g|jjD]}|^qh|d<g|jjD]}|^q�|d<|jj|d<|j|d�|d<tj	|�S(Ntcommittdiscard_changestvalidatetlocktunlockt	copy_copyR!R1tget_configurationtcommandtrebootthaltR'tnetconftnetwork_apiR"tserver_capabilitiestclient_capabilitiest
session_idtdevice_operations(
R tget_base_rpcR&R0RARBRCtget_device_operationstjsontdumps(Rtresulttc((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pytget_capabilitiesks	
##cC`s�y�tjd|jjd|jjp'dd|jjd|jjd|jd|jd�d	|jd	�d
|jj	d|jd�d
|j
�
}Wn%tk
r�}tt
|���nXd}x,|jD]!}tjd|�r�d}q�q�W|j�|S(s�
        Guess the remote network os name
        :param obj: Netconf connection class object
        :return: Network OS name
        thosttporti>tusernametpasswordtkey_filenamethostkey_verifythost_key_checkingt
look_for_keystallow_agentttimeouttpersistent_connect_timeoutt
ssh_configRN(R	tconnectt
_play_contexttremote_addrRMtremote_userRORPt
get_optionRTt_ssh_configRRRtNoneRAtretsearcht
close_session(tobjR0R4t
guessed_osRJ((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pytguess_network_osxs(		

cC`se|dk	rIt|t�s:td|t|�f��nt|�}n|jjd|d|�jS(sj
        Retrieve all or part of a specified configuration.
        :param format: format in which configuration should be retrieved
        :param filter: specifies the portion of the configuration to retrieve
               as either xml string rooted in <configuration> element
        :return: Received rpc response from remote host in string format
        sVget configuration filter should be of type string, received value '%s' is of type '%s'R,tfilterN(	R^t
isinstanceRRttypeRR0R;R2(RR,Re((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pyR;�sicC`s|jjd|�jS(sh
        Compare the candidate configuration with running configuration
        by default. The candidate configuration can be compared with older
        committed configuration by providing rollback id.
        :param rollback: Rollback id of previously commited configuration
        :return: Received rpc response from remote host in string format
        trollback(R0tcompare_configurationR2(RRh((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pyRi�scC`s|jj�jS(sreboot the device(R0R>R2(R((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pyR>�scC`s|jj�jS(sreboot the device(R0R=R2(R((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pyR=�sc	C`s�td�}|r"t|d�n|r8t|d�n|rNt|d�n|rut|d�}t|�|_n|r�t|d�}t|�|_n|r�t|d�}t|�|_n|j|�S(s�
        Commit the candidate configuration as the device's new current configuration.
        Depends on the `:candidate` capability.
        A confirmed commit (i.e. if *confirmed* is `True`) is reverted if there is no
        followup commit within the *timeout* interval. If no timeout is specified the
        confirm timeout defaults to 600 seconds (10 minutes).
        A confirming commit may have the *confirmed* parameter but this is not required.
        Depends on the `:confirmed-commit` capability.
        :param confirmed: whether this is a confirmed commit
        :param check: Check correctness of syntax
        :param timeout: specifies the confirm timeout in seconds
        :param comment: Message to write to commit log
        :param synchronize: Synchronize commit on remote peers
        :param at_time: Time at which to activate configuration changes
        :return: Received rpc response from remote host
        scommit-configurationt	confirmedtchecktsynchronizesat-timetlogsconfirm-timeout(RRtstrRR'(	RRjRkRUtcommentRltat_timeRbtsubele((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pyR5�s"N(t__name__t
__module__RRR&R!R^R1RKtstaticmethodRdR;RiR>R=tFalseR5(((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pyR:s			
!
		($t
__future__RRRRgt
__metaclass__t
DOCUMENTATIONRGR_tansible.module_utils._textRRtansible.module_utils.sixRtansible.errorsRtansible.plugins.netconfRRtncclientR	tncclient.operationsR
tncclient.transport.errorsRt
ncclient.xml_RR
RRtTruetHAS_NCCLIENTtImportErrorRRuR(((sA/usr/lib/python2.7/site-packages/ansible/plugins/netconf/junos.pyt<module>s""



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