<get-configuration>

 

Usage

Release Information

This is a Junos XML management protocol operation. It is supported in Junos XML protocol sessions, and it is supported as a Juniper Networks proprietary extension in NETCONF sessions on devices running Junos OS that identify the URI http://xml.juniper.net/netconf/junos/1.0 in the capabilities exchange.

 

interface-ranges attribute added in Junos OS Release 10.3R1.

commit-scripts attribute values apply and apply-no-transients added in Junos OS Release 12.1

database-path attribute added in Junos OS Release 12.2.

format attribute value json added in Junos OS Release 14.2.

action attribute value set added in Junos OS Release 15.1.

Starting in Junos OS Release 16.1, devices running Junos OS emit JSON-formatted configuration data using a new default implementation for serialization.

Starting in Junos OS Releases 16.1R4, 16.2R2, and 17.1R1, integers in Junos OS configuration data emitted in JSON format are not enclosed in quotation marks.

Description

Request configuration data from the NETCONF or Junos XML protocol server. The attributes specify the source and formatting of the data to display.

If a client application issues the Junos XML protocol <open-configuration> operation to open a specific configuration database before executing the <get-configuration> operation, the server returns the configuration data from the open configuration database. Otherwise, the server returns the configuration data from the candidate configuration, unless the active configuration is explicitly requested by including the database="committed" attribute.

A client application can request the entire configuration hierarchy or a section of it.

  • To display the entire configuration hierarchy, emit the empty <get-configuration/> tag.

  • To display a configuration element (hierarchy level or configuration object), emit tag elements within the <get-configuration> tag element to represent all levels of the configuration hierarchy from the root (represented by the <configuration> tag element) down to the level or object to display. To represent a hierarchy level or a configuration object that does not have an identifier, emit it as an empty tag. To represent an object that has one or more identifiers, emit its container tag element and identifier tag elements only, not any tag elements that represent other characteristics.

Note

To retrieve configuration data from an instance of the ephemeral configuration database, a client application must first open the ephemeral instance using the <open-configuration> operation with the appropriate child tags before emitting the <get-configuration> operation. When retrieving ephemeral configuration data using the <get-configuration> operation, the only supported attributes are format and key.

Note

Starting in Junos OS Release 13.1, within a NETCONF or Junos XML protocol session, a logical system user can use the Junos XML <get-configuration> operation to request specific logical system configuration hierarchies using child configuration tags as well as request the entire logical system configuration. When requesting the entire logical system configuration, the RPC reply includes the <configuration> root tag. Prior to Junos OS Release 13.1, the <configuration> root tag is omitted.

Attributes

changedSpecify that the junos:changed="changed" attribute should appear in the opening tag of each changed configuration element.

The attribute appears in the opening tag of every parent tag element in the path to the changed configuration element, including the top-level opening <configuration> tag. If the changed configuration element is represented by a single (empty) tag, the junos:changed="changed" attribute appears in the tag. If the changed element is represented by a container tag element, the junos:changed="changed" attribute appears in the opening container tag and also in each child tag element enclosed in the container tag element.

The database attribute can be combined with the changed="changed" attribute to request either the candidate or active configuration:

  • When the candidate configuration is requested (the database="candidate" attribute is included or the database attribute is omitted completely), elements added to the candidate configuration after the last commit operation are marked with the junos:changed="changed" attribute.

  • When the active configuration is requested (the database="committed" attribute is included), elements added to the active configuration by the most recent commit are marked with the junos:changed="changed" attribute.

    Note

    When a commit operation succeeds, the server removes the junos:changed="changed" attribute from all tag elements. However, if warnings are generated during the commit, the attribute is not removed. In this case, the junos:changed="changed" attribute appears in tag elements that changed before the commit operation as well as on those that changed after it.

An example of a commit-time warning is the message explaining that a configuration element will not actually apply until the device is rebooted. The warning appears in the tag string that the server returns to confirm the success of the commit, enclosed in an <xnm:warning> tag element.

To remove the junos:changed="changed" attribute from elements that changed before the commit, take the action necessary to eliminate the cause of the warning, and commit the configuration again.

commit-scriptsRequest that the NETCONF or Junos XML protocol server display commit-script-style XML data. The value of the attribute determines the output. Acceptable values are:
  • apply—Display the configuration with commit script changes applied, including both transient and non-transient changes. The output is equivalent to the CLI output when using the | display commit-scripts option.

  • apply-no-transients—Display the configuration with commit script changes applied, but exclude transient changes. The output is equivalent to the CLI output when using the | display commit-scripts no-transients option.

  • view—Display the configuration in the XML format that is input to a commit script. This is equivalent to viewing the configuration with the attributes inherit="inherit", groups="groups", and changed="changed". The output is equivalent to the CLI output when using the | display commit-scripts view option.

