Subject: [Netconf] YANG Patch target resource issue

From: Martin Bjorklund <[email-masked]>
Date: Mon, 22 Aug 2016 09:51:25 +0200 (CEST)

Hi,

I got a question from a developer if the target resource for a PATCH
request must exist, or if it should be created by the server if it
doesn't exist.

The RESTCONF spec is silent on this issue.

The HTTP spec for PATCH (RFC 5789) says:

   If the Request-URI does not
   point to an existing resource, the server MAY create a new resource,
   depending on the patch document type (whether it can logically modify
   a null resource) and permissions, etc.

This text seems to indicate that each patch-format specification must
indicate if the target resource must exist or not.

If this interpretation is correct, both the YANG Patch document and
RESTCONF (which defines Plain Patch) need to specify this behavior.

Alternatively, RESTCONF should specify this for the PATCH method, for
all patch formats.

/martin

---

From: Ladislav Lhotka <[email-masked]>
Date: Mon, 22 Aug 2016 10:06:42 +0200

> On 22 Aug 2016, at 09:51, Martin Bjorklund <[email-masked]> wrote:
> 
> Hi,
> 

IMO, the server should only "create" an NP-container or a leaf(-list) with a default value specified in the data model. Everything else should result in Error 404.

Lada

> 
> 
> /martin
> 
> _______________________________________________
> Netconf mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netconf

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C

---

From: [email-masked] (Dale R. Worley)
Date: Mon, 22 Aug 2016 11:16:01 -0400

> RESTCONF (which defines Plain Patch) need to specify this behavior.

I agree that this aspect of behavior needs to be specified somewhere.

Looking at draft-ietf-netconf-restconf-15, I see in section 4:

   The "remove" operation attribute for the NETCONF <edit-config>
   operation is not supported by the HTTP DELETE method.  The resource
   must exist or the DELETE method will fail.  The PATCH method is
   equivalent to a "merge" operation when using a plain patch (see
   Section 4.6.1); other media-types may provide more granular control.

This suggests that the resource URL could be non-existing, and the plain
patch creates that resource.

Dale

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 22 Aug 2016 17:48:42 +0200 (CEST)

> patch creates that resource.

I think this text means that the contents of the body of the request
is merged into the datastore.  It doesn't necessarily mean that the
target resource is created if it doesn't exist (and all its
ancestors).

/martin

---

From: Andy Bierman <[email-masked]>
Date: Mon, 22 Aug 2016 09:09:51 -0700

> target resource is created if it doesn't exist (and all its
agreed

IMO the target resource MUST exist for YANG Patch (and plain PATCH
in RESTCONF).

> /martin

Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 22 Aug 2016 19:00:04 +0200 (CEST)

> IMO the target resource MUST exist for YANG Patch (and plain PATCH

I agree.  The text need to make this clear.

/martin