jcs:load-configuration() Function
Syntax
var $result = jcs:load-configuration(conn_handle, configuration-data)
Description
Make changes to the Junos configuration.
Parameters
- configuration-data—Configuration changes.
- conn_handle—Connection handle generated by a call to the jcs:open() function.
Return Value
- $result—Results of the configuration.
The following example uses the load-configuration() RPC call to modify the configuration to disable an interface. The interface name is supplied by the user and stored in the variable interface-name. The call to the jcs:open() function opens a connection with the Junos OS management process (mgd) and returns a connection handle that is passed as an argument to the load-configuration() function. The configuration data that includes the changes to make to the configuration are stored in the variable disable. This variable is passed as an argument to the load-configuration() function at the time that it is called.
SLAX syntax:
var $conn = jcs:open();
var $disable = {
<configuration> {
<interfaces> {
<interface> {
<name> $interface-name;
<disable>;
}
}
}
}
var $disable-results := {
call jcs:load-configuration($connection = $conn, $configuration = $disable);
}
expr jcs:close($conn);The special syntax := means copy the result to a temporary variable and run the node-set function on that variable.
In XSLT, the code corresponding to the SLAX function call to jcs:load-configuration() is:
<xsl:variable name="disable-results-temp">
<xsl:call-template name="jcs:load-configuration">
<xsl:with-param name="connection" select="$conn"/>
<xsl:with-param name="configuration" select="$disable-xml"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable xmlns ext="http:xmlsoft.org/XSLT/namespace" \
name="disable-results" select="ext:node-set($disable-results-temp)"/>
Hide Navigation Pane
Show Navigation Pane
Download
SHA1