jcs:invoke() Function

Syntax

var $result = jcs:invoke(rpc)

Description

Invoke a remote procedure call (RPC). The function can be called with one argument, either a string containing a Junos XML or Junos XML protocol RPC method name or a tree containing an RPC. The result is the contents of the <rpc-reply> element, not including the <rpc-reply> tag.

Parameters

Return Value

In the following example, there is a test to see if the interface argument is included on the command line when the script is executed. If the argument is provided, the operational mode output of the show interfaces terse command is narrowed to include information about that interface only.

<xsl:param name="interface"/>
<xsl:variable name="rpc">
    <get-interface-information>
        <terse/>
        <xsl:if test="$interface">
            <interface-name>
                <xsl:value-of select="$interface"/>
            </interface-name>
        </xsl:if>
    </get-interface-information>
</xsl:variable>
<xsl:variable name="out" select="jcs:invoke($rpc)"/>

In this example, the jcs:invoke() function calls an RPC without modifying the output:

<xsl:variable name="sw" select="jcs:invoke('get-software-information')"/>