Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Storing and Using Imported Scripts and Script Functionality

Starting with Junos OS Release 11.1, Junos OS provides a dedicated directory for script libraries, where users can store scripts and script functionality that then can be imported into any commit, event, or op script. Upon installation, Junos OS creates the /var/db/scripts/lib/ directory. Junos OS will not overwrite or erase any files in an existing lib/ directory upon installation or upgrade.

If you store scripts in and run them from flash memory, both the executed scripts and the imported scripts must be present on the flash drive. When you configure the load-scripts-from-flash statement at the [edit system scripts] hierarchy level, Junos OS creates the /config/scripts/lib/ directory. When you add or remove the load-scripts-from-flash statement in the configuration, you must manually move scripts and script libraries from the hard drive to the flash drive, or vice versa, as appropriate. They are not moved automatically.

Imported scripts must be stored in the /var/db/scripts/lib/ directory on the hard drive, or if the load-scripts-from-flash statement is configured, in the /config/db/scripts/lib/ directory on the flash drive. To import a script from the script library, include the <xsl:import> tag in the style sheet declaration of an XSLT script or the import statement in a SLAX script and specify the file location. The following sample code imports the /var/db/scripts/lib/test.xsl file:

XSLT Syntax

<?xml version="1.0"?>
<xsl:stylesheet version="1.0">
    <xsl:import href="../lib/test.xsl"/>
    ...
</xsl: stylesheet>

SLAX Syntax

version 1.0;
import "../lib/test.xsl";

Published: 2013-07-26