- play_arrow Overview
- play_arrow NETCONF XML Management Protocol Overview
- play_arrow NETCONF and Junos XML Tags Overview
- XML and Junos OS Overview
- XML Overview
- XML and NETCONF 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 NETCONF Configuration Response Tag Elements in NETCONF Requests and Configuration Changes
-
- play_arrow Manage NETCONF Sessions
- play_arrow NETCONF Session Overview
- play_arrow Manage NETCONF Sessions
- Establish an SSH Connection for a NETCONF Session
- NETCONF Sessions over Transport Layer Security (TLS)
- NETCONF and Shell Sessions over Enhanced Outbound HTTPS
- NETCONF Sessions over Outbound HTTPS
- NETCONF Call Home Sessions
- NETCONF Sessions
- Sample NETCONF Session
- How Character Encoding Works on Juniper Networks Devices
- Configure RFC-Compliant NETCONF Sessions
- NETCONF Monitoring
- NETCONF Event Notifications
- play_arrow NETCONF Tracing Operations
- play_arrow NETCONF Protocol Operations and Attributes
- play_arrow NETCONF Request and Response Tags
- play_arrow Junos XML Protocol Elements Supported in NETCONF Sessions
- <abort/>
- <abort-acknowledgement/>
- <checksum-information>
- <close-configuration/>
- <commit-configuration>
- <commit-results>
- <commit-revision-information>
- <database-status>
- <database-status-information>
- <end-session/>
- <get-checksum-information>
- <get-configuration>
- <load-configuration>
- <load-configuration-results>
- <lock-configuration/>
- <open-configuration>
- <reason>
- <request-end-session/>
- <routing-engine>
- <unlock-configuration/>
- <xnm:error>
- <xnm:warning>
- play_arrow Junos XML Protocol Element Attributes Supported in NETCONF Sessions
-
- play_arrow Manage Configurations Using NETCONF
- play_arrow Change the Configuration Using NETCONF
- Edit the Configuration Using NETCONF
- Upload and Format Configuration Data in a NETCONF Session
- Set the Edit Configuration Mode in a NETCONF Session
- Handle Errors While Editing the Candidate Configuration in a NETCONF Session
- Replace the Candidate Configuration Using NETCONF
- Roll Back Uncommitted Changes in the Candidate Configuration Using NETCONF
- Delete the Configuration Using NETCONF
- Change Individual Configuration Elements Using NETCONF
- Merge Configuration Elements Using NETCONF
- Create Configuration Elements Using NETCONF
- Delete Configuration Elements Using NETCONF
- Replace Configuration Elements Using NETCONF
- Replace Patterns in Configuration Data Using the NETCONF or Junos XML Protocol
- play_arrow Commit the Configuration Using NETCONF
- 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
- Example: Configure the Ephemeral Configuration Database Using NETCONF
-
- play_arrow NETCONF Utilities
- play_arrow NETCONF Perl Client
- play_arrow Develop NETCONF Perl Client Applications
- Write NETCONF Perl Client Applications
- Import Perl Modules and Declare Constants in NETCONF Perl Client Applications
- Connect to the NETCONF Server in Perl Client Applications
- Collect Parameters Interactively in NETCONF Perl Client Applications
- Submit a Request to the NETCONF Server in Perl Client Applications
- Example: Request an Inventory of Hardware Components Using a NETCONF Perl Client Application
- Example: Change the Configuration Using a NETCONF Perl Client Application
- Parse the NETCONF Server Response in Perl Client Applications
- Close the Connection to the NETCONF Server in Perl Client Applications
-
- play_arrow YANG
- play_arrow YANG Overview
- Understanding YANG on Devices Running Junos OS
- Understanding Junos YANG Modules
- YANG Modules Overview
- Understanding the YANG Modules That Define the Junos OS Configuration
- Understanding the YANG Modules for Junos Operational Commands
- Junos Genstate YANG Data Models
- Understanding the Junos DDL Extensions YANG Module
- YANG Metadata Annotations for Junos Devices
- Use Juniper Networks YANG Modules
- play_arrow Create and Use Non-Native YANG Modules
- Understanding the Management of Nonnative YANG Modules on Devices Running Junos OS
- Manage YANG Packages, Modules, and Scripts on Junos Devices
- Managing YANG Packages and Configurations During a Software Upgrade or Downgrade
- Create Translation Scripts for YANG Configuration Models
- Disable and Enable YANG Translation Scripts on Devices Running Junos OS
- Commit and Display Configuration Data for Nonnative YANG Modules
- Create Custom RPCs in YANG for Devices Running Junos OS
- Create Action Scripts for YANG RPCs on Junos Devices
- Use Custom YANG RPCs on Devices Running Junos OS
- Example: Use a Custom YANG RPC to Retrieve Operational Information on Junos Devices
- Understanding Junos OS YANG Extensions for Formatting RPC Output
- Customize YANG RPC Output on Devices Running Junos OS
- Define Different Levels of Output in Custom YANG RPCs for Junos Devices
- Display Valid Command Option and Configuration Statement Values in the CLI for Custom YANG Modules
- Configure a NETCONF Proxy Telemetry Sensor in Junos
-
- play_arrow OpenDaylight Integration
- play_arrow Configure OpenDaylight Integration
-
- play_arrow Configuration Statements and Operational Commands
Specify the Output Format for Operational Information Requests in a NETCONF Session
In a NETCONF session, to request information about a Junos device, a client
application emits an <rpc>
element that encloses a Junos XML
request tag element. To request that the NETCONF server return the output in a
specific format, the client application includes the optional
format
attribute in the opening operational request tag. The
application can request output in formatted ASCII text, JavaScript Object Notation
(JSON), or XML-tagged format. The syntax is as follows:
<rpc> <operational-request format="(ascii | json | json-minified | text | xml | xml-minified)"> <!-- tag elements for options --> </operational-request> </rpc>
Table 1 describes the available formats. Minified formats remove characters that are not required for computer processing, for example, spaces, tabs, and newlines. Minified formats decrease the size of the data, and as a result, can reduce transport costs and data delivery and processing times.
format Attribute Value | Description |
---|---|
ascii | Formatted ASCII text |
json | JavaScript Object Notation (JSON) |
json-minified | JSON format with unnecessary spaces, tabs, and newlines removed |
text | Formatted ASCII text |
xml | Junos XML-tagged format |
xml-minified | Junos XML-tagged format with unnecessary spaces, tabs, and newlines removed |
XML Format
By default, the NETCONF server returns operational information in XML format. If the
format
attribute is set to xml
or if the
format
attribute is omitted, the server returns the response in
XML. The following example requests information for the ge-0/3/0 interface and omits
the format
attribute.
<rpc> <get-interface-information> <brief/> <interface-name>ge-0/3/0</interface-name> </get-interface-information> </rpc>
The NETCONF server returns the information in XML, which is identical to the output
displayed in the CLI when you append the | display xml
filter to
the operational mode command.
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/11.4R1/junos"> <interface-information xmlns="http://xml.juniper.net/junos/11.4R1/junos-interface" junos:style="brief"> <physical-interface> <name>ge-0/3/0</name> <admin-status junos:format="Enabled">up</admin-status> <oper-status>down</oper-status> <link-level-type>Ethernet</link-level-type> <mtu>1514</mtu> <source-filtering>disabled</source-filtering> <speed>1000mbps</speed> <bpdu-error>none</bpdu-error> <l2pt-error>none</l2pt-error> <loopback>disabled</loopback> <if-flow-control>enabled</if-flow-control> <if-auto-negotiation>enabled</if-auto-negotiation> <if-remote-fault>online</if-remote-fault> <if-device-flags> <ifdf-present/> <ifdf-running/> <ifdf-down/> </if-device-flags> <if-config-flags> <iff-hardware-down/> <iff-snmp-traps/> <internal-flags>0x4000</internal-flags> </if-config-flags> <if-media-flags> <ifmf-none/> </if-media-flags> </physical-interface> </interface-information> </rpc-reply>
Operational command RPCs also support returning XML output in minified format, which
omits unnecessary spaces, tabs, and newlines. To request minified XML output in
supported releases, include the format="xml-minified"
attribute in
the opening request tag. For example:
<rpc> <get-interface-information format="xml-minified"> <brief/> <interface-name>ge-0/3/0</interface-name> </get-interface-information> </rpc>
The NETCONF server returns the information in minified XML format.
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/21.1R1/junos"> <interface-information xmlns="http://xml.juniper.net/junos/21.1R1/junos-interface" junos:style="brief"><physical-interface><name>ge-0/3/0</name><admin-status junos:format="Enabled">up</admin-status><oper-status>down</oper-status><link-level-type>Ethernet</link-level-type><mtu>1514</mtu><source-filtering>disabled</source-filtering><speed>1000mbps</speed><bpdu-error>none</bpdu-error><l2pt-error>none</l2pt-error><loopback>disabled</loopback><if-flow-control>enabled</if-flow-control><if-auto-negotiation>enabled</if-auto-negotiation><if-remote-fault>online</if-remote-fault><if-device-flags><ifdf-present/><ifdf-running/><ifdf-down/></if-device-flags><if-config-flags><iff-hardware-down/><iff-snmp-traps/><internal-flags>0x4000</internal-flags></if-config-flags><if-media-flags><ifmf-none/></if-media-flags></physical-interface></interface-information></rpc-reply>
ASCII Format
To request that the NETCONF server return operational information as formatted ASCII
text instead of tagging it with Junos XML tag elements, the client application
includes the format="text"
or format="ascii"
attribute in the opening request tag.
<rpc> <get-interface-information format="(text | ascii)"> <brief/> <interface-name>ge-0/3/0</interface-name> </get-interface-information> </rpc>
When the client application includes the format="text"
or
format="ascii"
attribute in the request tag, the NETCONF server
formats the reply as ASCII text and encloses it in an
<output>
tag element. The format="text"
and format="ascii"
attributes produce identical output.
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/11.4R1/junos"> <output> Physical interface: ge-0/3/0, Enabled, Physical link is Down Link-level type: Ethernet, MTU: 1514, Speed: 1000mbps, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled, Auto-negotiation: Enabled, Remote fault: Online Device flags : Present Running Down Interface flags: Hardware-Down SNMP-Traps Internal: 0x4000 Link flags : None </output> </rpc-reply>
The following example shows the equivalent operational mode command executed in the CLI:
user@host> show interfaces ge-0/3/0 brief Physical interface: ge-0/3/0, Enabled, Physical link is Down Link-level type: Ethernet, MTU: 1514, Speed: 1000mbps, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled, Auto-negotiation: Enabled, Remote fault: Online Device flags : Present Running Down Interface flags: Hardware-Down SNMP-Traps Internal: 0x4000 Link flags : None
The formatted ASCII text returned by the NETCONF server is identical to the CLI output except in cases where the output includes disallowed characters such as '<' (less-than sign), '>' (greater-than sign), and '&' (ampersand). The NETCONF server substitutes these characters with the equivalent predefined entity reference of '<', '>', and '&' respectively.
If the Junos XML API does not define a response tag element for the type of output
requested by a client application, the NETCONF server returns the reply as formatted
ASCII text enclosed in an <output>
tag element, even if
XML-tagged output is requested.
The content and formatting of data within an <output>
tag
element are subject to change, so client applications must not depend on
them.
JSON Format
A client application can request operational and configuration data in JSON format.
To request that the NETCONF server return operational information in JSON format,
the client application includes the format="json"
attribute in the
opening request tag.
<rpc> <get-interface-information format="json"> <brief/> <interface-name>cbp0</interface-name> </get-interface-information> </rpc>
When the client application includes the format="json"
attribute in
the request tag, the NETCONF server formats the reply using JSON.
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/16.1R1/junos"> { "interface-information" : [ { "attributes" : {"xmlns" : "http://xml.juniper.net/junos/16.1R1/junos-interface", "junos:style" : "brief" }, "physical-interface" : [ { "name" : [ { "data" : "cbp0" } ], "admin-status" : [ { "data" : "up", "attributes" : {"junos:format" : "Enabled"} } ], "oper-status" : [ { "data" : "up" } ], "if-type" : [ { "data" : "Ethernet" } ], "link-level-type" : [ { "data" : "Ethernet" } ], "mtu" : [ { "data" : "1514" } ], "speed" : [ { "data" : "Unspecified" } ], "clocking" : [ { "data" : "Unspecified" } ], "if-device-flags" : [ { "ifdf-present" : [ { "data" : [null] } ], "ifdf-running" : [ { "data" : [null] } ] } ], "ifd-specific-config-flags" : [ { "internal-flags" : [ { "data" : "0x0" } ] } ], "if-config-flags" : [ { "iff-snmp-traps" : [ { "data" : [null] } ] } ] } ] } ] } </rpc-reply>
By default, Junos devices emit JSON-formatted state data in non-compact format, which
emits all objects as JSON arrays. In Junos OS Release 24.2 and earlier and Junos OS
Evolved Release 24.2 and earlier, Junos devices support emitting the device’s
operational state in compact JSON format, in which only objects that have multiple
values are emitted as JSON arrays. To configure the device to emit compact JSON
format, configure the compact
statement at the [edit system
export-format state-data json]
hierarchy level.
NETCONF clients can also request operational command RPC output in minified JSON
format, which omits unnecessary spaces, tabs, and newlines. To request minified JSON
output in supported releases, include the format="json-minified"
attribute in the opening request tag. For example:
<rpc> <get-interface-information format="json-minified"> <brief/> <interface-name>cbp0</interface-name> </get-interface-information> </rpc>
The NETCONF server returns the information in minified JSON format.
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/21.1R1/junos"> {"interface-information":[{"physical-interface":[{"name":[{"data":"cbp0"}],"admin-status":[{"data":"up","attributes":{"junos:format":"Enabled"}}],"oper-status":[{"data":"up"}],"if-type":[{"data":"Ethernet"}],"link-level-type":[{"data":"Ethernet"}],"mtu":[{"data":"9192"}],"speed":[{"data":"Unspecified"}],"clocking":[{"data":"Unspecified"}],"if-device-flags":[{"ifdf-present":[{"data":[null]}],"ifdf-running":[{"data":[null]}]}],"ifd-specific-config-flags":[{}],"if-config-flags":[{"iff-snmp-traps":[{"data":[null]}]}]}]}]}</rpc-reply>
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.
compact
statement at the
[edit system export-format state-data json]
hierarchy
level.