JUNOS 9.4 JUNOScript API Guide

DVD Home
Techpubs Home
Report an Error

Collapse TOC

List of Tables

Index
Index of Statements and Commands

Entire manual as PDF

About This Guide
Objectives
Audience
Supported Platforms
Using the Indexes
Documentation Conventions
List of Technical Publications
Documentation Feedback
Requesting Technical Support
Introduction to the JUNOS XML and JUNOScript APIs
About XML
XML and JUNOScript Tag Elements
Document Type Definition
Advantages of Using the JUNOScript and JUNOS XML APIs
Overview of a JUNOScript Session
Using JUNOScript and JUNOS XML Tag Elements
Complying with XML and JUNOScript Conventions
Request and Response Tag Elements
Child Tag Elements of a Request Tag Element
Child Tag Elements of a Response Tag Element
Spaces, Newline Characters, and Other White Space
XML Comments
XML Processing Instructions
Predefined Entity References
Mapping Commands to JUNOS XML Tag Elements
Mapping for Command Options with Variable Values
Mapping for Fixed-Form Command Options
Mapping Configuration Statements to JUNOS XML Tag Elements
Mapping for Hierarchy Levels and Container Statements
Mapping for Objects That Have an Identifier
Mapping for Single-Value and Fixed-Form Leaf Statements
Mapping for Leaf Statements with Multiple Values
Mapping for Multiple Options on One or More Lines
Mapping for Comments About Configuration Statements
Using the Same Configuration Tag Elements in Requests and Responses
Controlling the JUNOScript Session
Client Application’s Role in a JUNOScript Session
Establishing a JUNOScript Session
Supported Access Protocols
Prerequisites for Establishing a Connection
Prerequisites for All Access Protocols
Prerequisites for Clear-Text Connections
Prerequisites for SSH Connections
Prerequisites for Outbound SSH Connections
Prerequisites for SSL Connections
Prerequisites for Telnet Connections
Connecting to the JUNOScript Server
Connecting to the JUNOScript Server from the CLI
Starting the JUNOScript Session
Emitting the Initialization PI and Tag
Emitting the <?xml?> PI
Emitting the Opening <junoscript> Tag
Parsing the Initialization PI and Tag from the JUNOScript Server
Parsing the JUNOScriptServer’s <?xml?> PI
Parsing the JUNOScriptServer’s Opening <junoscript> Tag
Verifying Software Compatibility
Supported Software Versions
Authenticating with the JUNOScript Server
Submitting an Authentication Request
Providing the Password with the Username
Providing Only the Username
Interpreting the Authentication Response
Server Response When Authentication Succeeds
Server Response When Authentication Fails
Exchanging Information with the JUNOScript Server
Sending a Request to the JUNOScript Server
Request Classes
Operational Requests
Configuration Information Requests
Configuration Change Requests
Including Attributes in the Opening <rpc> Tag
Parsing the JUNOScript Server Response
xmlns:junos Attribute
JUNOScript Server Response Classes
Operational Responses
Configuration Information Responses
Configuration Change Responses
Using a Standard API to Parse Response Tag Elements
Handling an Error or Warning
Halting a Request
Locking and Unlocking the Candidate Configuration or Creating a Private Copy
Locking the Candidate Configuration
Unlocking the Candidate Configuration
Creating a Private Copy of the Configuration
Ending a JUNOScript Session and Closing the Connection
Displaying CLI Output as XML Tag Elements
Example of a JUNOScript Session
Exchanging Initialization PIs and Tag Elements
Sending an Operational Request
Locking the Configuration
Changing the Configuration
Committing the Configuration
Unlocking the Configuration
Closing the JUNOScript Session
Requesting Information
Overview of the Request Procedure
Requesting Operational Information
Parsing the <output> Tag Element
Requesting Configuration Information
Specifying the Source and Output Format of Configuration Information
Requesting Information from the Committed or Candidate Configuration
Requesting Output as Formatted ASCII Text or JUNOS XML Tag Elements
Requesting a Change Indicator for Configuration Elements
Requesting an Indicator for Identifiers
Specifying the Output Format for Configuration Groups
Specifying Whether Configuration Groups Are Displayed Separately
Displaying the Source Group for Inherited Configuration Elements
Examples: Specifying Output Format for Configuration Groups
Specifying the Scope of Configuration Information to Return
Requesting the Complete Configuration
Requesting a Hierarchy Level or Container Object Without an Identifier
Requesting All Configuration Objects of a Specified Type
Requesting a Specified Number of Configuration Objects
Requesting Identifiers Only
Requesting One Configuration Object
Requesting a Subset of Objects by Using Regular Expressions
Requesting Multiple Configuration Elements Simultaneously
Requesting an XML Schema for the Configuration Hierarchy
Creating the junos.xsd File
Example: Requesting an XML Schema
Requesting a Previous (Rollback) Configuration
Comparing Two Previous (Rollback) Configurations
Requesting the Rescue Configuration
Changing Configuration Information
Overview of Configuration Changes
Specifying the Source and Format of New Configuration Data
Providing Configuration Data in a File
Providing Configuration Data as a Data Stream
Defining Configuration Data as Formatted ASCII Text or JUNOS XML Tag Elements
Replacing the Entire Configuration
Replacing the Configuration with New Data
Rolling Back to a Previous or Rescue Configuration
Creating, Modifying, or Deleting Configuration Elements
Merging Configuration Elements
Replacing Configuration Elements
Creating New Configuration Elements
Replacing Configuration Elements Only If They Have Changed
Deleting Configuration Elements
Deleting a Hierarchy Level or Container Object
Deleting a Configuration Object That Has an Identifier
Deleting a Single-Value or Fixed-Form Option from a Configuration Object
Deleting Values from a Multivalue Option of a Configuration Object
Reordering Elements in Configuration Objects
Renaming a Configuration Object
Changing a Configuration Element’s Activation State
Deactivating a Newly Created Element
Deactivating or Reactivating an Existing Element
Changing a Configuration Element’s Activation State Simultaneously with Other Changes
Replacing an Element and Setting Its Activation State
Using JUNOS XML Tag Elements for the Replacement Element
Using Formatted ASCII Text for the Replacement Element
Reordering an Element and Setting Its Activation State
Renaming an Object and Setting Its Activation State
Example: Replacing an Object and Deactivating It
Committing a Configuration
Verifying a Configuration Before Committing It
Committing the Candidate Configuration
Committing a Private Copy of the Configuration
Committing a Configuration at a Specified Time
Committing the Candidate Configuration Only After Confirmation
Committing and Synchronizing a Configuration on Redundant Control Planes
Synchronizing the Configuration on Both Routing Engines
Example: Synchronizing the Configuration on Both Routing Engines
Forcing a Synchronized Commit Operation
Example: Forcing a Synchronization
Synchronizing Configurations Simultaneously with Other Operations
Verifying the Configuration on Both Routing Engines
Scheduling Synchronization for a Specified Time
Synchronizing Configurations but Requiring Confirmation
Logging a Message About Synchronized Configurations
Logging a Message About a Commit Operation
Summary of JUNOScript Tag Elements
<abort/>
<abort-acknowledgement/>
<authentication-response>
<challenge>
<checksum-information>
<close-configuration/>
<commit-configuration>
<commit-results>
<database-status>
<database-status-information>
<end-session/>
<get-checksum-information>
<get-configuration>
<junoscript>
<load-configuration>
<load-configuration-results>
<lock-configuration/>
<open-configuration>
<reason>
<request-end-session/>
<request-login>
<routing-engine>
<rpc>
<rpc-reply>
<unlock-configuration/>
<?xml?>
<xnm:error>
<xnm:warning>
Summary of Attributes in JUNOS XML Tags
active
count
delete
inactive
insert
junos:changed
junos:changed-localtime
junos:changed-seconds
junos:commit-localtime
junos:commit-seconds
junos:commit-user
junos:group
junos:key
junos:position
junos:total
matching
recurse
rename
replace
start
xmlns
Writing Perl Client Applications
Overview of the JUNOS Module and Sample Scripts
Downloading the JUNOS Module and Sample Scripts
Tutorial: Writing Perl Client Applications
Importing Perl Modules and Declaring Constants
Connecting to the JUNOScript Server
Satisfying Protocol Prerequisites
Grouping Requests
Obtaining and Recording Parameters Required by the JUNOS::Device Object
Example: Collecting Parameters Interactively
Obtaining Application-Specific Parameters
Converting Disallowed Characters
Establishing the Connection
Submitting a Request to the JUNOScript Server
Providing Method Options or Attributes
Submitting a Request
Example: Getting an Inventory of Hardware Components
Example: Loading Configuration Statements
Handling Error Conditions
Locking the Configuration
Reading In and Parsing the Configuration Data
Loading the Configuration Data
Committing the Configuration
Parsing and Formatting the Response from the JUNOScript Server
Parsing and Formatting an Operational Response
Parsing and Outputting Configuration Data
Closing the Connection to the JUNOScript Server
Mapping CLI Commands to Perl Methods
Writing C Client Applications
Establishing a JUNOScript Session
Accessing and Editing Router Configurations
Index
Index
Index of Statements and Commands