??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
ó àUdac@`skddlmZmZmZeZddlmZddlm Z ddl m Z ddl m Z ddlmZmZddlmZy<ddlmZdd lmZmZmZeZdZWn%eefk rëZe ZeZnXy&dd l!m"Z"m#Z#m$Z$m%Z%Wn3ek rGdd l&m"Z"m#Z#m$Z$m%Z%nXd „Z'd e fd „ƒYZ(dS(i(tabsolute_importtdivisiontprint_function(tabstractmethod(twraps(t AnsibleError(t AnsiblePlugin(t to_nativetto_text(tmissing_required_lib(tRPCError(tto_xmltto_elet NCElement(tElementt SubElementttostringt fromstringc`stˆƒ‡fd†ƒ}|S(Nc`s;ts+tdtdƒttƒfƒ‚nˆ|||ŽS(Ns%s: %stncclient(t HAS_NCCLIENTRR RtNCCLIENT_IMP_ERR(tselftargstkwargs(tfunc(sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pytwrapped.s%(R(RR((RsD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pytensure_ncclient-st NetconfBasecB`sXeZdZddddddddd d d d d dgZd„Zed„ƒZd„Zd'd'd„Z d'd'd„Z d'ddd'd'd'd„Z dd„Z d„Z d'd'd'd„Zdd„Zdd„Zd„Zed'd'd„Zd'd'd'd„Zd„Zd „Zed!„ƒZed"„ƒZd#„Zd$„Zd%„Zd&„ZRS((s\ A base class for implementing Netconf connections .. note:: Unlike most of Ansible, nearly all strings in :class:`TerminalBase` plugins are byte strings. This is because of how close to the underlying platform these plugins operate. Remember to mark literal strings as byte string (``b"string"``) and to use :func:`~ansible.module_utils._text.to_bytes` and :func:`~ansible.module_utils._text.to_text` to avoid unexpected problems. List of supported rpc's: :get: Retrieves running configuration and device state information :get_config: Retrieves the specified configuration from the device :edit_config: Loads the specified commands into the remote device :commit: Load configuration from candidate to running :discard_changes: Discard changes to candidate datastore :validate: Validate the contents of the specified configuration. :lock: Allows the client to lock the configuration system of a device. :unlock: Release a configuration lock, previously obtained with the lock operation. :copy_config: create or replace an entire configuration datastore with the contents of another complete configuration datastore. :get-schema: Retrieves the required schema from the device :get_capabilities: Retrieves device information and supported rpc methods For JUNOS: :execute_rpc: RPC to be execute on remote device :load_configuration: Loads given configuration on device Note: rpc support depends on the capabilites of remote device. :returns: Returns output received from remote device as byte string Note: the 'result' or 'error' from response should to be converted to object of ElementTree using 'fromstring' to parse output as xml doc 'get_capabilities()' returns 'result' as a json string. Usage: from ansible.module_utils.connection import Connection conn = Connection() data = conn.execute_rpc(rpc) reply = fromstring(reply) data = conn.get_capabilities() json.loads(data) conn.load_configuration(config=[''set system ntp server 1.1.1.1''], action='set', format='text') trpct get_configtgett edit_configtvalidatet copy_configtdispatchtlocktunlocktdiscard_changestcommitt get_schemat delete_configtget_device_operationscC`s tt|ƒjƒ||_dS(N(tsuperRt__init__t _connection(Rt connection((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR+lscC`s |jjS(N(R,tmanager(R((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pytmpscC`sty?t|ƒ}|jj|ƒ}t|dƒr7|jS|jSWn.tk ro}|j}tt|ƒƒ‚nXdS(sž RPC to be execute on remote device :param name: Name of rpc in string format :return: Received rpc response from remote host tdata_xmlN( R R/RthasattrR0txmlR t ExceptionR (Rtnametobjtresptexctmsg((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyRts ! cC`set|tƒrt|ƒ}n|s-d}n|jjd|d|ƒ}t|dƒr^|jS|jS(sž Retrieve all or part of a specified configuration (by default entire configuration is retrieved). :param source: Name of the configuration datastore being queried, defaults to running datastore :param filter: This argument specifies the portion of the configuration data to retrieve :return: Returns xml string containing the RPC response received from remote host trunningtsourcetfilterR0(t isinstancetlistttupleR/RR1R0R2(RR:R;R6((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR‚s  cC`s^t|tƒrt|ƒ}n|jjd|d|ƒ}t|dƒrQ|jn|j}|S(sÇ Retrieve device configuration and state information. :param filter: This argument specifies the portion of the state data to retrieve (by default entire state data is retrieved) :param with_defaults: defines an explicit method of retrieving default values from the configuration :return: Returns xml string containing the RPC response received from remote host R;t with_defaultsR0(R<R=R>R/RR1R0R2(RR;R?R6tresponse((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR’s !R2t candidatec C`sh|dkrtdƒ‚n|jj|d|d|d|d|d|ƒ}t|dƒra|jS|jS( sÈ Loads all or part of the specified *config* to the *target* configuration datastore. :param config: Is the configuration, which must be rooted in the `config` element. It can be specified either as a string or an :class:`~xml.etree.ElementTree.Element`. :param format: The format of configuration eg. xml, text :param target: Is the name of the configuration datastore being edited :param default_operation: If specified must be one of { `"merge"`, `"replace"`, or `"none"` } :param test_option: If specified must be one of { `"test_then_set"`, `"set"` } :param error_option: If specified must be one of { `"stop-on-error"`, `"continue-on-error"`, `"rollback-on-error"` } The `"rollback-on-error"` *error_option* depends on the `:rollback-on-error` capability. :return: Returns xml string containing the RPC response received from remote host sconfig value must be providedtformatttargettdefault_operationt test_optiont error_optionR0N(tNonet ValueErrorR/RR1R0R2(RtconfigRBRCRDRERFR6((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR¡s ' cC`s2|jjd|ƒ}t|dƒr+|jS|jS(sS Validate the contents of the specified configuration. :param source: Is the name of the configuration datastore being validated or `config` element containing the configuration subtree to be validated :return: Returns xml string containing the RPC response received from remote host R:R0(R/R R1R0R2(RR:R6((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR ´scC`s2|jj||ƒ}t|dƒr+|jS|jS(s Create or replace an entire configuration datastore with the contents of another complete configuration datastore. :param source: Is the name of the configuration datastore to use as the source of the copy operation or `config` element containing the configuration subtree to copy :param target: Is the name of the configuration datastore to use as the destination of the copy operation :return: Returns xml string containing the RPC response received from remote host R0(R/R!R1R0R2(RR:RCR6((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR!¾scC`s‹|dkrtdƒ‚n|jjt|ƒd|d|ƒ}t|tƒrZ|j}n-t|dƒr~|j r~|j}n |j }|S(sú Execute rpc on the remote device eg. dispatch('clear-arp-table') :param rpc_command: specifies rpc command to be dispatched either in plain text or in xml element format (depending on command) :param source: name of the configuration datastore being queried :param filter: specifies the portion of the configuration to retrieve (by default entire configuration is retrieved) :return: Returns xml string containing the RPC response received from remote host s"rpc_command value must be providedR:R;tdata_eleN( RGRHR/R"RR<R R0R1RJR2(Rt rpc_commandR:R;R6tresult((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR"És $   cC`s2|jjd|ƒ}t|dƒr+|jS|jS(s. Allows the client to lock the configuration system of a device. :param target: is the name of the configuration datastore to lock, defaults to candidate datastore :return: Returns xml string containing the RPC response received from remote host RCR0(R/R#R1R0R2(RRCR6((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR#äscC`s2|jjd|ƒ}t|dƒr+|jS|jS(s: Release a configuration lock, previously obtained with the lock operation. :param target: is the name of the configuration datastore to unlock, defaults to candidate datastore :return: Returns xml string containing the RPC response received from remote host RCR0(R/R$R1R0R2(RRCR6((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR$îscC`s,|jjƒ}t|dƒr%|jS|jS(så Revert the candidate configuration to the currently running configuration. Any uncommitted changes are discarded. :return: Returns xml string containing the RPC response received from remote host R0(R/R%R1R0R2(RR6((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR%øscC`sPt|ddƒ}|jjd|d|d|ƒ}t|dƒrI|jS|jS(sz 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 timeout: specifies the confirm timeout in seconds :param persist: make the confirmed commit survive a session termination, and set a token on the ongoing confirmed commit :return: Returns xml string containing the RPC response received from remote host terrorstsurrogate_or_strictt confirmedttimeouttpersistR0(RR/R&R1R0R2(RRORPRQR6((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR&s!cC`s;|jj|d|d|ƒ}t|dƒr4|jS|jS(se Retrieve a named schema, with optional revision and type. :param identifier: name of the schema to be retrieved :param version: version of schema to get :param format: format of the schema to be retrieved, yang is the default :return: Returns xml string containing the RPC response received from remote host tversionRBR0(R/R'R1R0R2(Rt identifierRRRBR6((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR'scC`s/|jj|ƒ}t|dƒr(|jS|jS(sã delete a configuration datastore :param target: specifies the name or URL of configuration datastore to delete :return: Returns xml string containing the RPC response received from remote host R0(R/R(R1R0R2(RRCR6((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyR(scC`s|jj|ƒS(N(R/tlocked(RRC((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyRT(scC`sdS(sµ Retrieves device information and supported rpc methods by device platform and return result as a string :return: Netconf session capability N((R((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pytget_capabilities+scC`sdS(s´ Identifies the operating system of network device. :param obj: ncclient manager connection instance :return: The name of network operating system. N((R5((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pytguess_network_os5scC`s|jS(ss Returns list of base rpc method supported by remote device :return: List of RPC supported (t__rpc__(R((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyt get_base_rpc>scC`sdS(sç Copies file to remote host :param source: Source location of file :param destination: Destination file path :return: Returns xml string containing the RPC response received from remote host N((RR:t destination((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pytput_fileEscC`sdS(sê Fetch file from remote host :param source: Source location of file :param destination: Source location of file :return: Returns xml string containing the RPC response received from remote host N((RR:RY((sD/usr/lib/python2.7/site-packages/ansible/plugins/netconf/__init__.pyt fetch_fileNscC`si}dj|ƒ}d|k|ds*  & &