draft-ietf-netconf-yang-patch-14.txt   rfc8072.txt 
Network Working Group A. Bierman Internet Engineering Task Force (IETF) A. Bierman
Internet-Draft YumaWorks Request for Comments: 8072 YumaWorks
Intended status: Standards Track M. Bjorklund Category: Standards Track M. Bjorklund
Expires: May 26, 2017 Tail-f Systems ISSN: 2070-1721 Tail-f Systems
K. Watsen K. Watsen
Juniper Networks Juniper Networks
November 22, 2016 February 2017
YANG Patch Media Type YANG Patch Media Type
draft-ietf-netconf-yang-patch-14
Abstract Abstract
This document describes a method for applying patches to This document describes a method for applying patches to
configuration datastores using data defined with the YANG data configuration datastores using data defined with the YANG data
modeling language. modeling language.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This is an Internet Standards Track document.
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months This document is a product of the Internet Engineering Task Force
and may be updated, replaced, or obsoleted by other documents at any (IETF). It represents the consensus of the IETF community. It has
time. It is inappropriate to use Internet-Drafts as reference received public review and has been approved for publication by the
material or to cite them other than as "work in progress." Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in Section 2 of RFC 7841.
This Internet-Draft will expire on May 26, 2017. Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
http://www.rfc-editor.org/info/rfc8072.
Copyright Notice Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the Copyright (c) 2017 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction ....................................................3
1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Terminology ................................................3
1.1.1. NETCONF . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.1. NETCONF .............................................3
1.1.2. HTTP . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1.2. HTTP ................................................4
1.1.3. YANG . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1.3. YANG ................................................4
1.1.4. RESTCONF . . . . . . . . . . . . . . . . . . . . . . 5 1.1.4. RESTCONF ............................................4
1.1.5. YANG Patch . . . . . . . . . . . . . . . . . . . . . 5 1.1.5. YANG Patch ..........................................5
1.1.6. Examples . . . . . . . . . . . . . . . . . . . . . . 5 1.1.6. Examples ............................................5
1.1.7. Tree Diagram Notations . . . . . . . . . . . . . . . 6 1.1.7. Tree Diagram Notations ..............................6
2. YANG Patch . . . . . . . . . . . . . . . . . . . . . . . . . 6 2. YANG Patch ......................................................6
2.1. Target Resource . . . . . . . . . . . . . . . . . . . . . 7 2.1. Target Resource ............................................7
2.2. yang-patch Request . . . . . . . . . . . . . . . . . . . 8 2.2. yang-patch Request .........................................8
2.3. yang-patch-status Response . . . . . . . . . . . . . . . 9 2.3. yang-patch-status Response .................................9
2.4. Target Data Node . . . . . . . . . . . . . . . . . . . . 10 2.4. Target Data Node ..........................................10
2.5. Edit Operations . . . . . . . . . . . . . . . . . . . . . 11 2.5. Edit Operations ...........................................11
2.6. Successful Edit Response Handling . . . . . . . . . . . . 11 2.6. Successful Edit Response Handling .........................11
2.7. Error Handling . . . . . . . . . . . . . . . . . . . . . 11 2.7. Error Handling ............................................12
2.8. yang-patch RESTCONF Capability . . . . . . . . . . . . . 12 2.8. ":yang-patch" RESTCONF Capability .........................12
3. YANG Module . . . . . . . . . . . . . . . . . . . . . . . . . 12 3. YANG Module ....................................................13
4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21 4. IANA Considerations ............................................22
4.1. YANG Module Registry . . . . . . . . . . . . . . . . . . 21 4.1. Registrations for New URI and YANG Module .................22
4.2. Media Types . . . . . . . . . . . . . . . . . . . . . . . 21 4.2. Media Types ...............................................23
4.2.1. Media Type application/yang-patch+xml . . . . . . . . 21 4.2.1. Media Type "application/yang-patch+xml" ............23
4.2.2. Media Type application/yang-patch+json . . . . . . . 23 4.2.2. Media Type "application/yang-patch+json" ...........24
4.3. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 25 4.3. RESTCONF Capability URNs ..................................25
5. Security Considerations . . . . . . . . . . . . . . . . . . . 25 5. Security Considerations ........................................25
6. Normative References . . . . . . . . . . . . . . . . . . . . 26 6. References .....................................................26
Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 27 6.1. Normative References ......................................26
Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 27 6.2. Informative References ....................................27
B.1. v12 to v13 . . . . . . . . . . . . . . . . . . . . . . . 27 Appendix A. Example YANG Module ...................................28
B.2. v11 to v12 . . . . . . . . . . . . . . . . . . . . . . . 27 A.1. YANG Patch Examples ........................................29
B.3. v10 to v11 . . . . . . . . . . . . . . . . . . . . . . . 28 A.1.1. Add Resources: Error ...................................29
B.4. v09 to v10 . . . . . . . . . . . . . . . . . . . . . . . 28 A.1.2. Add Resources: Success .................................33
B.5. v08 to v09 . . . . . . . . . . . . . . . . . . . . . . . 28 A.1.3. Insert List Entry ......................................35
B.6. v07 to v08 . . . . . . . . . . . . . . . . . . . . . . . 29 A.1.4. Move List Entry ........................................36
B.7. v06 to v07 . . . . . . . . . . . . . . . . . . . . . . . 29 A.1.5. Edit Datastore Resource ................................37
B.8. v05 to v06 . . . . . . . . . . . . . . . . . . . . . . . 29 Acknowledgements ..................................................39
B.9. v04 to v05 . . . . . . . . . . . . . . . . . . . . . . . 29 Authors' Addresses ................................................39
B.10. v03 to v04 . . . . . . . . . . . . . . . . . . . . . . . 30
B.11. v02 to v03 . . . . . . . . . . . . . . . . . . . . . . . 30
B.12. v01 to v02 . . . . . . . . . . . . . . . . . . . . . . . 30
B.13. v00 to v01 . . . . . . . . . . . . . . . . . . . . . . . 30
B.14. bierman:yang-patch-00 to ietf:yang-patch-00 . . . . . . . 31
Appendix C. Open Issues . . . . . . . . . . . . . . . . . . . . 31
Appendix D. Example YANG Module . . . . . . . . . . . . . . . . 31
D.1. YANG Patch Examples . . . . . . . . . . . . . . . . . . . 32
D.1.1. Add Resources: Error . . . . . . . . . . . . . . . . 32
D.1.2. Add Resources: Success . . . . . . . . . . . . . . . 36
D.1.3. Insert list entry example . . . . . . . . . . . . . . 38
D.1.4. Move list entry example . . . . . . . . . . . . . . . 40
D.1.5. Edit datastore resource example . . . . . . . . . . . 41
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 43
1. Introduction 1. Introduction
There is a need for standard mechanisms to patch datastores defined There is a need for standard mechanisms to patch datastores defined
in [RFC6241], which contain conceptual data that conforms to schema in [RFC6241], which contain conceptual data that conforms to schema
specified with YANG [RFC7950]. An "ordered edit list" approach is specified with YANG [RFC7950]. An "ordered 'edit' list" approach is
needed to provide RESTCONF client developers with more precise needed to provide RESTCONF client developers with more precise
RESTCONF client control of the edit procedure than existing RESTCONF client control of the edit procedure than the "plain patch"
mechanisms found in [I-D.ietf-netconf-restconf]. mechanism found in [RFC8040].
This document defines a media type for a YANG-based editing mechanism This document defines a media type for a YANG-based editing mechanism
that can be used with the HTTP PATCH method [RFC5789]. YANG Patch is that can be used with the HTTP PATCH method [RFC5789]. YANG Patch is
designed to support the RESTCONF protocol, defined in designed to support the RESTCONF protocol, defined in [RFC8040].
[I-D.ietf-netconf-restconf]. This document only specifies the use of This document only specifies the use of the YANG Patch media type
the YANG Patch media type with the RESTCONF protocol. with the RESTCONF protocol.
It may be possible to use YANG Patch with other protocols besides It may be possible to use YANG Patch with other protocols besides
RESTCONF. This is outside the scope of this document. For any RESTCONF. This is outside the scope of this document. For any
protocol which supports the YANG Patch media type, if the entire protocol that supports the YANG Patch media type, if the entire patch
patch document cannot be successfully applied, then the server MUST document cannot be successfully applied, then the server MUST NOT
NOT apply any of the changes. It may be possible to use YANG Patch apply any of the changes. It may be possible to use YANG Patch with
with datastore types other than a configuration datastore. This is datastore types other than a configuration datastore. This is
outside the scope of this document. outside the scope of this document.
1.1. Terminology 1.1. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119]. document are to be interpreted as described in [RFC2119].
1.1.1. NETCONF 1.1.1. NETCONF
skipping to change at page 4, line 46 skipping to change at page 4, line 39
o container o container
o data node o data node
o leaf o leaf
o leaf-list o leaf-list
o list o list
o RPC operation (now called protocol operation)
1.1.4. RESTCONF 1.1.4. RESTCONF
The following terms are defined in [I-D.ietf-netconf-restconf]: The following terms are defined in [RFC8040]:
o application/yang-data+xml o application/yang-data+xml
o application/yang-data+json o application/yang-data+json
o data resource o data resource
o datastore resource o datastore resource
o patch o patch
skipping to change at page 5, line 29 skipping to change at page 5, line 14
o RESTCONF capability o RESTCONF capability
o target resource o target resource
o YANG data template o YANG data template
1.1.5. YANG Patch 1.1.5. YANG Patch
The following terms are used within this document: The following terms are used within this document:
o RESTCONF client: a client which implements the RESTCONF protocol. o RESTCONF client: a client that implements the RESTCONF protocol.
o RESTCONF server: a server which implements the RESTCONF protocol. o RESTCONF server: a server that implements the RESTCONF protocol.
o YANG Patch: a conceptual edit request using the "yang-patch" YANG o YANG Patch: a conceptual edit request using the "yang-patch" YANG
Patch template, defined in Section 3. In HTTP, refers to a PATCH Patch template, defined in Section 3. In HTTP, refers to a PATCH
method where a representation uses either the media type method where a representation uses either the media type
"application/yang-patch+xml" or "application/yang-patch+json". "application/yang-patch+xml" or "application/yang-patch+json".
o YANG Patch Status: a conceptual edit status response using the o YANG Patch Status: a conceptual edit status response using the
YANG "yang-patch-status" YANG data template, defined in Section 3. YANG "yang-patch-status" YANG data template, defined in Section 3.
In HTTP, refers to a response message for a PATCH method, where it In HTTP, refers to a response message for a PATCH method, where it
has a representation with either the media type "application/ has a representation with either the media type
yang-data+xml" or "application/yang-data+json". "application/yang-data+xml" or "application/yang-data+json".
o YANG Patch template: this is similar to a YANG data template, o YANG Patch template: similar to a YANG data template, except that
except it has a representation with the media type "application/ it has a representation with the media type
yang-patch+xml" or "application/yang-patch+json". "application/yang-patch+xml" or "application/yang-patch+json".
1.1.6. Examples 1.1.6. Examples
Some protocol message lines within examples throughout the document Some protocol message lines within examples throughout this document
are split into multiple lines for display purposes only. When a line are split into multiple lines for display purposes only. When a line
ends with backslash ('\') as the last character, the line is wrapped ends with a backslash ("\") as the last character, the line is
for display purposes. It is to be considered to be joined to the wrapped for display purposes. It is to be considered to be joined to
next line by deleting the backslash, the following line break, and the next line by deleting the backslash, the following line break,
the leading whitespace of the next line. and the leading whitespace of the next line.
1.1.7. Tree Diagram Notations 1.1.7. Tree Diagram Notations
A simplified graphical representation of the data model is used in A simplified graphical representation of the data model is used in
this document. The meaning of the symbols in these diagrams is as this document. The meanings of the symbols in these diagrams are as
follows: follows:
o Brackets "[" and "]" enclose list keys. o Brackets "[" and "]" enclose list keys.
o Abbreviations before data node names: "rw" means configuration o Abbreviations before data node names: "rw" means configuration
data (read-write), "ro" state data (read-only), and "x" operation data (read-write), "ro" means state data (read-only), and "x"
resource (executable) means operation resource (executable).
o Symbols after data node names: "?" means an optional node and "*" o Symbols after data node names: "?" means an optional node, and "*"
denotes a "list" and "leaf-list". denotes a "list" and "leaf-list".
o Parentheses enclose choice and case nodes, and case nodes are also o Parentheses enclose choice and case nodes, and case nodes are also
marked with a colon (":"). marked with a colon (":").
o Ellipsis ("...") stands for contents of subtrees that are not o Ellipsis ("...") stands for contents of subtrees that are not
shown. shown.
2. YANG Patch 2. YANG Patch
A "YANG Patch" is an ordered list of edits that are applied to the A "YANG Patch" is an ordered list of edits that are applied to the
target datastore by the RESTCONF server. The specific fields are target datastore by the RESTCONF server. The specific fields are
defined in the YANG module in Section 3. defined in the YANG module in Section 3.
The YANG Patch operation is invoked by the RESTCONF client by sending The YANG Patch operation is invoked by the RESTCONF client by
a PATCH method request with a representation using either the sending a PATCH method request with a representation using either
"application/yang-patch+xml" or "application/yang-patch+json" media the media type "application/yang-patch+xml" or
type. This message-body representing the YANG Patch input parameters "application/yang-patch+json". This message-body representing the
MUST be present. YANG Patch input parameters MUST be present.
YANG Patch has some features that are not possible with the PATCH YANG Patch has some features that are not possible with the
method in RESTCONF: "plain-patch" mechanism defined in RESTCONF [RFC8040]:
o YANG Patch allows multiple sub-resources to be edited within the o YANG Patch allows multiple sub-resources to be edited within the
same PATCH method. same PATCH method.
o YANG Patch allows more precise edit operations than RESTCONF. o YANG Patch allows a more precise edit operation than the
There are 7 operations supported (create, delete, insert, merge, "plain patch" mechanism found in [RFC8040]. There are seven
move, replace, remove). operations supported ("create", "delete", "insert", "merge",
"move", "replace", and "remove").
o YANG Patch uses an edit list with an explicit processing order. o YANG Patch uses an "edit" list with an explicit processing order.
The edits are processed in client-specified order, and error The edits are processed in client-specified order, and error
processing can be precise even when multiple errors occur in the processing can be precise even when multiple errors occur in the
same patch request. same YANG Patch request.
The YANG Patch "patch-id" may be useful for debugging, and SHOULD be The YANG Patch "patch-id" may be useful for debugging and SHOULD be
present in any audit audit logging records generated by the RESTCONF present in any audit logging records generated by the RESTCONF server
server for a patch. for a patch.
The RESTCONF server MUST return the Accept-Patch header field in an The RESTCONF server MUST return the "Accept-Patch" header field in an
OPTIONS response, as specified in [RFC5789], which includes the media OPTIONS response, as specified in [RFC5789], which includes the
type for YANG Patch. This is needed by a client to determine the media type for YANG Patch. This is needed by a client to determine
message encoding formats supported by the server (e.g., XML, JSON, or the message-encoding formats supported by the server (e.g., XML,
both). An example is shown in Figure 1. JSON, or both). The following is an example of an "Accept-Patch"
header:
Accept-Patch: application/yang-patch+xml,application/yang-patch+json Accept-Patch: application/yang-patch+xml,application/yang-patch+json
Figure 1: Example Accept-Patch header
Note that YANG Patch can only edit data resources. The PATCH method Note that YANG Patch can only edit data resources. The PATCH method
cannot be used to replace the datastore resource. Although the cannot be used to replace the datastore resource. Although the
"ietf-yang-patch" YANG module is written using YANG version 1.1 "ietf-yang-patch" YANG module is written using YANG version 1.1
[RFC7950], an implementation of YANG Patch can be used with content [RFC7950], an implementation of YANG Patch can be used with content
defined in YANG version 1 [RFC6020] as well. defined in YANG version 1 [RFC6020] as well.
A YANG Patch can be encoded in XML format according to A YANG Patch can be encoded in XML format according to
[W3C.REC-xml-20081126]. It can also be encoded in JSON, according to [W3C.REC-xml-20081126]. It can also be encoded in JSON according to
"JSON Encoding of Data Modeled with YANG" [RFC7951]. If any meta- "JSON Encoding of Data Modeled with YANG" [RFC7951]. If any metadata
data needs to be sent in a JSON message, it is encoded according to needs to be sent in a JSON message, it is encoded according to
"Defining and Using Metadata with YANG" [RFC7952]. "Defining and Using Metadata with YANG" [RFC7952].
2.1. Target Resource 2.1. Target Resource
The YANG Patch operation uses the RESTCONF target resource URI to The YANG Patch operation uses the RESTCONF target resource URI to
identify the resource that will be patched. This can be the identify the resource that will be patched. This can be the
datastore resource itself, i.e., "{+restconf}/data", to edit top- datastore resource itself, i.e., "{+restconf}/data", to edit
level configuration data resources, or it can be a configuration data top-level configuration data resources, or it can be a configuration
resource within the datastore resource, e.g., "{+restconf}/data/ data resource within the datastore resource, e.g.,
ietf-interfaces:interfaces", to edit sub-resources within a top-level "{+restconf}/data/ietf-interfaces:interfaces", to edit sub-resources
configuration data resource. within a top-level configuration data resource.
The target resource MUST identify exactly one resource instance. If The target resource MUST identify exactly one resource instance. If
more than one resource instance is identified, then the request MUST more than one resource instance is identified, then the request
NOT be processed, and a "400 Bad Request" error response MUST be sent MUST NOT be processed and a "400 Bad Request" error response MUST be
by the server. If the target resource does not identify any existing sent by the server. If the target resource does not identify any
resource instance then the request MUST NOT be processed, and a "404 existing resource instance, then the request MUST NOT be processed
Not Found" error response MUST be sent by the server. and a "404 Not Found" error response MUST be sent by the server.
Each edit with a YANG Patch identifies a target data node for the Each edit with a YANG Patch identifies a target data node for the
associated edit. This is described in Section 2.4. associated edit. This is described in Section 2.4.
2.2. yang-patch Request 2.2. yang-patch Request
A YANG patch is optionally identified by a unique "patch-id" and it A YANG Patch is identified by a unique "patch-id", and it may have an
may have an optional comment. A patch is an ordered collection of optional comment. A patch is an ordered collection of edits. Each
edits. Each edit is identified by an "edit-id" and it has an edit edit is identified by an "edit-id", and it has an edit operation
operation (create, delete, insert, merge, move, replace, remove) that ("create", "delete", "insert", "merge", "move", "replace", or
is applied to the target resource. Each edit can be applied to a "remove") that is applied to the target resource. Each edit can be
sub-resource "target" within the target resource. If the operation applied to a sub-resource "target" within the target resource. If
is "insert" or "move", then the "where" parameter indicates how the the operation is "insert" or "move", then the "where" parameter
node is inserted or moved. For values "before" and "after", the indicates how the node is inserted or moved. For values "before" and
"point" parameter specifies the data node insertion point. "after", the "point" parameter specifies the data node insertion
point.
The merge, replace, create, delete, and remove edit operations have The "merge", "replace", "create", "delete", and "remove" edit
the exact same meaning as defined for the "operation" attribute in operations have exactly the same meanings as those defined for the
section 7.2 of [RFC6241]. "operation" attribute described in Section 7.2 of [RFC6241].
Each edit within a YANG Patch MUST identify exactly one data resource Each edit within a YANG Patch MUST identify exactly one data resource
instance. If an edit represents more than one resource instance, instance. If an edit represents more than one resource instance,
then the request MUST NOT be processed, and a "400 Bad Request" error then the request MUST NOT be processed and a "400 Bad Request" error
response MUST be sent by the server. If the edit does not identify response MUST be sent by the server. If the edit does not identify
any existing resource instance, and the operation for the edit is not any existing resource instance and the operation for the edit is not
"create", then the request MUST NOT be processed, and a "404 Not "create", then the request MUST NOT be processed and a "404 Not
Found" error response MUST be sent by the server. A Found" error response MUST be sent by the server. A
"yang-patch-status" response MUST be sent by the server identifying "yang-patch-status" response MUST be sent by the server identifying
the edit(s) that are not valid. the edit or edits that are not valid.
YANG Patch does not provide any access to specific datastores. It is YANG Patch does not provide any access to specific datastores. How a
an implementation detail how a server processes an edit if it is co- server processes an edit if it is co-located with a Network
located with a NETCONF server that does provide access to individual Configuration Protocol (NETCONF) server that does provide access to
datastores. A complete datastore cannot be replaced in the same individual datastores is left up to the implementation. A complete
manner as provided by the "copy-config" operation defined in section datastore cannot be replaced in the same manner as that provided by
7.3 of [RFC6241]. Only the specified nodes in a YANG Patch are the <copy-config> operation defined in Section 7.3 of [RFC6241].
affected. Only the specified nodes in a YANG Patch are affected.
A message-body representing the YANG Patch is sent by the RESTCONF A message-body representing the YANG Patch is sent by the RESTCONF
client to specify the edit operation request. When used with the client to specify the edit operation request. When used with the
HTTP PATCH method, this data is identified by the YANG Patch media HTTP PATCH method, this data is identified by the YANG Patch
type. media type.
YANG tree diagram for "yang-patch" container:
YANG tree diagram for "yang-patch" Container
+---- yang-patch +---- yang-patch
+---- patch-id string +---- patch-id string
+---- comment? string +---- comment? string
+---- edit* [edit-id] +---- edit* [edit-id]
+---- edit-id string +---- edit-id string
+---- operation enumeration +---- operation enumeration
+---- target target-resource-offset +---- target target-resource-offset
+---- point? target-resource-offset +---- point? target-resource-offset
+---- where? enumeration +---- where? enumeration
+---- value? +---- value?
2.3. yang-patch-status Response 2.3. yang-patch-status Response
A message-body representing the YANG Patch Status is returned to the A message-body representing the YANG Patch Status is returned to the
RESTCONF client to report the detailed status of the edit operation. RESTCONF client to report the detailed status of the edit operation.
When used with the HTTP PATCH method, this data is identified by the When used with the HTTP PATCH method, this data is identified by the
YANG Patch Status media type, and the syntax specification is defined YANG Patch Status media type; the syntax specification is defined in
in Section 3. Section 3.
YANG tree diagram for "yang-patch-status" Container: YANG tree diagram for "yang-patch-status" container:
+---- yang-patch-status +---- yang-patch-status
+---- patch-id string +---- patch-id string
+---- (global-status)? +---- (global-status)?
| +--:(global-errors) | +--:(global-errors)
| | +---- errors | | +---- errors
| | +---- error* | | +---- error*
| | +---- error-type enumeration | | +---- error-type enumeration
| | +---- error-tag string | | +---- error-tag string
| | +---- error-app-tag? string | | +---- error-app-tag? string
skipping to change at page 10, line 46 skipping to change at page 10, line 48
The target data node for each edit operation is determined by the The target data node for each edit operation is determined by the
value of the target resource in the request and the "target" leaf value of the target resource in the request and the "target" leaf
within each "edit" entry. within each "edit" entry.
If the target resource specified in the request URI identifies a If the target resource specified in the request URI identifies a
datastore resource, then the path string in the "target" leaf is datastore resource, then the path string in the "target" leaf is
treated as an absolute path expression identifying the target data treated as an absolute path expression identifying the target data
node for the corresponding edit. The first node specified in the node for the corresponding edit. The first node specified in the
"target" leaf is a top-level data node defined within a YANG module. "target" leaf is a top-level data node defined within a YANG module.
The "target" leaf MUST NOT contain a single forward slash "/", since The "target" leaf MUST NOT contain a single forward slash ("/"),
this would identify the datastore resource, not a data resource. since this would identify the datastore resource, not a data
resource.
If the target resource specified in the request URI identifies a If the target resource specified in the request URI identifies a
configuration data resource, then the path string in the "target" configuration data resource, then the path string in the "target"
leaf is treated as a relative path expression. The first node leaf is treated as a relative path expression. The first node
specified in the "target" leaf is a child configuration data node of specified in the "target" leaf is a child configuration data node of
the data node associated with the target resource. If the "target" the data node associated with the target resource. If the "target"
leaf contains a single forward slash "/", then the target data node leaf contains a single forward slash ("/"), then the target data node
is the target resource data node. is the target resource data node.
2.5. Edit Operations 2.5. Edit Operations
Each YANG patch edit specifies one edit operation on the target data Each YANG Patch edit specifies one edit operation on the target data
node. The set of operations is aligned with the NETCONF edit node. The set of operations is aligned with the NETCONF edit
operations, but also includes some new operations. operations but also includes some new operations.
+-----------+-------------------------------------------------------+ +-----------+-------------------------------------------------------+
| Operation | Description | | Operation | Description |
+-----------+-------------------------------------------------------+ +-----------+-------------------------------------------------------+
| create | create a new data resource if it does not already | | create | create a new data resource if it does not already |
| | exist or error | | | exist; if it already exists, return an error |
| delete | delete a data resource if it already exists or error | | | |
| delete | delete a data resource if it already exists; if it |
| | does not exist, return an error |
| | |
| insert | insert a new user-ordered data resource | | insert | insert a new user-ordered data resource |
| | |
| merge | merge the edit value with the target data resource; | | merge | merge the edit value with the target data resource; |
| | create if it does not already exist | | | create if it does not already exist |
| move | re-order the target data resource | | | |
| move | reorder the target data resource |
| | |
| replace | replace the target data resource with the edit value | | replace | replace the target data resource with the edit value |
| | |
| remove | remove a data resource if it already exists | | remove | remove a data resource if it already exists |
+-----------+-------------------------------------------------------+ +-----------+-------------------------------------------------------+
YANG Patch Edit Operations YANG Patch Edit Operations
2.6. Successful Edit Response Handling 2.6. Successful Edit Response Handling
If a YANG Patch is completed without errors, the RESTCONF server MUST If a YANG Patch is completed without errors, the RESTCONF server MUST
return a "yang-patch-status" message with a global-status choice set return a "yang-patch-status" message with a "global-status" choice
to 'ok'. set to "ok".
The RESTCONF server will save the running datastore to non-volatile
storage if it supports non-volatile storage, and if the running
datastore contents have changed, as specified in
[I-D.ietf-netconf-restconf].
Refer to Appendix D.1.2 for a example of a successful YANG Patch Refer to Appendix A.1.2 for an example of a successful YANG Patch
response. response.
2.7. Error Handling 2.7. Error Handling
If a well-formed, schema-valid YANG Patch message is received, then If a well-formed, schema-valid YANG Patch message is received, then
the RESTCONF server will process the supplied edits in ascending the RESTCONF server will process the supplied edits in ascending
order. The following error modes apply to the processing of this order. The following error modes apply to the processing of this
edit list: "edit" list:
If a YANG Patch is completed with errors, the RESTCONF server SHOULD If a YANG Patch is completed with errors, the RESTCONF server SHOULD
return a "yang-patch-status" message. It is possible (e.g., within a return a "yang-patch-status" message. It is possible (e.g., within a
distributed implementation), that an invalid request will be rejected distributed implementation) that an invalid request will be rejected
before the YANG patch edits are processed. In this case, the server before the YANG Patch edits are processed. In this case, the server
MUST send the appropriate HTTP error response instead. MUST send the appropriate HTTP error response instead.
Refer to Appendix D.1.1 for a example of an error YANG Patch Refer to Appendix A.1.1 for an example of an error YANG Patch
response. response.
2.8. yang-patch RESTCONF Capability 2.8. ":yang-patch" RESTCONF Capability
A URI is defined to identify the YANG Patch extension to the base A URI is defined to identify the YANG Patch extension to the base
RESTCONF protocol. If the RESTCONF server supports the YANG Patch RESTCONF protocol. If the RESTCONF server supports the YANG Patch
media type, then the "yang-patch" RESTCONF capability defined in media type, then the ":yang-patch" RESTCONF capability defined in
Section 4.3 MUST be present in the "capability" leaf-list in the Section 4.3 MUST be present in the "capability" leaf-list in the
"ietf-restconf-monitoring" module defined in "ietf-restconf-monitoring" module defined in [RFC8040].
[I-D.ietf-netconf-restconf].
3. YANG Module 3. YANG Module
The "ietf-yang-patch" module defines conceptual definitions with the The "ietf-yang-patch" module defines conceptual definitions with the
'yang-data' extension statements, which are not meant to be "yang-data" extension statements, which are not meant to be
implemented as datastore contents by a RESTCONF server. implemented as datastore contents by a RESTCONF server.
The "ietf-restconf" module from [I-D.ietf-netconf-restconf] is used The "ietf-restconf" module from [RFC8040] is used by this module for
by this module for the 'yang-data' extension definition. the "yang-data" extension definition.
RFC Ed.: update the date below with the date of RFC publication and
remove this note.
<CODE BEGINS> file "ietf-yang-patch@2016-11-09.yang"
module ietf-yang-patch {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-patch";
prefix "ypatch";
import ietf-restconf { prefix rc; }
organization
"IETF NETCONF (Network Configuration) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/netconf/>
WG List: <mailto:netconf@ietf.org>
Author: Andy Bierman
<mailto:andy@yumaworks.com>
Author: Martin Bjorklund
<mailto:mbj@tail-f.com>
Author: Kent Watsen
<mailto:kwatsen@juniper.net>";
description <CODE BEGINS>
"This module contains conceptual YANG specifications
for the YANG Patch and YANG Patch Status data structures.
Note that the YANG definitions within this module do not file "ietf-yang-patch@2017-02-22.yang"
represent configuration data of any kind.
The YANG grouping statements provide a normative syntax
for XML and JSON message encoding purposes.
Copyright (c) 2016 IETF Trust and the persons identified as module ietf-yang-patch {
authors of the code. All rights reserved. yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-patch";
prefix "ypatch";
Redistribution and use in source and binary forms, with or import ietf-restconf { prefix rc; }
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; see organization
the RFC itself for full legal notices."; "IETF NETCONF (Network Configuration) Working Group";
// RFC Ed.: replace XXXX with actual RFC number and remove this contact
// note. "WG Web: <https://datatracker.ietf.org/wg/netconf/>
WG List: <mailto:netconf@ietf.org>
// RFC Ed.: remove this note Author: Andy Bierman
// Note: extracted from draft-ietf-netconf-yang-patch-14.txt <mailto:andy@yumaworks.com>
// RFC Ed.: update the date below with the date of RFC publication Author: Martin Bjorklund
// and remove this note. <mailto:mbj@tail-f.com>
revision 2016-11-09 {
description
"Initial revision.";
reference
"RFC XXXX: YANG Patch Media Type.";
}
typedef target-resource-offset { Author: Kent Watsen
type string; <mailto:kwatsen@juniper.net>";
description
"Contains a data resource identifier string representing
a sub-resource within the target resource.
The document root for this expression is the description
target resource that is specified in the "This module contains conceptual YANG specifications
protocol operation (e.g., the URI for the PATCH request). for the YANG Patch and YANG Patch Status data structures.
This string is encoded according the same rules as Note that the YANG definitions within this module do not
a data resource identifier in a RESTCONF Request URI."; represent configuration data of any kind.
The YANG grouping statements provide a normative syntax
for XML and JSON message-encoding purposes.
// RFC Ed.: replace "draft-ietf-netconf-restconf" below Copyright (c) 2017 IETF Trust and the persons identified as
// with RFC XXXX, where XXXX is the number of the RESTCONF RFC, authors of the code. All rights reserved.
// and remove this note.
reference Redistribution and use in source and binary forms, with or
"draft-ietf-netconf-restconf, section 3.5.3"; without modification, is permitted pursuant to, and subject
} to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
rc:yang-data "yang-patch" { This version of this YANG module is part of RFC 8072; see
uses yang-patch; the RFC itself for full legal notices.";
}
rc:yang-data "yang-patch-status" { revision 2017-02-22 {
uses yang-patch-status; description
} "Initial revision.";
reference
"RFC 8072: YANG Patch Media Type.";
}
grouping yang-patch { typedef target-resource-offset {
type string;
description
"Contains a data resource identifier string representing
a sub-resource within the target resource.
The document root for this expression is the
target resource that is specified in the
protocol operation (e.g., the URI for the PATCH request).
description This string is encoded according to the same rules as those
"A grouping that contains a YANG container for a data resource identifier in a RESTCONF request URI.";
representing the syntax and semantics of a reference
YANG Patch edit request message."; "RFC 8040, Section 3.5.3.";
}
container yang-patch { rc:yang-data "yang-patch" {
description uses yang-patch;
"Represents a conceptual sequence of datastore edits, }
called a patch. Each patch is given a client-assigned
patch identifier. Each edit MUST be applied
in ascending order, and all edits MUST be applied.
If any errors occur, then the target datastore MUST NOT
be changed by the patch operation.
YANG datastore validation is performed before any edits rc:yang-data "yang-patch-status" {
have been applied to the running datastore. uses yang-patch-status;
}
grouping yang-patch {
It is possible for a datastore constraint violation to occur description
due to any node in the datastore, including nodes not "A grouping that contains a YANG container representing the
included in the edit list. Any validation errors MUST syntax and semantics of a YANG Patch edit request message.";
be reported in the reply message.";
reference container yang-patch {
"RFC 7950, section 8.3."; description
"Represents a conceptual sequence of datastore edits,
called a patch. Each patch is given a client-assigned
patch identifier. Each edit MUST be applied
in ascending order, and all edits MUST be applied.
If any errors occur, then the target datastore MUST NOT
be changed by the YANG Patch operation.
leaf patch-id { It is possible for a datastore constraint violation to occur
type string; due to any node in the datastore, including nodes not
mandatory true; included in the 'edit' list. Any validation errors MUST
description be reported in the reply message.";
"An arbitrary string provided by the client to identify
the entire patch. Error messages returned by the server
pertaining to this patch will be identified by this
patch-id value. A client SHOULD attempt to generate
unique patch-id values to distinguish between transactions
from multiple clients in any audit logs maintained
by the server.";
}
leaf comment { reference
type string; "RFC 7950, Section 8.3.";
description
"An arbitrary string provided by the client to describe
the entire patch. This value SHOULD be present in any
audit logging records generated by the server for the
patch.";
}
list edit { leaf patch-id {
key edit-id; type string;
ordered-by user; mandatory true;
description
"An arbitrary string provided by the client to identify
the entire patch. Error messages returned by the server
that pertain to this patch will be identified by this
'patch-id' value. A client SHOULD attempt to generate
unique 'patch-id' values to distinguish between
transactions from multiple clients in any audit logs
maintained by the server.";
}
description leaf comment {
"Represents one edit within the YANG Patch type string;
request message. The edit list is applied description
in the following manner: "An arbitrary string provided by the client to describe
the entire patch. This value SHOULD be present in any
audit logging records generated by the server for the
patch.";
}
list edit {
key edit-id;
ordered-by user;
- The first edit is conceptually applied to a copy description
of the existing target datastore, e.g., the "Represents one edit within the YANG Patch request message.
running configuration datastore. The 'edit' list is applied in the following manner:
- Each ascending edit is conceptually applied to
the result of the previous edit(s).
- After all edits have been successfully processed,
the result is validated according to YANG constraints.
- If successful, the server will attempt to apply
the result to the target datastore. ";
leaf edit-id { - The first edit is conceptually applied to a copy
type string; of the existing target datastore, e.g., the
description running configuration datastore.
"Arbitrary string index for the edit. - Each ascending edit is conceptually applied to
Error messages returned by the server pertaining the result of the previous edit(s).
to a specific edit will be identified by this - After all edits have been successfully processed,
value."; the result is validated according to YANG constraints.
} - If successful, the server will attempt to apply
the result to the target datastore.";
leaf operation { leaf edit-id {
type enumeration { type string;
enum create { description
description "Arbitrary string index for the edit.
"The target data node is created using the supplied Error messages returned by the server that pertain
value, only if it does not already exist. The to a specific edit will be identified by this value.";
'target' leaf identifies the data node to be created, }
not the parent data node.";
}
enum delete {
description
"Delete the target node, only if the data resource
currently exists, otherwise return an error.";
}
enum insert {
description
"Insert the supplied value into a user-ordered
list or leaf-list entry. The target node must
represent a new data resource. If the 'where'
parameter is set to 'before' or 'after', then
the 'point' parameter identifies the insertion
point for the target node.";
}
enum merge {
description
"The supplied value is merged with the target data
node.";
}
enum move {
description
"Move the target node. Reorder a user-ordered
list or leaf-list. The target node must represent
an existing data resource. If the 'where' parameter
is set to 'before' or 'after', then the 'point'
parameter identifies the insertion point to move
the target node.";
}
enum replace {
description
"The supplied value is used to replace the target
data node.";
}
enum remove {
description
"Delete the target node if it currently exists.";
}
}
mandatory true;
description
"The datastore operation requested for the associated
edit entry";
}
leaf target { leaf operation {
type target-resource-offset; type enumeration {
mandatory true; enum create {
description description
"Identifies the target data node for the edit "The target data node is created using the supplied
operation. If the target has the value '/', then value, only if it does not already exist. The
the target data node is the target resource. 'target' leaf identifies the data node to be
The target node MUST identify a data resource, created, not the parent data node.";
not the datastore resource."; }
} enum delete {
description
"Delete the target node, only if the data resource
currently exists; otherwise, return an error.";
}
enum insert {
description
"Insert the supplied value into a user-ordered
list or leaf-list entry. The target node must
represent a new data resource. If the 'where'
parameter is set to 'before' or 'after', then
the 'point' parameter identifies the insertion
point for the target node.";
}
enum merge {
description
"The supplied value is merged with the target data
node.";
}
enum move {
description
"Move the target node. Reorder a user-ordered
list or leaf-list. The target node must represent
an existing data resource. If the 'where' parameter
is set to 'before' or 'after', then the 'point'
parameter identifies the insertion point to move
the target node.";
}
enum replace {
description
"The supplied value is used to replace the target
data node.";
}
enum remove {
description
"Delete the target node if it currently exists.";
}
}
mandatory true;
description
"The datastore operation requested for the associated
'edit' entry.";
}
leaf target {
type target-resource-offset;
mandatory true;
description
"Identifies the target data node for the edit
operation. If the target has the value '/', then
the target data node is the target resource.
The target node MUST identify a data resource,
not the datastore resource.";
}
leaf point { leaf point {
when "(../operation = 'insert' or ../operation = 'move') " when "(../operation = 'insert' or ../operation = 'move')"
+ "and (../where = 'before' or ../where = 'after')" { + "and (../where = 'before' or ../where = 'after')" {
description description
"Point leaf only applies for insert or move "This leaf only applies for 'insert' or 'move'
operations, before or after an existing entry."; operations, before or after an existing entry.";
} }
type target-resource-offset; type target-resource-offset;
description description
"The absolute URL path for the data node that is being "The absolute URL path for the data node that is being
used as the insertion point or move point for the used as the insertion point or move point for the
target of this edit entry."; target of this 'edit' entry.";
} }
leaf where { leaf where {
when "../operation = 'insert' or ../operation = 'move'" { when "../operation = 'insert' or ../operation = 'move'" {
description description
"Where leaf only applies for insert or move "This leaf only applies for 'insert' or 'move'
operations."; operations.";
} }
type enumeration { type enumeration {
enum before { enum before {
description description
"Insert or move a data node before the data resource "Insert or move a data node before the data resource
identified by the 'point' parameter."; identified by the 'point' parameter.";
} }
enum after { enum after {
description description
"Insert or move a data node after the data resource "Insert or move a data node after the data resource
identified by the 'point' parameter."; identified by the 'point' parameter.";
} }
enum first { enum first {
description description
"Insert or move a data node so it becomes ordered "Insert or move a data node so it becomes ordered
as the first entry."; as the first entry.";
} }
enum last { enum last {
description description
"Insert or move a data node so it becomes ordered "Insert or move a data node so it becomes ordered
as the last entry."; as the last entry.";
} }
} }
default last; default last;
description description
"Identifies where a data resource will be inserted or "Identifies where a data resource will be inserted
moved. YANG only allows these operations for or moved. YANG only allows these operations for
list and leaf-list data nodes that are ordered-by list and leaf-list data nodes that are
user."; 'ordered-by user'.";
} }
anydata value { anydata value {
when "../operation = 'create' " when "../operation = 'create' "
+ "or ../operation = 'merge' " + "or ../operation = 'merge' "
+ "or ../operation = 'replace' " + "or ../operation = 'replace' "
+ "or ../operation = 'insert'" { + "or ../operation = 'insert'" {
description description
"Value node only used for create, merge, "The anydata 'value' is only used for 'create',
replace, and insert operations"; 'merge', 'replace', and 'insert' operations.";
} }
description description
"Value used for this edit operation. The anydata 'value' "Value used for this edit operation. The anydata 'value'
contains the target resource associated with the contains the target resource associated with the
'target' leaf. 'target' leaf.
For example, suppose the target node is a YANG container For example, suppose the target node is a YANG container
named foo: named foo:
container foo { container foo {
leaf a { type string; } leaf a { type string; }
leaf b { type int32; } leaf b { type int32; }
} }
The 'value' node contains one instance of foo: The 'value' node contains one instance of foo:
<value> <value>
<foo xmlns='example-foo-namespace'> <foo xmlns='example-foo-namespace'>
<a>some value</a> <a>some value</a>
<b>42</b> <b>42</b>
</foo> </foo>
</value> </value>
"; ";
} }
} }
} }
} // grouping yang-patch } // grouping yang-patch
grouping yang-patch-status { grouping yang-patch-status {
description description
"A grouping that contains a YANG container "A grouping that contains a YANG container representing the
representing the syntax and semantics of syntax and semantics of a YANG Patch Status response
YANG Patch status response message."; message.";
container yang-patch-status { container yang-patch-status {
description description
"A container representing the response message "A container representing the response message sent by the
sent by the server after a YANG Patch edit server after a YANG Patch edit request message has been
request message has been processed."; processed.";
leaf patch-id { leaf patch-id {
type string; type string;
description mandatory true;
"The patch-id value used in the request. description
If there was no patch-id present in the request "The 'patch-id' value used in the request.";
then this field will not be present."; }
}
choice global-status { choice global-status {
description description
"Report global errors or complete success. "Report global errors or complete success.
If there is no case selected then errors If there is no case selected, then errors
are reported in the edit-status container."; are reported in the 'edit-status' container.";
case global-errors { case global-errors {
uses rc:errors; uses rc:errors;
description description
"This container will be present if global "This container will be present if global errors that
errors that are unrelated to a specific edit are unrelated to a specific edit occurred.";
occurred."; }
} leaf ok {
leaf ok { type empty;
type empty; description
description "This leaf will be present if the request succeeded
"This leaf will be present if the request succeeded and there are no errors reported in the 'edit-status'
and there are no errors reported in the edit-status container.";
container."; }
} }
}
container edit-status { container edit-status {
description description
"This container will be present if there are "This container will be present if there are
edit-specific status responses to report. edit-specific status responses to report.
If all edits succeeded and the 'global-status' If all edits succeeded and the 'global-status'
returned is 'ok', then a server MAY omit this returned is 'ok', then a server MAY omit this
container"; container.";
list edit { list edit {
key edit-id; key edit-id;
description description
"Represents a list of status responses, "Represents a list of status responses,
corresponding to edits in the YANG Patch corresponding to edits in the YANG Patch
request message. If an edit entry was request message. If an 'edit' entry was
skipped or not reached by the server, skipped or not reached by the server,
then this list will not contain a corresponding then this list will not contain a corresponding
entry for that edit."; entry for that edit.";
leaf edit-id { leaf edit-id {
type string; type string;
description
"Response status is for the edit list entry
with this edit-id value.";
}
choice edit-status-choice {
description
"A choice between different types of status
responses for each edit entry.";
leaf ok {
type empty;
description
"This edit entry was invoked without any
errors detected by the server associated
with this edit.";
}
case errors {
uses rc:errors;
description description
"The server detected errors associated with the "Response status is for the 'edit' list entry
edit identified by the same edit-id value."; with this 'edit-id' value.";
}
} choice edit-status-choice {
} description
} "A choice between different types of status
} responses for each 'edit' entry.";
} leaf ok {
} // grouping yang-patch-status type empty;
description
"This 'edit' entry was invoked without any
errors detected by the server associated
with this edit.";
}
case errors {
uses rc:errors;
description
"The server detected errors associated with the
edit identified by the same 'edit-id' value.";
}
}
}
}
}
} // grouping yang-patch-status
} }
<CODE ENDS> <CODE ENDS>
4. IANA Considerations 4. IANA Considerations
4.1. YANG Module Registry 4.1. Registrations for New URI and YANG Module
This document registers one URI as a namespace in the IETF XML This document registers one URI as a namespace in the "IETF XML
registry [RFC3688]. Following the format in RFC 3688, the following Registry" [RFC3688]. It follows the format in RFC 3688.
registration is requested to be made.
URI: urn:ietf:params:xml:ns:yang:ietf-yang-patch URI: urn:ietf:params:xml:ns:yang:ietf-yang-patch
Registrant Contact: The NETCONF WG of the IETF. Registrant Contact: The IESG.
XML: N/A, the requested URI is an XML namespace. XML: N/A; the requested URI is an XML namespace.
This document registers one YANG module in the YANG Module Names This document registers one YANG module in the "YANG Module Names"
registry [RFC6020]. registry [RFC6020].
name: ietf-yang-patch name: ietf-yang-patch
namespace: urn:ietf:params:xml:ns:yang:ietf-yang-patch namespace: urn:ietf:params:xml:ns:yang:ietf-yang-patch
prefix: ypatch prefix: ypatch
// RFC Ed.: replace XXXX with RFC number and remove this note reference: RFC 8072
reference: RFC XXXX
4.2. Media Types 4.2. Media Types
4.2.1. Media Type application/yang-patch+xml 4.2.1. Media Type "application/yang-patch+xml"
Type name: application
Subtype name: yang-patch+xml
Required parameters: None
Optional parameters: None
// RFC Ed.: replace 'XXXX' with the real RFC number,
// and remove this note
Encoding considerations: 8-bit
The utf-8 charset is always used for this type.
Each conceptual YANG data node is encoded according to the
XML Encoding Rules and Canonical Format for the specific
YANG data node type defined in [RFC7950].
In addition, the "yang-patch" YANG Patch template found
in [RFCXXXX] defines the structure of a YANG Patch request.
// RFC Ed.: replace 'NN' in Section NN of [RFCXXXX] with the
// section number for Security Considerations
// Replace 'XXXX' in Section NN of [RFCXXXX] with the actual
// RFC number, and remove this note.
Security considerations: Security considerations related
to the generation and consumption of RESTCONF messages
are discussed in Section NN of [RFCXXXX].
Additional security considerations are specific to the
semantics of particular YANG data models. Each YANG module
is expected to specify security considerations for the
YANG data defined in that module.
// RFC Ed.: replace XXXX with actual RFC number and remove this
// note.
Interoperability considerations: [RFCXXXX] specifies the format
of conforming messages and the interpretation thereof.
// RFC Ed.: replace XXXX with actual RFC number and remove this
// note.
Published specification: RFC XXXX
Applications that use this media type: Instance document
data parsers used within a protocol or automation tool
that utilize the YANG Patch data structure.
Fragment identifier considerations: Same as for application/xml
Additional information: Type name: application
Deprecated alias names for this type: N/A Subtype name: yang-patch+xml
Magic number(s): N/A
File extension(s): None
Macintosh file type code(s): "TEXT"
// RFC Ed.: replace XXXX with actual RFC number and remove this Required parameters: None
// note.
Person & email address to contact for further information: See Optional parameters: None
Authors' Addresses section of [RFCXXXX].
Intended usage: COMMON Encoding considerations: 8-bit
The "utf-8" charset is always used for this type.
Each conceptual YANG data node is encoded according to the
XML Encoding Rules and Canonical Format for the specific
YANG data node type defined in [RFC7950].
In addition, the "yang-patch" YANG Patch template found
in RFC 8072 defines the structure of a YANG Patch request.
Restrictions on usage: N/A Security considerations: Security considerations related
to the generation and consumption of RESTCONF messages
are discussed in Section 5 of RFC 8072.
Additional security considerations are specific to the
semantics of particular YANG data models. Each YANG module
is expected to specify security considerations for the
YANG data defined in that module.
// RFC Ed.: replace XXXX with actual RFC number and remove this Interoperability considerations: RFC 8072 specifies the format
// note. of conforming messages and the interpretation thereof.
Author: See Authors' Addresses section of [RFCXXXX]. Published specification: RFC 8072
Change controller: Internet Engineering Task Force Applications that use this media type: Instance document
(mailto:iesg&ietf.org). data parsers used within a protocol or automation tool
that utilize the YANG Patch data structure.
Provisional registration? (standards tree only): no Fragment identifier considerations: The syntax and semantics
of fragment identifiers are the same as the syntax and semantics
specified for the "application/xml" media type.
4.2.2. Media Type application/yang-patch+json Additional information:
Type name: application Deprecated alias names for this type: N/A
Magic number(s): N/A
File extension(s): None
Macintosh file type code(s): "TEXT"
Subtype name: yang-patch+json Person & email address to contact for further information: See
the Authors' Addresses section of RFC 8072.
Required parameters: None Intended usage: COMMON
Optional parameters: None Restrictions on usage: N/A
// RFC Ed.: replace draft-ietf-netmod-yang-json with Author: See the Authors' Addresses section of RFC 8072.
// the actual RFC reference for JSON Encoding of YANG Data,
// and remove this note.
// RFC Ed.: replace draft-ietf-netmod-yang-metadata with Change controller: Internet Engineering Task Force
// the actual RFC reference for JSON Encoding of YANG Data, (mailto:iesg@ietf.org).
// and remove this note.
// RFC Ed.: replace 'XXXX' with the real RFC number, Provisional registration? (standards tree only): no
// and remove this note
Encoding considerations: 8-bit 4.2.2. Media Type "application/yang-patch+json"
The utf-8 charset is always used for this type.
Each conceptual YANG data node is encoded according to
[draft-ietf-netmod-yang-json]. A data annotation is
encoded according to [draft-ietf-netmod-yang-metadata]
In addition, the "yang-patch" YANG Patch template found
in [RFCXXXX] defines the structure of a YANG Patch request.
// RFC Ed.: replace 'NN' in Section NN of [RFCXXXX] with the Type name: application
// section number for Security Considerations
// Replace 'XXXX' in Section NN of [RFCXXXX] with the actual
// RFC number, and remove this note.
Security considerations: Security considerations related Subtype name: yang-patch+json
to the generation and consumption of RESTCONF messages
are discussed in Section NN of [RFCXXXX].
Additional security considerations are specific to the
semantics of particular YANG data models. Each YANG module
is expected to specify security considerations for the
YANG data defined in that module.
// RFC Ed.: replace XXXX with actual RFC number and remove this Required parameters: None
// note.
Interoperability considerations: [RFCXXXX] specifies the format Optional parameters: None
of conforming messages and the interpretation thereof.
// RFC Ed.: replace XXXX with actual RFC number and remove this Encoding considerations: 8-bit
// note. The "utf-8" charset is always used for this type.
Each conceptual YANG data node is encoded according to
RFC 7951. A metadata annotation is encoded according to
RFC 7952. In addition, the "yang-patch" YANG Patch
template found in RFC 8072 defines the structure of a
YANG Patch request.
Published specification: RFC XXXX Security considerations: Security considerations related
to the generation and consumption of RESTCONF messages
are discussed in Section 5 of RFC 8072.
Additional security considerations are specific to the
semantics of particular YANG data models. Each YANG module
is expected to specify security considerations for the
YANG data defined in that module.
Applications that use this media type: Instance document Interoperability considerations: RFC 8072 specifies the format
data parsers used within a protocol or automation tool of conforming messages and the interpretation thereof.
that utilize the YANG Patch data structure.
Fragment identifier considerations: The syntax and semantics Published specification: RFC 8072
of fragment identifiers are the same as specified for the
"application/json" media type.
Additional information: Applications that use this media type: Instance document
data parsers used within a protocol or automation tool
that utilize the YANG Patch data structure.
Deprecated alias names for this type: N/A Fragment identifier considerations: The syntax and semantics
Magic number(s): N/A of fragment identifiers are the same as the syntax and semantics
File extension(s): None specified for the "application/json" media type.
Macintosh file type code(s): "TEXT"
// RFC Ed.: replace XXXX with actual RFC number and remove this Additional information:
// note.
Person & email address to contact for further information: See Deprecated alias names for this type: N/A
Authors' Addresses section of [RFCXXXX]. Magic number(s): N/A
File extension(s): None
Macintosh file type code(s): "TEXT"
Intended usage: COMMON Person & email address to contact for further information: See
the Authors' Addresses section of RFC 8072.
Restrictions on usage: N/A Intended usage: COMMON
// RFC Ed.: replace XXXX with actual RFC number and remove this Restrictions on usage: N/A
// note.
Author: See Authors' Addresses section of [RFCXXXX]. Author: See the Authors' Addresses section of RFC 8072.
Change controller: Internet Engineering Task Force Change controller: Internet Engineering Task Force
(mailto:iesg&ietf.org). (mailto:iesg@ietf.org).
Provisional registration? (standards tree only): no Provisional registration? (standards tree only): no
4.3. RESTCONF Capability URNs 4.3. RESTCONF Capability URNs
This document registers one capability identifier in "RESTCONF This document registers one capability identifier in the "RESTCONF
Protocol Capability URNs" registry Capability URNs" registry [RFC8040]. The review policy for this
registry is "IETF Review" [RFC5226].
Index
Capability Identifier
------------------------
:yang-patch Index Capability Identifier
urn:ietf:params:restconf:capability:yang-patch:1.0 ------------------------------------------------------------------
:yang-patch urn:ietf:params:restconf:capability:yang-patch:1.0
5. Security Considerations 5. Security Considerations
The YANG Patch media type does not introduce any significant new The YANG Patch media type does not introduce any significant new
security threats, beyond what is described in security threats, beyond what is described in [RFC8040]. This
[I-D.ietf-netconf-restconf]. This document defines edit processing document defines edit processing instructions for a variant of the
instructions for a variant of the PATCH method, as used within the PATCH method, as used within the RESTCONF protocol. Message
RESTCONF protocol. Message integrity is provided by the RESTCONF integrity is provided by the RESTCONF protocol. There is no
protocol. There is no additional capability to validate that a patch additional capability to validate that a patch has not been altered.
has not been altered.
It may be possible to use YANG Patch with other protocols besides It may be possible to use YANG Patch with other protocols besides
RESTCONF, which is outside the scope of this document. RESTCONF; this topic is outside the scope of this document.
For RESTCONF, both the client and server MUST be authenticated, For RESTCONF, both the client and server MUST be authenticated
according to section 2 of [I-D.ietf-netconf-restconf]. It is according to Section 2 of [RFC8040]. It is important for RESTCONF
important for RESTCONF server implementations to carefully validate server implementations to carefully validate all the edit request
all the edit request parameters in some manner. If the entire YANG parameters in some manner. If the entire YANG Patch request cannot
Patch request cannot be completed, then no configuration changes to be completed, then no configuration changes to the system are done.
the system are done. A PATCH request MUST be applied atomically, as A PATCH request MUST be applied atomically, as specified in Section 2
specified in section 2 of [RFC5789]. of [RFC5789].
A RESTCONF server implementation SHOULD attempt to prevent system A RESTCONF server implementation SHOULD attempt to prevent system
disruption due to incremental processing of the YANG Patch edit list. disruption due to incremental processing of the YANG Patch
It may be possible to construct an attack on such a RESTCONF server, "edit" list. It may be possible to construct an attack on such a
which relies on the edit processing order mandated by YANG Patch. A RESTCONF server, which relies on the edit processing order mandated
server SHOULD apply only the fully validated configuration to the by YANG Patch. A server SHOULD apply only the fully validated
underlying system. For example, an edit list which deleted an configuration to the underlying system. For example, an "edit" list
interface and then recreated it could cause system disruption if the that deleted an interface and then recreated it could cause system
edit list was incrementally applied. disruption if the "edit" list was incrementally applied.
A RESTCONF server implementation SHOULD attempt to prevent system A RESTCONF server implementation SHOULD attempt to prevent system
disruption due to excessive resource consumption required to fulfill disruption due to excessive resource consumption required to fulfill
YANG Patch edit requests. It may be possible to construct an attack YANG Patch edit requests. On such an implementation, it may be
on such a RESTCONF server, which attempts to consume all available possible to construct an attack that attempts to consume all
memory or other resource types. available memory or other resource types.
6. Normative References 6. References
[I-D.ietf-netconf-restconf] 6.1. Normative References
Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF
Protocol", draft-ietf-netconf-restconf-18 (work in
progress), October 2016.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>.
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
DOI 10.17487/RFC3688, January 2004, DOI 10.17487/RFC3688, January 2004,
<http://www.rfc-editor.org/info/rfc3688>. <http://www.rfc-editor.org/info/rfc3688>.
[RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP", [RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP",
RFC 5789, March 2010. RFC 5789, DOI 10.17487/RFC5789, March 2010,
<http://www.rfc-editor.org/info/rfc5789>.
[RFC6020] Bjorklund, M., "YANG - A Data Modeling Language for the [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for
Network Configuration Protocol (NETCONF)", RFC 6020, the Network Configuration Protocol (NETCONF)", RFC 6020,
October 2010. DOI 10.17487/RFC6020, October 2010,
<http://www.rfc-editor.org/info/rfc6020>.
[RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
and A. Bierman, Ed., "Network Configuration Protocol and A. Bierman, Ed., "Network Configuration Protocol
(NETCONF)", RFC 6241, June 2011. (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011,
<http://www.rfc-editor.org/info/rfc6241>.
[RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March Interchange Format", RFC 7159, DOI 10.17487/RFC7159,
2014, <http://www.rfc-editor.org/info/rfc7159>. March 2014, <http://www.rfc-editor.org/info/rfc7159>.
[RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer [RFC7230] Fielding, R., Ed., and J. Reschke, Ed., "Hypertext
Protocol (HTTP/1.1): Message Syntax and Routing", Transfer Protocol (HTTP/1.1): Message Syntax and Routing",
RFC 7230, DOI 10.17487/RFC7230, June 2014, RFC 7230, DOI 10.17487/RFC7230, June 2014,
<http://www.rfc-editor.org/info/rfc7230>. <http://www.rfc-editor.org/info/rfc7230>.
[RFC7231] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol [RFC7231] Fielding, R., Ed., and J. Reschke, Ed., "Hypertext
(HTTP/1.1): Semantics and Content", RFC 7231, June 2014. Transfer Protocol (HTTP/1.1): Semantics and Content",
RFC 7231, DOI 10.17487/RFC7231, June 2014,
<http://www.rfc-editor.org/info/rfc7231>.
[RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", [RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language",
RFC 7950, DOI 10.17487/RFC7950, August 2016, RFC 7950, DOI 10.17487/RFC7950, August 2016,
<http://www.rfc-editor.org/info/rfc7950>. <http://www.rfc-editor.org/info/rfc7950>.
[RFC7951] Lhotka, L., "JSON Encoding of Data Modeled with YANG", [RFC7951] Lhotka, L., "JSON Encoding of Data Modeled with YANG",
RFC 7951, DOI 10.17487/RFC7951, August 2016, RFC 7951, DOI 10.17487/RFC7951, August 2016,
<http://www.rfc-editor.org/info/rfc7951>. <http://www.rfc-editor.org/info/rfc7951>.
[RFC7952] Lhotka, L., "Defining and Using Metadata with YANG", [RFC7952] Lhotka, L., "Defining and Using Metadata with YANG",
RFC 7952, DOI 10.17487/RFC7952, August 2016, RFC 7952, DOI 10.17487/RFC7952, August 2016,
<http://www.rfc-editor.org/info/rfc7952>. <http://www.rfc-editor.org/info/rfc7952>.
[RFC8040] Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF
Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017,
<http://www.rfc-editor.org/info/rfc8040>.
[W3C.REC-xml-20081126] [W3C.REC-xml-20081126]
Yergeau, F., Maler, E., Paoli, J., Sperberg-McQueen, C., Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., and
and T. Bray, "Extensible Markup Language (XML) 1.0 (Fifth F. Yergeau, "Extensible Markup Language (XML) 1.0
Edition)", World Wide Web Consortium Recommendation REC- (Fifth Edition)", World Wide Web Consortium
xml-20081126, November 2008, Recommendation REC-xml-20081126, November 2008,
<http://www.w3.org/TR/2008/REC-xml-20081126>. <http://www.w3.org/TR/2008/REC-xml-20081126>.
Appendix A. Acknowledgements 6.2. Informative References
The authors would like to thank the following people for their
contributions to this document: Rex Fernando.
Contributions to this material by Andy Bierman are based upon work
supported by the The Space & Terrestrial Communications Directorate
(S&TCD) under Contract No. W15P7T-13-C-A616. Any opinions, findings
and conclusions or recommendations expressed in this material are
those of the author(s) and do not necessarily reflect the views of
The Space & Terrestrial Communications Directorate (S&TCD).
Appendix B. Change Log
-- RFC Ed.: remove this section before publication.
The YANG Patch issue tracker can be found here: https://github.com/
netconf-wg/yang-patch/issues
B.1. v12 to v13
o clarifications based on IESG reviews
B.2. v11 to v12
o clarify target resource must exist
o fix errors in some examples
o change application/yang-patch-xml to application/yang-patch+xml
o clarified some section titles
o clarified error responses for multiple edit instances
o made patch-id field mandatory
o referenced NETCONF operation attribute
B.3. v10 to v11
o change application/yang-patch to application/yang-patch-xml
o change server to RESTCONF server and remove NETCONF server term
o change client to RESTCONF client and remove NETCONF client term
o clarified that YANG 1.0 content can be used in a YANG Patch
implementation
o clarified more terminology
o fixed missing keys in edit examples
o added insert list example
B.4. v09 to v10
o change yang-patch+xml to yang-patch
o clarify application/yang-patch+json media type
o add edit datastore example
o change data-resource-offset typedef so it is consistent for XML
and JSON
B.5. v08 to v09
o change RFC 7158 reference to RFC 7159 reference
o change RFC 2616 reference to RFC 7230 reference
o remove unused HTTP terms
o remove import-by-revision of ietf-restconf; not needed
o change application/yang.patch media type to application/yang-patch
o remove application/yang.patch-status media type; use application/
yang-data instead
B.6. v07 to v08
o clarified target datastore and target data node terms
o clarified that target leaf can be single forward slash '/'
o added Successful edit response handling section
o clarified that YANG Patch draft is for RESTCONF protocol only but
may be defined for other protocols outside this document
o clarified that YANG Patch draft is for configuration datastores
only but may be defined for other datastore types outside this
document
o fixed typos
B.7. v06 to v07
o converted YANG module to YANG 1.1
o changed anyxml value to anydata value
o updated import revision date for ietf-restconf
o updated revision date for ietf-yang-patch because import-by-
revision date needed to be changed
B.8. v05 to v06
o changed errors example so a full request and error response is
shown in XML format
o fixed error-path to match instance-identifier encoding for both
XML and JSON
o added references for YANG to JSON and YANG Metadata drafts
o clarified that YANG JSON drafts are used for encoding, not plain
JSON
B.9. v04 to v05
o updated reference to RESTCONF
B.10. v03 to v04
o removed NETCONF specific text
o changed data-resource-offset typedef from a relative URI to an
XPath absolute path expression
o clarified insert operation
o removed requirement that edits MUST be applied in ascending order
o change SHOULD keep datastore unchanged on error to MUST (this is
required by HTTP PATCH)
o removed length restriction on 'comment' leaf
o updated YANG tree for example-jukebox library
B.11. v02 to v03
o added usage of restconf-media-type extension to map the yang-patch
and yang-patch-status groupings to media types
o added yang-patch RESTCONF capability URI
o Added sub-section for terms used from RESTCONF
o filled in security considerations section
B.12. v01 to v02
o Reversed order of change log
o Clarified anyxml structure of "value" parameter within a YANG
patch request (github issue #1)
o Updated RESTCONF reference
o Added note to open issues section to check github instead
B.13. v00 to v01
o Added text requiring support for Accept-Patch header field, and
removed 'Identification of YANG Patch capabilities' open issue.
o Removed 'location' leaf from yang-patch-status grouping
o Removed open issue 'Protocol independence' because the location
leaf was removed.
o Removed open issue 'RESTCONF coupling' because there is no concern
about a normative reference to RESTCONF. There may need to be a
YANG 1.1 mechanism to allow protocol template usage (instead of
grouping wrapper).
o Removed open issue 'Is the delete operation needed'. It was
decided that both delete and remove should remain as operations
and clients can choose which one to use. This is not an
implementation burden on the server.
o Removed open issue 'global-errors needed'. It was decided that
they are needed as defined because the global <ok/> is needed and
the special key value for edit=global error only allows for 1
global error.
o Removed open issue 'Is location leaf needed'. It was decided that
it is not needed so this leaf has been removed.
o Removed open issue 'Bulk editing support in yang-patch-status'.
The 'location' leaf has been removed so this issue is no longer
applicable.
o Removed open issue 'Edit list mechanism'. Added text to the
'edit' list description-stmt about how the individual edits must
be processed. There is no concern about duplicate edits which
cause intermediate results to be altered by subsequent edits in
the same edit list.
B.14. bierman:yang-patch-00 to ietf:yang-patch-00
o Created open issues section
Appendix C. Open Issues
-- RFC Ed.: remove this section before publication.
Refer to the github issue tracker for any open issues:
https://github.com/netconf-wg/yang-patch/issues [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an
IANA Considerations Section in RFCs", BCP 26, RFC 5226,
DOI 10.17487/RFC5226, May 2008,
<http://www.rfc-editor.org/info/rfc5226>.
Appendix D. Example YANG Module Appendix A. Example YANG Module
The example YANG module used in this document represents a simple The example YANG module used in this document represents a simple
media jukebox interface. The "example-jukebox" YANG module is media jukebox interface. The "example-jukebox" YANG module is
defined in [I-D.ietf-netconf-restconf]. defined in [RFC8040].
YANG tree diagram for "example-jukebox" Module: YANG tree diagram for the "example-jukebox" module:
+--rw jukebox! +--rw jukebox!
+--rw library +--rw library
| +--rw artist* [name] | +--rw artist* [name]
| | +--rw name string | | +--rw name string
| | +--rw album* [name] | | +--rw album* [name]
| | +--rw name string | | +--rw name string
| | +--rw genre? identityref | | +--rw genre? identityref
| | +--rw year? uint16 | | +--rw year? uint16
| | +--rw admin | | +--rw admin
skipping to change at page 32, line 31 skipping to change at page 28, line 37
| | +--rw format? string | | +--rw format? string
| | +--rw length? uint32 | | +--rw length? uint32
| +--ro artist-count? uint32 | +--ro artist-count? uint32
| +--ro album-count? uint32 | +--ro album-count? uint32
| +--ro song-count? uint32 | +--ro song-count? uint32
+--rw playlist* [name] +--rw playlist* [name]
| +--rw name string | +--rw name string
| +--rw description? string | +--rw description? string
| +--rw song* [index] | +--rw song* [index]
| +--rw index uint32 | +--rw index uint32
| +--rw id leafref | +--rw id instance-identifier
+--rw player +--rw player
+--rw gap? decimal64 +--rw gap? decimal64
rpcs: rpcs:
+---x play +---x play
+--ro input +--ro input
+--ro playlist string +--ro playlist string
+--ro song-number uint32 +--ro song-number uint32
D.1. YANG Patch Examples A.1. YANG Patch Examples
This section includes RESTCONF examples. Most examples are shown in This section includes RESTCONF examples. Most examples are shown in
JSON encoding [RFC7159], and some are shown in XML encoding JSON encoding [RFC7159], and some are shown in XML encoding
[W3C.REC-xml-20081126]. [W3C.REC-xml-20081126].
D.1.1. Add Resources: Error A.1.1. Add Resources: Error
The following example shows several songs being added to an existing The following example shows several songs being added to an existing
album. Each edit contains one song. The first song already exists, album. Each edit contains one song. The first song already exists,
so an error will be reported for that edit. The rest of the edits so an error will be reported for that edit. The rest of the edits
were not attempted, since the first edit failed. The XML encoding is were not attempted, since the first edit failed. XML encoding is
used in this example. used in this example.
Request from the RESTCONF client: Request from the RESTCONF client:
PATCH /restconf/data/example-jukebox:jukebox/\ PATCH /restconf/data/example-jukebox:jukebox/\
library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1 library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang-data+xml Accept: application/yang-data+xml
Content-Type: application/yang-patch+xml Content-Type: application/yang-patch+xml
skipping to change at page 35, line 5 skipping to change at page 31, line 5
<song xmlns="http://example.com/ns/example-jukebox"> <song xmlns="http://example.com/ns/example-jukebox">
<name>Dear Rosemary</name> <name>Dear Rosemary</name>
<location>/media/dear_rosemary.mp3</location> <location>/media/dear_rosemary.mp3</location>
<format>MP3</format> <format>MP3</format>
<length>269</length> <length>269</length>
</song> </song>
</value> </value>
</edit> </edit>
</yang-patch> </yang-patch>
XML Response from the RESTCONF server: XML response from the RESTCONF server:
HTTP/1.1 409 Conflict HTTP/1.1 409 Conflict
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Thu, 26 Jan 2017 20:56:30 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Thu, 26 Jan 2017 20:56:30 GMT
Content-Type: application/yang-data+xml Content-Type: application/yang-data+xml
<yang-patch-status <yang-patch-status
xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch"> xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
<patch-id>add-songs-patch</patch-id> <patch-id>add-songs-patch</patch-id>
<edit-status> <edit-status>
<edit> <edit>
<edit-id>edit1</edit-id> <edit-id>edit1</edit-id>
<errors> <errors>
<error> <error>
<error-type>application</error-type> <error-type>application</error-type>
<error-tag>data-exists</error-tag> <error-tag>data-exists</error-tag>
<error-path <error-path
xmlns:jb="http://example.com/ns/example-jukebox"> xmlns:jb="http://example.com/ns/example-jukebox">
/jb:jukebox/jb:library /jb:jukebox/jb:library
/jb:artist[jb:name='Foo Fighters'] /jb:artist[jb:name='Foo Fighters']
/jb:album[jb:name='Wasting Light'] /jb:album[jb:name='Wasting Light']
/jb:song[jb:name='Burning Light'] /jb:song[jb:name='Bridge Burning']
</error-path> </error-path>
<error-message> <error-message>
Data already exists, cannot be created Data already exists; cannot be created
</error-message> </error-message>
</error> </error>
</errors> </errors>
</edit> </edit>
</edit-status> </edit-status>
</yang-patch-status> </yang-patch-status>
JSON Response from the RESTCONF server: JSON response from the RESTCONF server:
The following response is shown in JSON format to highlight the The following response is shown in JSON format to highlight the
difference in the "error-path" object encoding. For JSON, the difference in the "error-path" object encoding. For JSON, the
instance-identifier encoding in the "JSON Encoding of YANG Data" instance-identifier encoding specified in [RFC7951] is used.
draft is used.
HTTP/1.1 409 Conflict HTTP/1.1 409 Conflict
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Thu, 26 Jan 2017 20:56:30 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Thu, 26 Jan 2017 20:56:30 GMT
Content-Type: application/yang-data+json Content-Type: application/yang-data+json
{ {
"ietf-yang-patch:yang-patch-status" : { "ietf-yang-patch:yang-patch-status" : {
"patch-id" : "add-songs-patch", "patch-id" : "add-songs-patch",
"edit-status" : { "edit-status" : {
"edit" : [ "edit" : [
{ {
"edit-id" : "edit1", "edit-id" : "edit1",
"errors" : { "errors" : {
"error" : [ "error" : [
{ {
"error-type": "application", "error-type": "application",
"error-tag": "data-exists", "error-tag": "data-exists",
"error-path": "/example-jukebox:jukebox/library\ "error-path": "/example-jukebox:jukebox/library\
/artist[name='Foo Fighters']\ /artist[name='Foo Fighters']\
/album[name='Wasting Light']\ /album[name='Wasting Light']\
/song[name='Burning Light']", /song[name='Bridge Burning']",
"error-message": "error-message":
"Data already exists, cannot be created" "Data already exists; cannot be created"
} }
] ]
} }
} }
] ]
} }
} }
} }
D.1.2. Add Resources: Success A.1.2. Add Resources: Success
The following example shows several songs being added to an existing The following example shows several songs being added to an existing
album. album.
o Each of 2 edits contains one song. o Each of two edits contains one song.
o Both edits succeed and new sub-resources are created o Both edits succeed, and new sub-resources are created.
Request from the RESTCONF client: Request from the RESTCONF client:
PATCH /restconf/data/example-jukebox:jukebox/\ PATCH /restconf/data/example-jukebox:jukebox/\
library/artist=Foo%20Fighters/album=Wasting%20Light \ library/artist=Foo%20Fighters/album=Wasting%20Light \
HTTP/1.1 HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang-data+json Accept: application/yang-data+json
Content-Type: application/yang-patch+json Content-Type: application/yang-patch+json
skipping to change at page 38, line 6 skipping to change at page 34, line 26
] ]
} }
} }
] ]
} }
} }
Response from the RESTCONF server: Response from the RESTCONF server:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Thu, 26 Jan 2017 20:56:30 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Thu, 26 Jan 2017 20:56:30 GMT
Content-Type: application/yang-data+json Content-Type: application/yang-data+json
{ {
"ietf-yang-patch:yang-patch-status" : { "ietf-yang-patch:yang-patch-status" : {
"patch-id" : "add-songs-patch-2", "patch-id" : "add-songs-patch-2",
"ok" : [null] "ok" : [null]
} }
} }
D.1.3. Insert list entry example A.1.3. Insert List Entry
The following example shows a song being inserted within an existing The following example shows a song being inserted within an existing
playlist. Song "6" in playlist "Foo-One" is being inserted after playlist. Song "6" in playlist "Foo-One" is being inserted after
song "5" in the playlist. The operation succeeds, so a non-error song "5" in the playlist. The operation succeeds, so a non-error
reply example can be shown. reply can be provided.
Request from the RESTCONF client: Request from the RESTCONF client:
PATCH /restconf/data/example-jukebox:jukebox/\ PATCH /restconf/data/example-jukebox:jukebox/\
playlist=Foo-One HTTP/1.1 playlist=Foo-One HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang-data+json Accept: application/yang-data+json
Content-Type: application/yang-patch+json Content-Type: application/yang-patch+json
{ {
"ietf-yang-patch:yang-patch" : { "ietf-yang-patch:yang-patch" : {
"patch-id" : "move-song-patch", "patch-id" : "insert-song-patch",
"comment" : "Insert song 6 after song 5", "comment" : "Insert song 6 after song 5",
"edit" : [ "edit" : [
{ {
"edit-id" : "edit1", "edit-id" : "edit1",
"operation" : "insert", "operation" : "insert",
"target" : "/song=6", "target" : "/song=6",
"point" : "/song=5", "point" : "/song=5",
"where" : "after", "where" : "after",
"value" : { "value" : {
"example-jukebox:song" : [ "example-jukebox:song" : [
{ {
"name" : "Dear Prudence", "index" : 6,
"location" : "/media/dear_prudence.mp3", "id" : "/example-jukebox:jukebox/library\
"format" : "MP3", /artist[name='Foo Fighters']\
"length" : 236 /album[name='Wasting Light']\
/song[name='Bridge Burning']"
} }
] ]
} }
} }
] ]
} }
}
Response from the RESTCONF server: Response from the RESTCONF server:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Thu, 26 Jan 2017 20:56:30 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Thu, 26 Jan 2017 20:56:30 GMT
Content-Type: application/yang-data+json Content-Type: application/yang-data+json
{ {
"ietf-yang-patch:yang-patch-status" : { "ietf-yang-patch:yang-patch-status" : {
"patch-id" : "move-song-patch", "patch-id" : "insert-song-patch",
"ok" : [null] "ok" : [null]
} }
} }
D.1.4. Move list entry example A.1.4. Move List Entry
The following example shows a song being moved within an existing The following example shows a song being moved within an existing
playlist. Song "1" in playlist "Foo-One" is being moved after song playlist. Song "1" in playlist "Foo-One" is being moved after
"3" in the playlist. Note that no "value" parameter is needed for a song "3" in the playlist. Note that no "value" parameter is needed
"move" operation. The operation succeeds, so a non-error reply for a "move" operation. The operation succeeds, so a non-error reply
example can be shown. can be provided.
Request from the RESTCONF client: Request from the RESTCONF client:
PATCH /restconf/data/example-jukebox:jukebox/\ PATCH /restconf/data/example-jukebox:jukebox/\
playlist=Foo-One HTTP/1.1 playlist=Foo-One HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang-data+json Accept: application/yang-data+json
Content-Type: application/yang-patch+json Content-Type: application/yang-patch+json
{ {
skipping to change at page 40, line 40 skipping to change at page 37, line 8
"point" : "/song=3", "point" : "/song=3",
"where" : "after" "where" : "after"
} }
] ]
} }
} }
Response from the RESTCONF server: Response from the RESTCONF server:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Thu, 26 Jan 2017 20:56:30 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Thu, 26 Jan 2017 20:56:30 GMT
Content-Type: application/yang-data+json Content-Type: application/yang-data+json
{ {
"ietf-restconf:yang-patch-status" : { "ietf-restconf:yang-patch-status" : {
"patch-id" : "move-song-patch", "patch-id" : "move-song-patch",
"ok" : [null] "ok" : [null]
} }
} }
D.1.5. Edit datastore resource example A.1.5. Edit Datastore Resource
The following example shows how 3 top-level data nodes from different The following example shows how three top-level data nodes from
modules can be edited at the same time. different modules can be edited at the same time.
Example module "foo" defines leaf X. Example module "bar" defines Example module "foo" defines leaf X. Example module "bar" defines
container Y, with child leafs A and B. Example module "baz" defines container Y, with child leafs A and B. Example module "baz" defines
list Z, with key C and child leafs D and E. list Z, with key C and child leafs D and E.
Request from the RESTCONF client: Request from the RESTCONF client:
PATCH /restconf/data HTTP/1.1 PATCH /restconf/data HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang-data+json Accept: application/yang-data+json
skipping to change at page 43, line 6 skipping to change at page 38, line 36
] ]
} }
} }
] ]
} }
} }
Response from the RESTCONF server: Response from the RESTCONF server:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 13:02:20 GMT Date: Thu, 26 Jan 2017 20:56:30 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Thu, 26 Jan 2017 20:55:30 GMT
Content-Type: application/yang-data+json Content-Type: application/yang-data+json
{ {
"ietf-yang-patch:yang-patch-status" : { "ietf-yang-patch:yang-patch-status" : {
"patch-id" : "datastore-patch-1", "patch-id" : "datastore-patch-1",
"ok" : [null] "ok" : [null]
} }
} }
Acknowledgements
The authors would like to thank Rex Fernando for his contributions to
this document.
Contributions to this material by Andy Bierman are based upon work
supported by the United States Army, Space & Terrestrial
Communications Directorate (S&TCD) under Contract
No. W15P7T-13-C-A616. Any opinions, findings, and conclusions or
recommendations expressed in this material are those of the author(s)
and do not necessarily reflect the views of the S&TCD.
Authors' Addresses Authors' Addresses
Andy Bierman Andy Bierman
YumaWorks YumaWorks
Email: andy@yumaworks.com Email: andy@yumaworks.com
Martin Bjorklund Martin Bjorklund
Tail-f Systems Tail-f Systems
 End of changes. 214 change blocks. 
1022 lines changed or deleted 738 lines changed or added

This html diff was produced by rfcdiff 1.45. The latest version is available from http://tools.ietf.org/tools/rfcdiff/