Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

Specify the Source for Configuration Information Requests Using NETCONF

date_range 15-Jul-21

In a NETCONF session with a device running Junos OS, to request information from the candidate configuration or open configuration database, a client application includes the <source> element and <candidate/> tag within the <rpc> and <get-config> tag elements.

content_copy zoom_out_map
<rpc>
    <get-config>
        <source>
            <candidate/>
        </source>
        <filter>
            <!-- tag elements representing the configuration elements to return -->
        </filter>
     </get-config>
</rpc>
]]>]]>
Note:

If a client application issues the Junos XML protocol <open-configuration> operation to open a specific configuration database before executing the <get-config> operation, setting the source to <candidate/> retrieves the configuration data from the open configuration database. Otherwise, the server returns the configuration data from the candidate configuration.

To request information from the active configuration—the one most recently committed on the device—a client application includes the <source> tag element and <running/> tag enclosed within the <rpc> and <get-config> tag elements.

content_copy zoom_out_map
<rpc>
    <get-config>
        <source>
            <running/>
        </source>
        <filter>
             <!-- tag elements representing the configuration elements to return -->
        </filter>
     </get-config>
</rpc>
]]>]]>
Note:

If a client application is requesting the entire configuration, it omits the <filter> tag element.

The NETCONF server encloses its reply in <rpc-reply>, <data>, and <configuration> tag elements. In the opening <configuration> tag, it includes the xmlns attribute to specify the namespace for the enclosed tag elements.

When returning information from the candidate configuration or open configuration database, the NETCONF server includes attributes that indicate when the configuration last changed (they appear on multiple lines here only for legibility).

content_copy zoom_out_map
<rpc-reply xmlns="URN" xmlns:junos="URL">
    <data>
        <configuration xmlns="URL" junos:changed-seconds="seconds" \
            junos:changed-localtime="YYYY-MM-DD hh:mm:ss TZ">
             <!-- Junos XML tag elements representing the configuration -->
          </configuration>
    </data>
</rpc-reply>
]>]]>

junos:changed-localtime represents the time of the last change as the date and time in the device’s local time zone.

junos:changed-seconds represents the time of the last change as the number of seconds since midnight on 1 January 1970.

When returning information from the active configuration, the NETCONF server includes attributes that indicate when the configuration was committed (they appear on multiple lines here only for legibility).

content_copy zoom_out_map
<rpc-reply xmlns="URN" xmlns:junos="URL">
    <data>
        <configuration xmlns="URL" junos:commit-seconds="seconds" \
             junos:commit-localtime="YYYY-MM-DD hh:mm:ss TZ" \
             junos:commit-user="username">
            <!-- Junos XML tag elements representing the configuration -->
         </configuration>
    </data>
</rpc-reply>
]]>]]>

junos:commit-localtime represents the commit time as the date and time in the device’s local time zone.

junos:commit-seconds represents the commit time as the number of seconds since midnight on 1 January 1970.

junos:commit-user specifies the Junos OS username of the user who requested the commit operation.

footer-navigation