compareRequest that the NETCONF or Junos XML protocol server display the differences between the active or candidate configuration and a previously committed configuration. The only acceptable value for the compare attribute is rollback. The compare attribute is combined with the rollback="rollback-number" to specify which previously committed configuration should be used in the comparison. If the rollback attribute is omitted, the comparison uses rollback number 0, which is the active configuration.

When you compare the candidate configuration to the active configuration (rollback="0"), you can display the differences in formats other than text by including the appropriate value for the format attribute in the request. You can display the differences in XML format starting in Junos OS Release 15.1R1, and you can display the differences in JSON format starting in Junos OS Release 16.1R1.

Note

Starting in Junos OS Release 16.2R2, when you compare the candidate and active configurations and display the differences in XML or JSON format, the device omits the <configuration> tag in the XML output and omits the configuration object in the JSON output if the comparison either returns no differences or if the comparison returns differences for only non-native configuration data, for example, configuration data associated with an OpenConfig data model.

The database attribute can be combined with the compare="rollback" attribute to request either the candidate or active configuration. If the database attribute is omitted, the candidate configuration is used. When the compare attribute is used, the default format for the output is text. If the client application attempts to include the format="xml" attribute when the compare="rollback" attribute is present, the server will return an <xnm:error> element indicating an error.

databaseSpecify the version of the configuration from which to display data. There are two acceptable values:
  • candidate—The candidate configuration.

  • committed—The active configuration (the one most recently committed).

The database attribute takes precedence over the database-path attribute, if both are included.

database-pathWithin a commit script, this attribute specifies the path to the session’ s pre-inheritance candidate configuration. The only acceptable value is $junos-context/commit-context/database-path.

For normal configuration sessions, the commit script retrieves the normal, pre-inheritance candidate configuration. For private configuration sessions, the commit script retrieves the private, pre-inheritance candidate configuration.

If you include both the database and the database-path attributes, the database attribute takes precedence.

formatSpecify the format in which the NETCONF or Junos XML protocol server returns the configuration data. Acceptable values are:
  • json—Configuration statements are formatted using JavaScript Object Notation (JSON). Starting in Junos OS Release 16.1, devices running Junos OS emit JSON-formatted configuration data using a new default implementation for serialization.

    Note

    Starting in Junos OS Releases 16.1R4, 16.2R2, and 17.1R1, integers in Junos OS configuration data emitted in JSON format are not enclosed in quotation marks. In earlier releases, integers in JSON configuration data were treated as strings and enclosed in quotation marks.

  • set—Configuration statements are formatted as Junos OS configuration mode set commands.

  • text—Configuration statements are formatted as ASCII text, using the newline character, tabs and other white space, braces, and square brackets to indicate the hierarchical relationships between the statements. This is the format used in configuration files stored on a device running Junos OS and displayed by the CLI show  configuration command.

  • xml—Configuration statements are represented by the corresponding Junos XML tag elements. This is the default value if the format attribute is omitted.

groupsSpecify that the junos:group="group-name" attribute appear in the opening tag for each configuration element that is inherited from a configuration group. The group-name variable specifies the name of the configuration group from which that element was inherited.

The groups attribute must be combined with the inherit attribute, and the one acceptable value for it is groups.

inheritSpecify how the NETCONF or Junos XML protocol server display statements that are defined in configuration groups and interface ranges. If the inherit attribute is omitted, the output uses the <groups>, <apply-groups>, and <apply-groups-except> tag elements to represent user-defined configuration groups and uses the <interface-range> tag element to represent user-defined interface ranges; it does not include tag elements for statements defined in the junos-defaults group.

The acceptable values are:

  • defaults—The output does not include the <groups>, <apply-groups>, and <apply-groups-except> tag elements, but instead displays tag elements that are inherited from user-defined groups and from the junos-defaults group as children of the inheriting tag elements.

  • inherit—The output does not include the <groups>, <apply-groups>, <apply-groups-except>, and <interface-range> tag elements, but instead displays tag elements that are inherited from user-defined groups and ranges as children of the inheriting tag elements. The output does not include tag elements for statements defined in the junos-defaults group.

interface-rangesSpecify that the junos:interface-ranges="source-interface-range" attribute appear in the opening tag for each configuration element that is inherited from an interface range. The source-interface-range variable specifies the name of the interface range.

The interface-ranges attribute must be combined with the inherit attribute, and the one acceptable value for it is interface-ranges.

junos:key | keySpecify that the junos:key="key" attribute appear in the opening tag of each element that serves as an identifier for a configuration object. The only acceptable value is key.