Table of Contents
- About This Guide
- Junos Documentation and Release Notes
- Objectives
- Audience
- Supported Platforms
- Using the Indexes
- Using the Examples in This Manual
- Documentation Conventions
- Documentation Feedback
- Requesting Technical Support
- Overview
- Overview of Configuration and Operations Automation
- Junos Automation Scripts Overview
- Commit Scripts
- Op Scripts
- Event Scripts
- Event Policies Overview
- Scripts and Event Policy Configuration Statements
- Any Hierarchy Level
- [edit event-options] Hierarchy Level
- [edit system scripts] Hierarchy Level
- Introduction to the Junos XML Management Protocol and Junos
XML API
- Junos XML Management Protocol and Junos XML API Overview
- XML Overview
- Junos XML and Junos XML Management Protocol Tag Elements
- Document Type Definition
- Advantages of Using the Junos XML Management Protocol and Junos
XML API
- Overview of a Junos XML Protocol Session
- Understanding XSLT
- XSLT Overview
- XPath Overview
- XSLT Templates Overview
- Unnamed Templates
- Named Templates
- XSLT Parameters Overview
- XSLT Variables Overview
- XSLT Programming Instructions Overview
- <xsl:choose> Programming Instruction
- <xsl:for-each> Programming Instruction
- <xsl:if> Programming Instruction
- Sample XSLT Programming Instructions and Pseudocode
- XSLT Recursion Overview
- XSLT Context (Dot) Overview
- Understanding SLAX
- SLAX Overview
- How SLAX Works
- Converting Scripts Between SLAX and XSLT
- Converting a Script from SLAX to XSLT
- Converting a Script from XSLT to SLAX
- SLAX Comments Overview
- SLAX Statements Overview
- for-each Statement
- if, else if, and else Statements
- match Statement
- ns Statement
- version Statement
- SLAX Elements and Element Attributes Overview
- Slax Elements Overview
- SLAX 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
- jcs:edit-path Template
- jcs:emit-change Template
- jcs:emit-comment Template
- jcs:statement Template
- xsl:template match="/" Template
- Summary of XPath and XSLT Constructs
- Summary of Standard XPath and XSLT Functions Referenced in
This Guide
- concat()
- contains()
- count()
- last()
- name()
- not()
- position()
- starts-with()
- string-length()
- substring-after()
- substring-before()
- Summary of Standard XSLT Elements and Attributes Referenced
in This Guide
- xsl:apply-templates
- xsl:call-template
- xsl:choose
- xsl:comment
- xsl:copy-of
- xsl:element
- xsl:for-each
- xsl:if
- xsl:import
- xsl:otherwise
- xsl:param
- xsl:stylesheet
- xsl:template
- xsl:text
- xsl:value-of
- xsl:variable
- xsl:when
- xsl:with-param
- Summary of SLAX Statements
- apply-templates
- call
- else
- for-each
- if
- match
- mode
- param
- priority
- template
- var
- version
- with
- Commit Scripts
- Commit Scripts Overview
- Commit Script Overview
- Advantages of Using Commit Scripts
- How Commit Scripts Work
- Commit Script Input
- Commit Script Output
- Commit Scripts and the Junos OS Commit Model
- Standard Commit Model
- Commit Model with Commit Scripts
- Avoiding Potential Conflicts When Using Multiple Commit Scripts
- Required Boilerplate for Commit Scripts
- Design Considerations for Commit Scripts
- Line-by-Line Explanation of Sample Commit Scripts
- Applying a Change to SONET/SDH Interfaces
- Applying a Change to ISO-Enabled Interfaces
- Writing Commit Scripts That Generate a Custom Warning, Error,
or System Log Message
- Overview of Generating Custom Warning, Error, and System Log
Messages
- Generating a Custom Warning, Error, or System Log Message
- Tag Elements to Use When Generating Messages
- Examples: Generating Custom Warning, Error, and System Log
Messages
- Example: Generating a Custom Warning Message
- Verifying the Warning Message Generated
by the Commit Script
- Example: Generating a Custom Error Message
- Verifying the Error Message Generated by
the Commit Script
- Example: Generating a Custom System Log Message
- Verifying the System Log Message Generated
by the Commit Script
- Writing Commit Scripts That Generate a Persistent or Transient
Configuration Change
- Overview of Generating Persistent or Transient Configuration
Changes
- Differences Between Persistent and Transient Changes
- Interaction of Configuration Changes and Configuration Groups
- Tag Elements and Templates for Generating Changes
- Generating a Persistent or Transient Change
- Removing a Persistent or Transient Change
- Tag Elements to Use When Generating Persistent and Transient
Changes
- Examples: Generating Persistent and Transient Changes
- Example: Generating a Persistent Change
- Verifying the Persistent Change Generated
by the Commit Script
- Example: Generating a Transient Change
- Verifying the Transient Change Generated
by the Commit Script
- Writing Commit Scripts That Create Custom Configuration Syntax
with Macros
- Overview of Creating Custom Configuration Syntax with Macros
- How Macros Work
- Creating a Custom Syntax
- <data> Element
- Expanding the Custom Syntax
- Other Ways to Use Macros
- Creating a Macro to Read the Custom Syntax and Generate Related
Configuration Statements
- Example: Creating Custom Configuration Syntax with Macros
- Verifying the Configuration Statements Generated by the Commit
Script
- Configuring and Troubleshooting Commit Scripts
- Implementing Commit Scripts
- Controlling Execution of Commit Scripts During Commit Operations
- Enabling Commit Scripts to Execute During Commit Operations
- Preventing Commit Scripts from Executing During Commit Operations
- Deactivating Commit Scripts
- Activating Commit Scripts
- 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
- Minimum Configuration for Tracing for Commit Script Operations
- Example: Minimum Configuration for Enabling Traceoptions for
Commit Scripts
- Configuring Tracing of Commit Scripts
- Configuring the Commit Script Log Filename
- Configuring the Number and Size of Commit Script Log Files
- Configuring Access to Commit Script Log Files
- Configuring the Commit Script Trace Operations
- Troubleshooting Commit Scripts
- Commit Script Examples
- Example: Requiring and Restricting Configuration Statements
- Testing the ex-no-nukes Script
- Example: Requiring Internal Clocking on T1 Interfaces
- Testing the ex-clocking-error Script
- Example: Imposing a Minimum MTU Setting
- Testing the ex-so-mtu Script
- Example: Limiting the Number of E1 Interfaces
- Testing the ex-16-e1-limit Script
- Example: Limiting the Number of ATM Virtual Circuits
- Testing the ex-atm-vc-limit Script
- Example: Controlling IS-IS and MPLS Interfaces
- Testing the ex-iso Script
- Example: Adding T1 Interfaces to a RIP Group
- Testing the ex-rip-t1 Script
- Example: Configuring a Default Encapsulation Type
- Testing the ex-so-encap Script
- Example: Controlling LDP Configuration
- Testing the ex-ldp Script
- Example: Adding a Final then accept Term to a Firewall
- Testing the ex-add-accept Script
- Example: Configuring an Interior Gateway Protocol on an Interface
- Testing the ex-if-class Script
- Example: Creating a Complex Configuration Based on a Simple
Interface Configuration
- Testing the ex-if-params Script
- Example: Configuring Administrative Groups for LSPs
- Testing the ex-lsp-admin Script
- Example: Configuring Dual Routing Engines
- Testing the ex-dual-re and ex-dual-re2 Scripts
- Example: Preventing Import of the Full Routing Table
- Testing the ex-import Script
- Example: Automatically Configuring Logical Interfaces and IP
Addresses
- Testing the ex-atm-logical Script
- Example: Prepending a Global Policy
- Testing the ex-bgp-global-import Script
- Example: Assigning a Classifier
- Testing the ex-classifier Script
- Example: Loading a Base Configuration
- Testing the config-system Script
- Summary of Junos XML and XSLT Tag Elements Used in Commit Scripts
- <change> (XSLT)
- <syslog> (Junos XML)
- <transient-change> (XSLT)
- xnm:error (Junos XML)
- xnm:warning (Junos XML)
- Summary of Commit Script Configuration Statements
- allow-transients
- apply-macro
- checksum
- commit
- direct-access
- file (Commit Scripts)
- optional
- refresh (Commit Scripts)
- refresh-from (Commit Scripts)
- scripts
- source (Commit Scripts)
- traceoptions (Commit and Op Scripts)
- Operation (Op) Scripts
- Op Scripts Overview
- Op Script Programming Overview
- How Op Scripts Work
- Writing Op Scripts
- Required Boilerplate for Op Scripts
- Mapping Operational Mode Commands and Output Fields to Junos
XML Notation
- Using RPCs and Operational Mode Commands in Op Scripts
- Using RPCs in Op Scripts
- Using Operational Mode Commands in Op Scripts
- Declaring Arguments in Op Scripts
- Example: Declaring Arguments
- Configuring Help Text for Op Scripts
- Examples: Configuring Help Text for 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 by Issuing the op Command
- Executing an Op Script at Login
- 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
- Minimum Configuration for Enabling Traceoptions for Op Scripts
- Example: Minimum Configuration for Enabling Traceoptions for
Op Scripts
- Configuring Tracing of Op Scripts
- Configuring the Op Script Log Filename
- Configuring the Number and Size of Op Script Log Files
- Configuring Access to Op Script Log Files
- Configuring the Op Script Trace Operations
- Op Script Examples
- Example: Restarting an FPC Using an Op Script
- Testing the ex-fpc Script
- Example: Displaying DNS Hostname Information Using an Op Script
- Testing the ex-hostname Script
- Example: Customizing Output of the show interfaces terse Command
Using an Op Script
- Line-by-Line Explanation of the Script
- Testing the ex-interface Script
- Example: Finding LSPs to Multiple Destinations Using an Op
Script
- Testing the ex-lsp Script
- Example: Importing and Exporting Files Using an Op Script
- Exporting Files to a Remote Server
- Importing Files from a Remote Server
- Summary
of Op Script Configuration Statements
- arguments
- checksum
- command
- description
- file (Op Scripts)
- op
- refresh (Op Scripts)
- refresh-from (Op Scripts)
- scripts
- source (Op Scripts)
- traceoptions
- Event Policy
- Event Policy Overview
- Event Notifications and Policies Overview
- How Event Policies Work
- 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
- Configuring the Event Policy Log Filename
- Configuring the Number and Size of Event Policy Log Files
- Configuring Access to the Log File
- Configuring a Regular Expression for Lines to Be Logged
- Configuring the Trace Operations
- 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
- events (Associating Events with a Policy)
- events (Correlating Events with Each Other)
- 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
- Event Script Programming Overview
- How Event Scripts Work
- Writing Event
Scripts
- Required Boilerplate for Event Scripts
- Mapping Operational Mode Commands and Output Fields to Junos
XML Notation
- Using RPCs and Operational
Mode Commands in Event Scripts
- Using RPCs in Event Scripts
- Using Operational Mode Commands in Event Scripts
- Capturing and Using Event Details and Remote Execution Details
in Event Scripts
- Configuring Event Scripts
- Implementing Event Scripts
- Installing Event Scripts on a Device Running Junos OS
- Replacing an Event Script
- 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
- Minimum Configuration for Enabling Traceoptions for Event Scripts
- Example: Minimum Configuration for Enabling Traceoptions for
Event Scripts
- Configuring Tracing of Event Scripts
- Configuring the Event Script Log Filename
- Configuring the Number and Size of Event Script Log Files
- Configuring Access to Event Script Log Files
- Configuring the Event Script Trace Operations
- Event Script Examples
- Example: Limiting Event Script Output Based on a Specific Event
Type
- Summary of Event Script Configuration Statements
- checksum
- event-script
- file
- refresh
- refresh-from (Event Scripts)
- remote-execution
- source
- traceoptions (Event Scripts)
- Index
- Index
- Index of Statements and Commands