
Junos 10.3 Configuration and Operations Automation Guide
Copyright and Trademark Information
Table of Contents
List of Figures
List of Tables
About This Guide
Overview
Overview of Configuration and Operations Automation
Scripts and Event Policy Configuration Statements
Introduction to the Junos XML Management Protocol and Junos
XML API
Understanding XSLT
Understanding SLAX
SLAX Overview
Converting Scripts Between SLAX and XSLT
SLAX Comments Overview
SLAX Statements Overview
SLAX Elements and Element Attributes Overview
XPATH Expressions Overview for SLAX
SLAX Variables and Parameters Overview
Template Matching Overview for SLAX
SLAX Parameter Passing Overview
Named Templates Overview for SLAX
XSLT Elements Without SLAX Equivalents
Junos Extension Functions and Templates in the jcs Namespace
Junos Extension Functions in the jcs Namespace
jcs:break-lines() Function
jcs:close() Function
jcs:dampen() Function
jcs:empty() Function
jcs:execute() Function
jcs:first-of() Function
jcs:get-input() Function
jcs:get-secret() Function
jcs:hostname() Function
jcs:invoke() Function
jcs:load-configuration() Function
jcs:open() Function
jcs:output() Function
jcs:parse-ip() Function
jcs:printf() Function
jcs:progress() Function
jcs:regex() Function
jcs:sleep() Function
jcs:split() Function
jcs:sysctl() Function
jcs:syslog() Function
jcs:trace() Function
Junos Named Templates in the jcs Namespace
xsl:template match="/" Template
Summary of XPath and XSLT Constructs
Summary of SLAX Statements
Commit Scripts
Commit Scripts Overview
Writing Commit Scripts That Generate a Custom Warning, Error,
or System Log Message
Writing Commit Scripts That Generate a Persistent or Transient
Configuration Change
Writing Commit Scripts That Create Custom Configuration Syntax
with Macros
Configuring and Troubleshooting Commit Scripts
Implementing Commit Scripts
Controlling Execution of Commit Scripts During Commit Operations
Storing Commit Scripts in Flash Memory
Overview of Updating Commit Scripts from a Remote Source
Configuring the Master Source for a Commit Script
Updating a Commit Script from the Master Source
Updating a Commit Script from an Alternate Location
Configuring Checksum Hashes for a Commit Script
Executing Large Commit Scripts
Displaying Commit Script Output
Tracing Commit Script Processing
Troubleshooting Commit Scripts
Commit Script Examples
Example: Requiring and Restricting Configuration Statements
Example: Requiring Internal Clocking on T1 Interfaces
Example: Imposing a Minimum MTU Setting
Example: Limiting the Number of E1 Interfaces
Example: Limiting the Number of ATM Virtual Circuits
Example: Controlling IS-IS and MPLS Interfaces
Example: Adding T1 Interfaces to a RIP Group
Example: Configuring a Default Encapsulation Type
Example: Controlling LDP Configuration
Example: Adding a Final then accept Term to a Firewall
Example: Configuring an Interior Gateway Protocol on an Interface
Example: Creating a Complex Configuration Based on a Simple
Interface Configuration
Example: Configuring Administrative Groups for LSPs
Example: Configuring Dual Routing Engines
Example: Preventing Import of the Full Routing Table
Example: Automatically Configuring Logical Interfaces and IP
Addresses
Example: Prepending a Global Policy
Example: Assigning a Classifier
Example: Loading a Base Configuration
Summary of Junos XML and XSLT Tag Elements Used in Commit Scripts
Summary of Commit Script Configuration Statements
Operation (Op) Scripts
Op Scripts Overview
Writing Op Scripts
Configuring and Executing
Op Scripts
Implementing Op Scripts
Enabling an Op Script and Defining a Script Alias
Configuring Checksum Hashes for an Op Script
Executing an Op Script
Executing an Op Script from a Remote Site
Storing Op Scripts in Flash Memory
Specifying a Master Source for an Op Script
Updating an Op Script from the Master Source
Updating an Op Script from an Alternate Location
Tracing Op
Script Processing
Op Script Examples
Example: Restarting an FPC Using an Op Script
Example: Displaying DNS Hostname Information Using an Op Script
Example: Customizing Output of the show interfaces terse Command
Using an Op Script
Example: Finding LSPs to Multiple Destinations Using an Op
Script
Example: Importing and Exporting Files Using an Op Script
Summary
of Op Script Configuration Statements
Event Policy
Event Policy Overview
Configuring Event Policy
Using Correlated Events to Trigger an Event Policy
Representing the Correlating Event in an Event Policy
Triggering an Event Policy Based on Event Count
Using Regular Expressions to Refine the Set of Events That
Trigger a Policy
Generating Internal Events to Trigger Event Policies
Using Nonstandard System Log Messages to Trigger Event Policies
Defining Destinations for File Archiving by Event Policies
Configuring an Event Policy to Upload Files
Configuring the Delay Before Files Are Uploaded by an Event
Policy
Configuring an Event Policy to Retry the File Upload Action
Configuring an Event Policy to Execute Operational Mode Commands
Executing Event Scripts in an Event Policy
Configuring Event Policies to Ignore an Event
Changing the User Privilege Level for an Event Policy Action
Configuring Event Policies to Raise SNMP Traps
Tracing Event Policy Processing
Event Policy Examples
Example: Correlating Events Based on Receipt of Other Events
Within a Specified Time Interval
Examples: Assigning a Transfer Delay to an Event Policy Action
Example: Representing the Correlating Event in an Event Policy
Example: Associating an Optional User with an Event Policy
Action
Examples: Retrying the File Upload Action
Examples: Triggering a Policy Based on Event Count
Example: Ignoring Events Based on Receipt of Other Events
Example: Correlating Events Based on Event Attributes
Controlling Event Policy Using a Regular Expression
Example: Generating an Internal Event Every Hour
Example: Generating an Internal Event at Midnight
Example: Raising an SNMP Trap in Response to an Event
Example: Using Nonstandard System Log Messages to Trigger an
Event Policy
Summary of Event Policy Configuration Statements
archive-sites
arguments
attributes-match
commands
destination
destinations
equals
event-options
event-script
events
execute-commands
generate-event
ignore
matches
not
output-filename
output-format
policy
raise-trap
retry-count
starts-with
then
time-interval
time-of-day
traceoptions
transfer-delay
trigger
upload
user-name
within
Event Scripts
Event Scripts Overview
Writing Event
Scripts
Configuring Event Scripts
Implementing Event Scripts
Enabling an Event Script
Configuring Checksum Hashes for an Event Script
Executing an Event Script
Storing Event Scripts in Flash Memory
Specifying a Master Source for an Event Script
Updating an Event Script from the Master Source
Updating an Event Script from an Alternate Location
Tracing Event Script Processing
Event Script Examples
Summary of Event Script Configuration Statements
IndexSymbols
- #, comments in configuration statements 1
- $
- regular expression operator
- event policy 1
- ( ), in syntax descriptions 1
- *
- regular expression operator
- event policy 1
- +
- regular expression operator
- event policy 1
- .
- regular expression operator
- event policy 1
- < >, in syntax descriptions 1
- ?
- regular expression operator
- event policy 1
- [ ], in configuration statements 1
- ^
- regular expression operator
- event policy 1
- { }, in configuration statements 1
- | (pipe)
- regular expression operator
- event policy 1
- | (pipe), in syntax descriptions 1
A
- adding
- all (tracing flag)
- allow-transients statement 1
- usage guidelines 1
- apply-macro statement 1
- usage guidelines 1
- apply-templates SLAX statement 1
- applying templates
- archive-sites statement 1
- usage guidelines 1
- archiving files in event policy 1
- arguments
- standard 1
- arguments statement
- assigning CoS classifier
- commit script example 1
- attributes
- attributes-match statement 1
- usage guidelines 1
B
C
- call SLAX statement 1
- <change> XSLT element 1
- checksum
- checksum statement 1, 2, 3, 4, 5, 6
- command statement 1
- usage guidelines 1
- commands statement 1
- usage guidelines 1
- comments
- SLAX and XSLT 1
- comments, in configuration statements 1
- commit script examples
- adding default encapsulation type 1
- adding final firewall term 1
- adding interface to RIP group 1
- assigning CoS classifier 1
- configuring dual Routing Engines 1
- controlling minimum MTU 1
- controlling routing table imports 1
- decreasing manual configuration 1
- explained line-by-line 1
- generating error messages 1
- generating persistent configuration changes 1
- generating system log messages 1
- generating transient configuration changes 1
- generating warning messages 1
- limiting number of ATM VCs 1
- limiting number of interfaces 1
- prohibiting configuration statements 1
- reordering routing policies 1
- requiring configuration statements 1
- requiring internal clocking 1
- commit scripts 1
- attributes for customized messages 1
- boilerplate 1
- checksum 1
- commands for monitoring 1
- configuration statement summaries 1
- deactivating 1
- deleting 1
- design considerations 1
- enabling 1
- error messages, generating 1
- examples See commit script examples
- extension functions 1
- usage guidelines 1
- flow of operation illustrated 1
- input and output illustrated 1
- macros 1
- flow of operation illustrated 1
- making optional 1
- master source
- multiple 1
- named templates 1
- output, displaying 1
- overview 1
- persistent configuration changes 1
- remote sources
- specifying storage location 1
- super-user login class, necessity of 1
- system log messages, generating 1
- trace log files 1
- tracing flags 1
- transient configuration changes 1
- troubleshooting 1
- updating
- using multiple 1
- warning messages, generating 1
- commit statement 1
- usage guidelines 1
- concat() XSLT function 1
- concatenating XPath arguments in SLAX 1
- configuration
- configuration (event policy tracing flag) 1
- configuration mode commands
- commit script 1
- contains() XSLT function 1
- context node 1
- controlling
- conventions
- text and syntax 1
- converting
- correlating events in event policy 1
- count() XSLT function 1
- curly braces, in configuration statements 1
- customer support 1
- contacting JTAC 1
- customizing
D
- database (event policy tracing flag) 1
- deactivating
- scripts in the configuration 1
- decreasing manual configuration
- commit script example 1
- delaying file transfer by event policy 1
- deleting
- scripts from the configuration 1
- description statement
- destination statement
- destinations statement 1
- usage guidelines 1
- direct-access statement 1
- usage guidelines 1
- document type definition See DTD
- documentation
- comments on 1
- dot node 1
- DTD
- defined 1
E
- elements
- SLAX 1
- XSLT See XSLT elements
- else if SLAX statement 1
- usage guidelines 1
- else SLAX statement 1
- usage guidelines 1
- equals statement 1
- usage guidelines 1
- error messages, generating custom 1
- example 1
- event policy
- changing privilege level for execution 1
- configuration statement summaries 1
- configuring destinations 1
- configuring file transfer delays 1
- correlating events 1
- delaying file upload 1
- event details
- example See event policy examples
- executing commands 1
- executing op scripts 1
- flow of operation illustrated 1
- generating events 1
- ignoring events 1
- overview 1
- raising SNMP traps 1
- regular expression filtering 1
- retrying file upload 1
- tracing flags 1
- tracing operations 1
- triggering based on event count 1
- triggering by nonstandard system log messages 1
- uploading event files 1
- event policy examples
- event script examples
- limiting policy trigger to specific event 1
- event scripts 1
- boilerplate 1
- checksum 1
- configuration statement summaries 1
- configuring 1
- enabling 1
- examples See event script examples
- executing 1
- extension functions 1
- usage guidelines 1
- master source
- named templates 1
- overview 1
- replacing 1
- specifying storage location 1
- super-user login class, necessity of 1
- trace log files 1
- tracing flags 1
- updating
- using 1
- writing 1
- event-options statement 1
- usage guidelines 1
- event-script statement
- events (tracing flag)
- events statement 1
- usage guidelines 1
- examples
- commit scripts See commit script examples
- event policy See event policy examples
- event scripts See event script examples
- op scripts See op script examples
- execute-commands statement 1
- usage guidelines 1
- executing operational-mode commands 1
- expr statement in SLAX 1
- expressions in SLAX 1
- extension functions See XSLT extension functions
F
G
H
I
J
- jcs:break-lines() XSLT function 1
- jcs:close() XSLT function 1
- jcs:dampen() XSLT function 1
- <jcs:edit-path> XSLT template 1
- <jcs:emit-change> XSLT template 1
- <jcs:emit-comment> XSLT template 1
- jcs:empty() XSLT function 1
- jcs:execute() XSLT function 1
- jcs:first-of() XSLT function 1
- jcs:get-input() XSLT function 1
- jcs:get-secret() XSLT function 1
- jcs:hostname() XSLT function 1
- jcs:invoke() XSLT function 1
- jcs:load-configuration() XSLT function 1
- jcs:open() XSLT function 1
- jcs:output() XSLT function 1
- jcs:parse-ip() XSLT function 1
- jcs:printf() XSLT function 1
- jcs:progress() XSLT function 1
- jcs:regex() XSLT function 1
- jcs:sleep() XSLT function 1
- jcs:split() XSLT function 1
- <jcs:statement> XSLT template 1
- jcs:sysctl() XSLT function 1
- jcs:syslog() XSLT function 1
- jcs:trace() XSLT function 1
- Junos extension functions See XSLT extension functions
- Junos named templates 1
- Junos XML API
- Junos XML management protocol
- Junos XML management protocol session
- brief overview 1
- Junos XML management protocol tags
- notational conventions 1
- Junos XML protocol server 1
- Junos XML RPCs
- sample use in op script 1
- Junos XML tags
- notational conventions 1
- junos.xsl file
K
- KERNEL system log messages
- trigger for event policy 1
L
M
N
O
- offline (tracing flag)
- op command
- op script examples
- op scripts 1
- alias, defining 1
- arguments, declaring 1
- boilerplate 1
- checksum 1
- configuration statement summaries 1
- configuring 1
- enabling 1
- examples See op script examples
- executing 1
- extension functions 1
- usage guidelines 1
- flow of operation illustrated 1
- help text, configuring 1
- master source
- named templates 1
- overview 1
- remote access 1
- specifying storage location 1
- super-user login class, necessity of 1
- trace log files 1
- tracing flags 1
- updating
- using 1
- writing 1
- op statement 1
- usage guidelines 1
- operational mode commands
- operators, regular expression
- optional statement 1
- usage guidelines 1
- output (tracing flag)
- output-filename statement 1
- output-format statement 1
- overview
P
- param SLAX statement 1
- parameters
- parentheses, in syntax descriptions 1
- persistent configuration changes
- PFE system log messages
- trigger for event policy 1
- PIC system log messages
- trigger for event policy 1
- policy (event policy tracing flag) 1
- policy statement 1
- usage guidelines 1
- position() XSLT function 1
- postinheritance, defined 1
- priority SLAX statement 1
- programming instructions, XSLT
- prohibiting configuration statements
- commit script example 1
R
- raise-trap statement 1
- usage guidelines 1
- recursion, XSLT 1
- refresh operation
- refresh statement
- refresh-from statement
- regular expression operators
- remote access for op scripts 1
- remote source for commit scripts
- remote-execution statement 1
- usage guidelines 1
- reordering routing policies
- commit script example 1
- request system scripts event-scripts reload command
- usage guidelines 1
- requiring configuration statements
- commit script example 1
- requiring internal clocking
- commit script example 1
- retry-count statement 1
- usage guidelines 1
- retry-interval statement 1
- usage guidelines 1
- rpc (tracing flag)
- RPCs
S
- SCC system log messages
- trigger for event policy 1
- scripts
- overview 1
- scripts statement 1
- usage guidelines 1
- server See Junos XML protocol server
- server (event policy tracing flag) 1
- session See Junos XML management protocol session
- simplifying
- SLAX
- applying templates 1
- attributes 1
- benefits of 1
- comments 1
- converting to XSLT
- overview 1
- elements 1
- expr statement 1
- expressions 1
- flow of operation illustrated 1
- named templates 1
- overview 1
- parameters 1
- purpose 1
- statements See SLAX statements
- template parameters 1
- using the XSL namespace 1
- using XSLT elements 1
- variables 1
- SLAX statements
- SNMP traps
- source statement
- standard arguments 1
- starts-with statement 1
- usage guidelines 1
- starts-with() XSLT function 1
- statements in SLAX See SLAX statements
- string-length() XSLT function 1
- substring-after() XSLT function 1
- substring-before() XSLT function 1
- super-user login class
- support, technical See technical support
- syntax conventions 1
- <syslog> Junos XML tag 1
- usage guidelines 1
- syslogd (event policy tracing flag) 1
- system log messages
- SYSTEM system log messages
- trigger for event policy 1
T
- tags See Junos XML tags, Junos XML management protocol tags
- tags (XML)
- tags for customized messages 1
- technical support
- contacting JTAC 1
- template SLAX statement 1
- templates See XSLT templates
- then statement 1
- usage guidelines 1
- time-interval statement 1
- usage guidelines 1
- time-of-day statement 1
- usage guidelines 1
- timer-events (event policy tracing flag) 1
- traceoptions statement
- tracing flags 1, See also entries for flag names
- tracing operations
- transfer delay in event policy
- example 1
- transfer-delay statement 1
- transient configuration changes
- <transient-change> XSLT element 1
- traps, SNMP
- trigger statement 1
- usage guidelines 1
- troubleshooting commit scripts 1
U
V
W
X
- XML
- overview 1
- tags See Junos XML tags, Junos XML management protocol tags
- <xnm:error> Junos XML tag 1
- usage guidelines 1
- <xnm:warning> Junos XML tag 1
- usage guidelines 1
- XPath
- <xsl:apply-templates> XSLT element 1
- <xsl:call-template> XSLT element 1
- <xsl:choose> XSLT element 1
- <xsl:choose> XSLT programming instruction 1
- <xsl:comment> XSLT element 1
- <xsl:copy-of> XSLT element 1
- <xsl:element> XSLT element 1
- <xsl:for-each> XSLT element 1
- <xsl:for-each> XSLT programming instruction 1
- <xsl:if> XSLT element 1
- <xsl:if> XSLT programming instruction 1
- <xsl:import> XSLT element 1
- <xsl:otherwise> XSLT element 1
- <xsl:param> XSLT element 1
- <xsl:stylesheet> XSLT element 1
- <xsl:template> XSLT element 1
- <xsl:text> XSLT element 1
- <xsl:value-of> XSLT element 1
- <xsl:variable> XSLT element 1
- <xsl:when> XSLT element 1
- <xsl:with-param> XSLT element 1
- XSLT
- attribute summaries 1
- comments 1
- context node 1
- converting to SLAX
- overview 1
- dot node 1
- element summaries 1
- extension functions 1
- usage guidelines 1
- flow of operation illustrated 1
- function summaries 1
- named templates 1
- namespace, in SLAX 1
- overview 1
- parameters 1
- programming instructions
- recursion 1
- templates 1, See XSLT templates
- unnamed templates 1
- variables 1
- XPath 1
- xslt (tracing flag)
- XSLT elements
- XSLT functions
- concat() 1
- contains() 1
- count() 1
- jcs:break-lines() 1
- jcs:close() 1
- jcs:dampen() 1
- jcs:empty() 1
- jcs:execute() 1
- jcs:first-of() 1
- jcs:get-input() 1
- jcs:get-secret() 1
- jcs:hostname() 1
- jcs:invoke() 1
- jcs:load-configuration() 1
- jcs:open() 1
- jcs:output() 1
- jcs:parse-ip() 1
- jcs:printf() 1
- jcs:progress() 1
- jcs:regex() 1
- jcs:sleep() 1
- jcs:split() 1
- jcs:sysctl() 1
- jcs:syslog() 1
- jcs:trace() 1
- last() 1
- name() 1
- not() 1
- position() 1
- starts-with() 1
- string-length() 1
- substring-after() 1
- substring-before() 1
- XSLT templates
A
C
D
E
F
G
- generate-event statement 1
I
M
N
- not statement 1
O
P
R
S
T
U
V
W
X