Examples of asynchronous operations in NETCONF

The following example shows an asynchronous operation in NETCONF.

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">
        <global-operations xmlns="urn:nokia.com:sros:ns:yang:sr:oper-global">
          <oam>
            <eth-cfm>
              <loopback>
                <asynchronous>true</asynchronous>
                <destination>aa:bb:cc:dd:ee:22</destination>
                <md-admin-name>MyDomain</md-admin-name>
                <ma-admin-name>MyAssociation</ma-admin-name>
                <mep-id>1</mep-id>
                <send-count>5</send-count>
                <timeout>5</timeout>
                <interval>10</interval>
              </loopback>
            </eth-cfm>
          </oam>
        </global-operations>
      </action>
    </rpc>
  ]]>]]>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<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-global">
    <nokiaoper:operation-id>111</nokiaoper:operation-id>
    <nokiaoper:start-time>2021-06-16T14:17:18.3Z</nokiaoper:start-time>
    <nokiaoper:status>in-progress</nokiaoper:status>
</rpc-reply>
]]>]]>

The following example shows the global operations table status while the operation is running.

[/]
A:admin@bkvm30# info state system management-interface operations
    oldest-operation-id 111
    newest-operation-id 111
    operation 111 {
        asynchronous true
        status in-progress
        start-time 2021-06-16T10:17:18.3-04:00
        request-path "/global-operations/oam/eth-cfm/loopback"
        session-id 21
        user "admin"
        execution-timeout {
            time 2021-06-16T11:17:18.3-04:00
            remaining 3599
        }
    }
    next-execution-timeout {
        operation-id 111
        time 2021-06-16T11:17:18.3-04:00
        remaining 3599
    }

The following example shows log event output when the operation is completed.

[/]
A:admin@bkvm30# show log log-id 99

===============================================================================
Event Log 99 log-name 99
===============================================================================
Description : Default System Log
Memory Log contents  [size=500   next event=5  (not wrapped)]

4 2021/06/16 10:17:22.400 EDT WARNING: MGMT_CORE #2005 Base Operation
"operation-id 111 finished with status completed. Presence of messages in the global operations 
table: error-messages false, warning-messages false, info-messages false."

The following is an example of the results available in the state branch.

[/]
A:admin@bkvm30# info state eth-cfm domain MyDomain association MyAssociation mep 1
    loopback-results {
        unicast-latest-run {
            test-status completed
            start-time 2021-06-16T10:17:18.0-04:00
            end-time 2021-06-16T10:17:22.0-04:00
            destination-mac-address aa:bb:cc:dd:ee:22
            statistics {
                sent-packets 5
                received-in-order 5
                received-out-of-order 0
                received-bad-msdu 0
                packet-loss 0.0
            }
        }
        multicast-latest-run {
            statistics {
                sent-packets 0
                received-packets 0
            }
        }
    }

The following example shows the delete operation usage to clean up.

<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="102" 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">
        <system>
            <management-interface>
                <operations>
                    <delete-operation>
                       <delete-id>111</delete-id>
                     </delete-operation>
                </operations>
            </management-interface>
        </system>
   </admin>
  </action>
</rpc>
]]>]]>
<rpc-reply message-id="102" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
       xmlns:nokiaoper="urn:nokia.com:sros:ns:yang:sr:oper-admin">
    <nokiaoper:operation-id>112</nokiaoper:operation-id>
    <nokiaoper:start-time>2021-06-16T14:17:38.5Z</nokiaoper:start-time>
    <nokiaoper:status>completed</nokiaoper:status>
    <nokiaoper:end-time>2021-06-16T14:17:38.6Z</nokiaoper:end-time>
</rpc-reply>
]]>]]>