- play_arrow Overview
- play_arrow Junos XML Management Protocol and Junos XML API Overview
- play_arrow Junos XML Protocol and Junos XML Tags Overview
- XML and Junos OS Overview
- XML Overview
- XML and Junos XML Management Protocol Conventions Overview
- Map Junos OS Commands and Command Output to Junos XML Tag Elements
- Map Configuration Statements to Junos XML Tag Elements
- Using Configuration Response Tag Elements in Junos XML Protocol Requests and Configuration Changes
- play_arrow Junos XML Protocol and JSON Overview
-
- play_arrow Manage Configurations Using the Junos XML Protocol
- play_arrow Change the Configuration Using the Junos XML Protocol
- Request Configuration Changes Using the Junos XML Protocol
- Upload and Format Configuration Data in a Junos XML Protocol Session
- Upload Configuration Data as a File Using the Junos XML Protocol
- Upload Configuration Data as a Data Stream Using the Junos XML Protocol
- Define the Format of Configuration Data to Upload in a Junos XML Protocol Session
- Specify the Scope of Configuration Data to Upload in a Junos XML Protocol Session
- Replace the Configuration Using the Junos XML Protocol
- Create, Modify, or Delete Configuration Elements Using the Junos XML Protocol
- Create New Elements in Configuration Data Using the Junos XML Protocol
- Merge Elements in Configuration Data Using the Junos XML Protocol
- Replace Elements in Configuration Data Using the Junos XML Protocol
- Replace Only Updated Elements in Configuration Data Using the Junos XML Protocol
- Delete Elements in Configuration Data Using the Junos XML Protocol
- Rename Objects In Configuration Data Using the Junos XML Protocol
- Reorder Elements In Configuration Data Using the Junos XML Protocol
- Protect or Unprotect a Configuration Object Using the Junos XML Protocol
- Change a Configuration Element’s Activation State Using the Junos XML Protocol
- Change a Configuration Element’s Activation State Simultaneously with Other Changes Using the Junos XML Protocol
- Replace Patterns in Configuration Data Using the NETCONF or Junos XML Protocol
- play_arrow Commit the Configuration on a Device Using the Junos XML Protocol
- Verify Configuration Syntax Using the Junos XML Protocol
- Commit the Candidate Configuration Using the Junos XML Protocol
- Commit a Private Copy of the Configuration Using the Junos XML Protocol
- Commit a Configuration at a Specified Time Using the Junos XML Protocol
- Commit the Candidate Configuration Only After Confirmation Using the Junos XML Protocol
- Commit and Synchronize a Configuration on Redundant Control Planes Using the Junos XML Protocol
- Log a Message About a Commit Operation Using the Junos XML Protocol
- View the Configuration Revision Identifier for Determining Synchronization Status of Devices with NMS
- play_arrow Ephemeral Configuration Database
- Understanding the Ephemeral Configuration Database
- Unsupported Configuration Statements in the Ephemeral Configuration Database
- Enable and Configure Instances of the Ephemeral Configuration Database
- Commit and Synchronize Ephemeral Configuration Data Using the NETCONF or Junos XML Protocol
- Managing Ephemeral Configuration Database Space
-
- play_arrow Request Operational and Configuration Information Using the Junos XML Protocol
- play_arrow Request Operational Information Using the Junos XML Protocol
- play_arrow Request Configuration Information Using the Junos XML Protocol
- Request Configuration Data Using the Junos XML Protocol
- Specify the Source for Configuration Information Requests in a Junos XML Protocol Session
- Specify the Output Format for Configuration Data in a Junos XML Protocol Session
- Request Commit-Script-Style XML Configuration Data Using the Junos XML Protocol
- Specify the Output Format for Configuration Groups and Interface Ranges Using the Junos XML Protocol
- Request Identifier Indicators for Configuration Elements Using the Junos XML Protocol
- Request Change Indicators for Configuration Elements Using the Junos XML Protocol
- Specify the Scope of Configuration Data to Return in a Junos XML Protocol Session
- Request the Complete Configuration Using the Junos XML Protocol
- Request a Configuration Hierarchy Level or Container Object Without an Identifier Using the Junos XML Protocol
- Request All Configuration Objects of a Specific Type Using the Junos XML Protocol
- Request a Specific Number of Configuration Objects Using the Junos XML Protocol
- Request Identifiers for Configuration Objects of a Specific Type Using the Junos XML Protocol
- Request a Single Configuration Object Using the Junos XML Protocol
- Request Subsets of Configuration Objects Using Regular Expressions
- Request Multiple Configuration Elements Using the Junos XML Protocol
- Retrieve a Previous (Rollback) Configuration Using the Junos XML Protocol
- Retrieve the Rescue Configuration Using the Junos XML Protocol
- Compare the Active or Candidate Configuration to a Prior Version Using the Junos XML Protocol
- Compare Two Previous (Rollback) Configurations Using the Junos XML Protocol
- Request an XML Schema for the Configuration Hierarchy Using the Junos XML Protocol
-
- play_arrow Junos XML Protocol Utilities
- play_arrow Develop Junos XML Protocol C Client Applications
-
- play_arrow Configuration Statements and Operational Commands
Example: Trace NETCONF and Junos XML Protocol Session Operations
This example demonstrates how to configure tracing operations for NETCONF and Junos XML protocol sessions.
Starting in Junos OS Release
16.1, when you enable tracing operations at the [edit system
services netconf traceoptions]
hierarchy, Junos OS enables tracing
operations for both NETCONF and Junos XML protocol sessions and adds
the [NETCONF]
and [JUNOScript]
tags to the log file entries to distinguish the type of session.
Prior to Junos OS Release 16.1, only NETCONF session data was logged,
and the [NETCONF]
tag was omitted.
Requirements
A routing, switching, or security device running Junos OS Release 16.1 or later is required.
Overview
This example configures basic tracing operations for NETCONF
and Junos XML protocol sessions. The example configures the trace
file netconf-ops.log and sets a maximum
number of 20 trace files and a maximum size of 3 MB for each
file. The flag all
statement configures tracing for all
incoming and outcoming NETCONF or Junos XML protocol data. The world-readable
option enables unrestricted access to the trace
files.
Configuration
CLI Quick Configuration
To quickly configure this example, copy the following
commands, paste them in a text file, remove any line breaks, change
any details necessary to match your network configuration, and then
copy and paste the commands into the CLI at the [edit]
hierarchy
level.
set system services netconf ssh set system services netconf traceoptions file netconf-ops.log set system services netconf traceoptions file size 3m set system services netconf traceoptions file files 20 set system services netconf traceoptions file world-readable set system services netconf traceoptions flag all
Configuring NETCONF and Junos XML Protocol Tracing Operations
Step-by-Step Procedure
To configure NETCONF and Junos XML protocol tracing operations:
For NETCONF sessions, enable NETCONF over SSH.
content_copy zoom_out_map[edit] user@R1# set system services netconf ssh
Configure the traceoptions flag to specify which session data to capture.
You can specify incoming, outgoing, or all data. This example configures tracing for all session data.
content_copy zoom_out_map[edit] user@R1# set system services netconf traceoptions flag all
(Optional) Configure the filename of the trace file.
The following statement configures the trace file netconf-ops.log, which is stored in the /var/log directory. If you do not specify a filename, NETCONF and Junos XML protocol session data is stored in /var/log/netconf.
content_copy zoom_out_map[edit] user@R1# set system services netconf traceoptions file netconf-ops.log
(Optional) Configure the maximum number of trace files and the maximum size of each file.
The following statements configure a maximum of 20 trace files with a maximum size of 3 MB per file.
content_copy zoom_out_map[edit] user@R1# set system services netconf traceoptions file files 20 user@R1# set system services netconf traceoptions file size 3m
(Optional) Restrict the trace output to include only those lines that match a particular regular expression.
The following configuration, which is not used in this example, matches on and logs only session data that contains “error-message”.
content_copy zoom_out_map[edit] user@R1# set system services netconf traceoptions file match error-message
(Optional) Configure on-demand tracing to control tracing operations from the NETCONF or Junos XML protocol session.
The following configuration, which is not used in this example, enables on-demand tracing.
content_copy zoom_out_map[edit] user@R1# set system services netconf traceoptions on-demand
(Optional) Configure the permissions on the trace file by specifying whether the file is
world-readable
orno-world-readable
.This example enables unrestricted access to the trace file.
content_copy zoom_out_map[edit] user@R1# set system services netconf traceoptions file world-readable
Commit the configuration.
content_copy zoom_out_map[edit] user@R1# commit
Results
[edit] system { services { netconf { ssh; traceoptions { file netconf-ops.log size 3m files 20 world-readable; flag all; } } } }
Verification
Verifying NETCONF and Junos XML protocol Tracing Operation
Purpose
Verify that the device is writing NETCONF and Junos XML protocol session data to the configured trace file. This example logs both incoming and outgoing NETCONF and Junos XML protocol data. In the sample NETCONF session, which is not detailed here, the user modifies the candidate configuration on R1 to include the bgp-troubleshoot.slax op script and then commits the configuration.
Action
Display the trace output of the configured trace file /var/log/netconf-ops.log by issuing the show log operational mode command.
user@R1 show log netconf-ops.log Apr 3 13:09:04 [NETCONF] Started tracing session: 3694 Apr 3 13:09:29 [NETCONF] - [3694] Incoming: <rpc> Apr 3 13:09:29 [NETCONF] - [3694] Outgoing: <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/16.1R1/junos"> Apr 3 13:09:39 [NETCONF] - [3694] Incoming: <edit-config> Apr 3 13:09:43 [NETCONF] - [3694] Incoming: <target> Apr 3 13:09:47 [NETCONF] - [3694] Incoming: <candidate/> Apr 3 13:09:53 [NETCONF] - [3694] Incoming: </target> Apr 3 13:10:07 [NETCONF] - [3694] Incoming: <default-operation>merge</default-operation> Apr 3 13:10:10 [NETCONF] - [3694] Incoming: <config> Apr 3 13:10:13 [NETCONF] - [3694] Incoming: <configuration> Apr 3 13:10:16 [NETCONF] - [3694] Incoming: <system> Apr 3 13:10:19 [NETCONF] - [3694] Incoming: <scripts> Apr 3 13:10:23 [NETCONF] - [3694] Incoming: <op> Apr 3 13:10:26 [NETCONF] - [3694] Incoming: <file> Apr 3 13:10:44 [NETCONF] - [3694] Incoming: <name>bgp-troubleshoot.slax</name> Apr 3 13:10:46 [NETCONF] - [3694] Incoming: </file> Apr 3 13:10:48 [NETCONF] - [3694] Incoming: </op> Apr 3 13:10:52 [NETCONF] - [3694] Incoming: </scripts> Apr 3 13:10:56 [NETCONF] - [3694] Incoming: </system> Apr 3 13:11:00 [NETCONF] - [3694] Incoming: </configuration> Apr 3 13:11:00 [NETCONF] - [3694] Outgoing: <ok/> Apr 3 13:11:12 [NETCONF] - [3694] Incoming: </config> Apr 3 13:11:18 [NETCONF] - [3694] Incoming: </edit-config> Apr 3 13:11:26 [NETCONF] - [3694] Incoming: </rpc> Apr 3 13:11:26 [NETCONF] - [3694] Outgoing: </rpc-reply> Apr 3 13:11:26 [NETCONF] - [3694] Outgoing: ]]>]]> Apr 3 13:11:31 [NETCONF] - [3694] Incoming: ]]>]]> Apr 3 13:14:20 [NETCONF] - [3694] Incoming: <rpc> Apr 3 13:14:20 [NETCONF] - [3694] Outgoing: <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/16.1R1/junos"> Apr 3 13:14:26 [NETCONF] - [3694] Incoming: <commit/> Apr 3 13:14:35 [NETCONF] - [3694] Outgoing: <ok/> Apr 3 13:14:35 [NETCONF] - [3694] Incoming: </rpc> Apr 3 13:14:35 [NETCONF] - [3694] Outgoing: </rpc-reply> Apr 3 13:14:35 [NETCONF] - [3694] Outgoing: ]]>]]> Apr 3 13:14:40 [NETCONF] - [3694] Incoming: ]]>]]> Apr 3 13:30:48 [NETCONF] - [3694] Outgoing: <!-- session end at 2016-12-03 13:30:48 PDT -->
Meaning
This example configured the flag all
statement,
so the trace file displays all incoming and outgoing NETCONF or Junos
XML protocol session operations. Each operation includes the date
and timestamp. The log file indicates the type of session, either
NETCONF or Junos XML protocol, by including the [NETCONF]
or [JUNOScript]
tag, respectively.
Multiple NETCONF and Junos XML protocol sessions are distinguished
by a session number. In this example, only one NETCONF session, using
session identifier 3694, is active.
Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.
[edit system
services netconf traceoptions]
hierarchy, Junos OS enables tracing
operations for both NETCONF and Junos XML protocol sessions and adds
the [NETCONF]
and [JUNOScript]
tags to the log file entries to distinguish the type of session.
Prior to Junos OS Release 16.1, only NETCONF session data was logged,
and the [NETCONF]
tag was omitted.