Hi Everyone,

Can I get some insight on this please? I was originally going to post it on
Stackoverflow but seeing very little activity decided to use this channel.

I was testing whether it was possible to perform multiple edit operation
through RESTCONF to test the atomicity and rollback-on-error capabilities.
I used YANG PATCH consisting of multiple edits inside a single patch sent
as a curl command through RESTCONF interface as HTTP PATCH. Initially, I
sent two successful “edits” that returned “ok” and successfully updated the
datastore. Happy path :)

Then, I sent the same requests but with one to cause an expected failure(to
understand how ODL restconf behaves in this situation). I noticed that even
though there was an error in the response as shown below, the first edit
successfully executed and performed the changes requested while the second
edit failed as expected. But, what is surprising is that the response shows
both "edit" to have completed with an "ok" as well as listing the returned
error as shown below.

I know RESTCONF or in fact HTTP doesn't have transactions but the requests
themselves are meant to be atomic according to the standards i.e. PATCH.

*RFC5789* - PATCH Method for HTTP - 'Section 2. The PATCH Method'
<https://tools.ietf.org/html/rfc5789> states that:

The server MUST apply the entire set of changes atomically and never
provide (e.g., in response to a GET during this operation) a partially
modified representation. If the entire patch document cannot be
successfully applied, then the server MUST NOT apply any of the changes.

*RFC8072* - YANG PATCH Media Type - 'Section 1. Introduction'
<https://tools.ietf.org/html/rfc8072> states something similar

For any protocol that supports the YANG PATCH ..., if the entire patch
document cannot be successfully applied, then the server MUST NOT apply any
changes.

*Response*

  {
  "ietf-yang-patch:yang-patch-status": {
    "patch-id": "0",
    "errors": {
      "error": [
        {
          "error-type": "application",
          "error-tag": "operation-failed",
          "error-message": "Commit of transaction
org.opendaylight.netconf.sal.connect.netconf.sal.tx.WriteRunningTx@42de5ea3
failed"
        }
      ]
    },
    "edit-status": {
      "edit": [
        {
          "edit-id": "edit1",
          "ok": [
            null
          ]
        },
        {
          "edit-id": "edit1",
          "ok": [
            null
          ]
        }
      ]
    }
  }
}
_______________________________________________
Discuss mailing list
[email protected]
https://lists.opendaylight.org/mailman/listinfo/discuss

Reply via email to