Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Requesting a Specific Number of Configuration Objects Using the Junos XML Protocol

In a Junos XML protocol session with a device running Junos OS, to request information about a specific number of configuration objects of a specific type, a client application emits the <get-configuration> tag element and encloses the tag elements that represent all levels of the configuration hierarchy from the root (represented by the <configuration> tag element) down to the immediate parent level for the object type. An empty tag represents the requested object type, and the tag includes the following attributes:

  • count specifies the number of objects to return

  • start specifies the index number of the first object to return (1 for the first object, 2 for the second, and so on)

If the application is requesting only the first object in the hierarchy, it includes the count="1" attribute and omits the start attribute. The application encloses the entire request in an <rpc> tag element.

Note:

The count and start attributes are not supported when requesting configuration data in JSON format.

The Junos XML protocol server returns the requested objects starting with the object specified by the start attribute and running consecutively. When the application requests Junos XML-tagged output (the default), the Junos XML protocol server returns the requested objects in <configuration> and <rpc-reply> tag elements, starting with the object specified by the start attribute and running consecutively.

For each object, the server includes two attributes:

  • junos:position, to specify the object’s numerical index

  • junos:total, to report the total number of such objects that exist in the hierarchy

In the following example Junos XML output, the identifier tag element is called <name>. For information about the attributes in the opening <configuration> tag, see Specifying the Source for Configuration Information Requests in a Junos XML Protocol Session.

The junos:position and junos:total attributes do not appear if the client requests formatted ASCII output by including the format="text" attribute in the <get-configuration> tag element (as described in Specifying the Output Format for Configuration Data in a Junos XML Protocol Session).

To specify the source of the output (candidate or active configuration), the application can include attributes in the opening <get-configuration> tag, its opening <junoscript> tag, or both. For more information, see Specifying the Source for Configuration Information Requests in a Junos XML Protocol Session.

The application can also request additional configuration elements of the same or other types by including the appropriate tag elements in the same <get-configuration> tag element. For more information, see Requesting Multiple Configuration Elements Using the Junos XML Protocol.

The following example shows how to request the third and fourth Junos user accounts at the [edit system login] hierarchy level. The output is from the candidate configuration and is tagged with Junos XML tag elements (the default).