Examples of synchronous operations in NETCONF

The following example shows a synchronous operation with no specific result data to return.

Request:

<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <action xmlns="urn:ietf:params:xml:ns:yang:1">
    <admin xmlns="urn:nokia.com:sros:ns:yang:sr:oper-admin">
        <clear>
            <security>
                <password-history>
                    <all/>
                </password-history>
            </security>
        </clear>
    </admin>
  </action>
</rpc>
]]>]]>

Response:

<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
       xmlns:nokiaoper="urn:nokia.com:sros:ns:yang:sr:oper-admin">
    <nokiaoper:operation-id>12</nokiaoper:operation-id>
    <nokiaoper:start-time>2021-06-16T20:11:44.9Z</nokiaoper:start-time>
    <nokiaoper:status>completed</nokiaoper:status>
    <nokiaoper:end-time>2021-06-16T20:11:44.9Z</nokiaoper:end-time>
</rpc-reply>
]]>]]>

The following example shows a synchronous operation that returns result data.

Request:

<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <action xmlns="urn:ietf:params:xml:ns:yang:1">
    <file xmlns="urn:nokia.com:sros:ns:yang:sr:oper-file">
        <version>
            <url>cf3://image/both.tim</url>
        </version>
    </file>
  </action>
</rpc>
]]>]]>

Response:

<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
       xmlns:nokiaoper="urn:nokia.com:sros:ns:yang:sr:oper-file">
    <nokiaoper:operation-id>17</nokiaoper:operation-id>
    <nokiaoper:start-time>2021-06-16T20:37:40.3Z</nokiaoper:start-time>
    <nokiaoper:results>
        <nokiaoper:version>
             <nokiaoper:version-number>C-21.5.R1</nokiaoper:version-number>
             <nokiaoper:version-string>TiMOS-C-21.5.R1 for x86_64 Wed May 19 15:02:26
             PDT 2021 by builder in /builds/c/215B/R1/panos/main/sros</nokiaoper:
             version-string>
        </nokiaoper:version>
    </nokiaoper:results>
    <nokiaoper:status>completed</nokiaoper:status>
    <nokiaoper:end-time>2021-06-16T20:37:40.4Z</nokiaoper:end-time>
</rpc-reply>
]]>]]>