Related Documentation
- ACX Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- EX Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- M Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- MX Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- PTX Series
- Summary of Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- SRX Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- T Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
execute() Function (jcs Namespace)
Namespaces
SLAX Syntax
XSLT Syntax
Release Information
Function introduced in Junos OS Release 9.3.
Description
Execute a remote procedure call (RPC) within the context of a specified connection handle. Any number of RPCs may be executed within the context of the connection handle until it is closed with the jcs:close() function.
Parameters
connection | — | Connection handle generated by a call to the jcs:open() function. |
rpc | — | Remote procedure call (RPC) to execute. |
Return Value
result | — | Results of the executed RPC, which include the contents of the <rpc-reply> element, but not the <rpc-reply> tag itself. This $result variable is the same as that produced by the jcs:invoke() function. By default, the results are in XML format equivalent to the output produced with the | display xml option in the CLI. |
Usage Examples
In the following example, the $rpc variable is declared and initialized with the Junos XML <get-interface-information> element. A call to the jcs:open() function generates a connection handle to the remote device at IP address 10.10.10.1. The user’s login and password are provided as arguments to jcs:open() to provide access to the remote device. The code calls jcs:execute() and passes in the connection handle and RPC as arguments. Junos OS on the remote device processes the RPC and returns the results, which are stored in the $results variable.
var $rpc = <get-interface-information>;
var $connection = jcs:open('10.10.10.1', 'bsmith', 'test123');
var $results = jcs:execute($connection, $rpc);
expr $results;
The equivalent XSLT code is:
<xsl:variable name="connection" select="jcs:open('10.10.10.1', 'bsmith', 'test123')"/>
<xsl:variable name="rpc">
<get-interface-information/>
</xsl:variable>
<xsl:variable name="results" select="jcs:execute($connection, $rpc)"/>
<xsl:value-of select="$results"/>Related Documentation
- ACX Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- EX Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- M Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- MX Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- PTX Series
- Summary of Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- SRX Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)
- T Series
- Summary of Extension Functions in the jcs and slax Namespaces
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
- close() Function (jcs Namespace)
- invoke() Function (jcs Namespace)
- open() Function (jcs Namespace)