Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Request Commit-Script-Style XML Configuration Data Using the Junos XML Protocol

A Junos XML protocol client application can use the <get-configuration> operation with the commit-scripts attribute to view the configuration in commit-script-style XML.

When you perform a commit operation, each active commit script receives and inspects the post-inheritance candidate configuration in Extensible Markup Language (XML) format. The post-inheritance candidate configuration displays the elements inherited from user-defined groups or interface ranges within the inheriting elements. However, when you view the configuration in the Junos OS CLI using the show configuration | display xml command, the device displays the pre-inheritance candidate configuration. In the CLI, you can include additional filters to view the post-inheritance configuration that would be input to a commit script. Additionally, you can view the configuration with commit script changes applied.

Similarly, when a Junos XML protocol client application uses the <get-configuration> operation, the server returns the pre-inheritance candidate configuration by default. A client application can also request the configuration as commit-script-style XML data by including the commit-scripts attribute. The value of the attribute determines which view the server returns. Table 1 outlines the attribute values, the equivalent CLI command, and a description of the returned data.

Table 1: commit-scripts Attribute Values
commit-scripts Attribute Value CLI Command Description

commit-scripts="view"

show configuration | display commit-scripts view

View the post-inheritance configuration that would be input to a commit script.

commit-scripts="apply"

show configuration | display commit-scripts

View the configuration with commit script changes applied, including both non-transient and transient changes.

commit-scripts="apply-no-transients"

show configuration | display commit-scripts no-transients

View the configuration with commit script changes applied, but include only non-transient changes and exclude transient changes.

The following sections detail how a Junos XML protocol client application requests the configuration in commit-script style XML.

Display the Configuration As Commit Script Input

A Junos XML protocol client application can request the configuration as commit-script-style XML data. To return the post-inheritance configuration that would be input to a commit script, a client application emits the <rpc> and <get-configuration> elements and includes the commit-scripts="view" attribute.

Display the Configuration with Commit Script Changes Applies

In the Junos OS CLI, you can view the configuration with commit script changes applied to verify that the active commit scripts apply your expected changes. Similarly, a Junos XML protocol client can use the <get-configuration> operation to request the configuration with commit script changes applied.

To view the configuration with both non-transient and transient commit script changes applied, a client application includes the commit-scripts="apply" attribute in the <get-configuration> tag.

To view the configuration with only non-transient commit script changes applied, excluding transient changes, a client application includes the commit-scripts="apply-no-transients" attribute in the <get-configuration> tag.

Combine the commit-scripts Attribute with Other Attributes

You can combine the commit-scripts attribute with one or more of the following attributes in the <get-configuration> tag:

  • changed

  • database

  • format

  • groups

  • inherit

  • interface-ranges

  • junos:key

You do not need to include the changed, groups, or inherit attributes with the commit-scripts="view" attribute. The commit-scripts-style XML view includes the junos:changed="changed" attribute in the XML tags, and it displays the output with inheritance applied. Thus, it displays the tag elements inherited from user-defined groups or interface ranges within the inheriting tag elements, and the XML tags already include the junos:group attribute. To explicitly display the junos:interface-range attribute in the commit-scripts-style view, you must include the interface-ranges="interface-ranges" attribute in the <get-configuration> tag.

When a client application includes the commit-scripts="apply" or commit-scripts="apply-no-transients" attribute, it can request the output as formatted ASCII text, configuration mode commands, or JSON. To specify the format, a client application includes the format attribute and sets it to the required format.