<get-configuration>
Usage
<rpc>
<get-configuration [changed="changed"] [database="(candidate | committed)"]
[format="(text | xml)"]
[inherit="(defaults | inherit)" [groups="groups"]]/>
<get-configuration [changed="changed"] [database="(candidate | committed)"]
[format="(text | xml)"]
[inherit="(defaults | inherit)" [groups="groups"]]/>
<!-- tag elements for the configuration element to display -->
</get-configuration>
</rpc>
Description
Request configuration data from the Junos XML protocol server. The attributes specify the source and formatting of the data to display. Either the entire configuration hierarchy or a section can be displayed:
- 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.
changed—Specifies 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="changed" 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="candidate" 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 Junos XML protocol 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 Junos XML protocol 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.
database—Specifies 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)
format—Specifies the format in which the Junos XML protocol server returns the configuration data. There are two acceptable values:
- 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.
groups—Specifies that the junos:group="group-name" attribute appears 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.
The groups attribute must be combined with the inherit attribute, and the one acceptable value for it is groups.
inherit—Specifies how the Junos XML protocol server displays statements that are defined in configuration groups. 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 does not include tag elements for statements defined in the junos-defaults group.
There are two acceptable values:
- 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>, and <apply-groups-except> tag elements, but instead displays tag elements that are inherited from user-defined groups as children of the inheriting tag elements. The output does not include tag elements for statements defined in the junos-defaults group.
Usage Guidelines
See Requesting Configuration Information.
Related Topics
- junos:changed
- junos:group
- <rpc>
- <xnm:warning>
- Junos XML API Configuration Reference
Hide Navigation Pane
Show Navigation Pane
Download
SHA1