Junos SLAX Scripting Features List

By Elevate posted 08-09-2015 07:42

This applies to SLAX version 1.0 and higher.

Description Release
jcs:empty(), jcs:regex(), and jcs:sysctl() functions 7.6
jcs:break_lines() renamed to jcs:break-lines() 8.1
New event policy action: raise-trap to generate a SNMP trap in response to a syslog message. 8.1
Support for SNMP trap spoofing/generating via <request-snmp-spoof-trap> RPC 8.2
Juniper Event MIB introduced, allowing scripts to generate customizable jnxEventTraps 8.2
SLAX scripting language 8.2
Add accounting records from scripts via the <add-accounting-file-record> RPC. 8.2
Matching non-standard events in event policy through pseudo event-IDs (PFE, SYSTEM, KERNEL, etc) 8.3
SNMP Utility MIB 8.4
jcs:split() extension function 8.4
"show configuration | compare" support for <get-configuration> 8.5
<file-get> and <file-put> API elements for file retrieval and creation. 9.0
jcs:parse-ip() - Ext function to parse the given IP address 9.0
jcs:syslog() - Ext function. Logs the message in syslog with the specified priority 9.0
jcs:grep() - Ext template. Greps a file 9.0
embed event-policies in event-scripts 9.0
Simulate events with the logger cli utility 9.1
direct-access knob for commit-script. To read the input configuration directly from database 9.1
:= operator to convert result tree fragment variables into node-sets 9.2
Multi RPC (aka commit support from scripts): jcs:open(), jcs:close(), and jcs:load-configuration 9.3
Remote RPC support with ssh-agent setup 9.3
Pass event details to event-script (event-script-input) 9.3
jcs:input() ext function for interactive scripts 9.4
jcs:dampen() - to avoid same thing happening again and again 9.4
EXSLT function support added 9.4
Script directory on EX changed from /var/db/scripts to /config/db/scripts. /var/db/scripts links to the new /config/db/scripts directory. Following this change, scripts are now preserved across software upgrades. (This was an EX-only problem). 9.4
Added SYSTEM event "init: Starting of initial processes complete", which can be used as a boot-up trigger for event scripts. 9.4
Script integrity check 9.5
Login script 9.5
jcs:getsecret() - Ask input from user without echoing it 9.5R2
Remote-rpc support without ssh-agent setup. When jcs:open($hostname) is called password will be asked in cli 9.5R3
Remote RPC support for event-script. jcs:open() accepts username and password. 9.6
jcs:input() renamed to jcs:get-input(), jcs:getsecret() renamed to jcs:get-secret() 9.6
Default parameter $localtime_iso renamed to $localtime-iso 9.6
Syslog message indicating the source of executing event scripts (/var/db/scripts/op or /var/db/scripts/event) 9.6

op url "Executing op script from remote location"


"| display xml rpc" CLI option to reveal RPC equivalent of CLI commands. 10.1

Verify checksum of remote op scripts before executing them

A new $commit-options parameter has been added to jcs:load-configuration, allowing settings such as commit synchronize or commit check to be specified. 10.2
<get-configuration> RPC now correctly expands interface-ranges when inherit="inherit" is set, and new attribute interface-ranges="interface-ranges" can be set on the RPC to note the source of the expanded interface elements. 10.2R2


Additional environment info provided to script as global node-set variable

"max-datasize" hidden knob available for all types of scripts 11.1

Users can load their own script library under the directory 'lib'


Ability for script to append data to an existing file


Event policy attributes 'match' support variable


Syslog's default log suppression mechanism can now be disabled

Indication provided if configuration element is unsupported when configuration is retrieved via <get-configuration> 10.4R2
Ability to protect parts of the configuration using the protect command 11.2
Load configuration in set format via <load-configuration> RPC 11.3
CLI output for XML operational commands 11.4
Support for <configuration-set> tag in netconf 11.4
Remote connections via jcs:open() using NETCONF along with two new functions: jcs:get-protocol() and jcs:get-hello() 11.4
Ability for logger utility to generate multiple messages with a single command. 11.4
New <batch> child element for <open-configuration>, allowing scripts to open configuration session in batch mode. 11.2R3
Change syslog message facility and/or severity through an event policy. 12.1
Added support for the <get-configuration> RPC to return the configuration after commit-script processing, allowing transient changes to be visible. This is accomplished via new options for the commit-scripts attribute: "apply" and "apply-no-transients" 12.1
Routing-instance support for jcs:open() connections. 11.3R6
Inclusion of <database-path> in $junos-context (for commit scripts) as well as addition of database-path attribute for <get-configuration>. The two together provide the means to request the candidate configuration within a private configuration session. 11.4R5
Request configuration identifiers via key attribute of <get-configuration> RPC. 12.2?
Template junoscript() as starting point of op and event scripts. 12.2
SLAX 1.1 support: additional SLAX statements (mode, etc), additional operators ?: ... , for, while, mvars, slax functions, xutil functions, bit functions, curl functions. 12.2
SLAX 1.1 debugger support 12.2R5
event-options max-policies configuration command is unhidden, allowing you to specific a different number of allowed concurrent event policies than the default of 15 12.3
max-datasize configuration command for event scripts, op scripts, and commit scripts is unhidden, allowing a script to be set to a different max-datasize than 128MB. In addition, Junos will no longer assign 128MB by default if there is less free memory than that available. 12.3
Synchronize scripts between routing-engines. 13.2
SLAX 1.1 enhancements: os:exit-code(), os:mkdir(), os:stat(), xutil:max-call-depth(), xutil:json-to-xml(), xutil:xml-to-json(), curl <format> "html" option, curl <timeout> and <connect-timeout> options, slax:document <retain-returns>. 14.1
no-drift option for generate-events. Ensures that a delayed event will not propagate its delay to the next iteration. 14.1
Script dampening. Minimizing the impact of event, commit, and/or op scripts by forcing the script to pause at defined intervals. Configured via the dampen configuration command. 14.1