draft-ietf-netconf-yang-patch-10.txt   draft-ietf-netconf-yang-patch-11.txt 
Network Working Group A. Bierman Network Working Group A. Bierman
Internet-Draft YumaWorks Internet-Draft YumaWorks
Intended status: Standards Track M. Bjorklund Intended status: Standards Track M. Bjorklund
Expires: January 8, 2017 Tail-f Systems Expires: February 16, 2017 Tail-f Systems
K. Watsen K. Watsen
Juniper Networks Juniper Networks
July 7, 2016 August 15, 2016
YANG Patch Media Type YANG Patch Media Type
draft-ietf-netconf-yang-patch-10 draft-ietf-netconf-yang-patch-11
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 Internet-Draft is submitted in full conformance with the
skipping to change at page 1, line 35 skipping to change at page 1, line 35
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on January 8, 2017. This Internet-Draft will expire on February 16, 2017.
Copyright Notice Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the Copyright (c) 2016 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
skipping to change at page 2, line 22 skipping to change at page 2, line 14
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. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 5 1.1.6. Examples . . . . . . . . . . . . . . . . . . . . . . 5
1.1.7. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 6
2. YANG Patch . . . . . . . . . . . . . . . . . . . . . . . . . 6 2. YANG Patch . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1. Target Resource . . . . . . . . . . . . . . . . . . . . . 6 2.1. Target Resource . . . . . . . . . . . . . . . . . . . . . 7
2.2. yang-patch Input . . . . . . . . . . . . . . . . . . . . 7 2.2. yang-patch Input . . . . . . . . . . . . . . . . . . . . 7
2.3. yang-patch-status Output . . . . . . . . . . . . . . . . 7 2.3. yang-patch-status Output . . . . . . . . . . . . . . . . 8
2.4. Target Data Node . . . . . . . . . . . . . . . . . . . . 8 2.4. Target Data Node . . . . . . . . . . . . . . . . . . . . 9
2.5. Edit Operations . . . . . . . . . . . . . . . . . . . . . 8 2.5. Edit Operations . . . . . . . . . . . . . . . . . . . . . 10
2.6. Successful Edit Response Handling . . . . . . . . . . . . 9 2.6. Successful Edit Response Handling . . . . . . . . . . . . 10
2.7. Error Handling . . . . . . . . . . . . . . . . . . . . . 9 2.7. Error Handling . . . . . . . . . . . . . . . . . . . . . 10
2.8. yang-patch RESTCONF Capability . . . . . . . . . . . . . 9 2.8. yang-patch RESTCONF Capability . . . . . . . . . . . . . 11
3. YANG Module . . . . . . . . . . . . . . . . . . . . . . . . . 9 3. YANG Module . . . . . . . . . . . . . . . . . . . . . . . . . 11
4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 18 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20
4.1. YANG Module Registry . . . . . . . . . . . . . . . . . . 18 4.1. YANG Module Registry . . . . . . . . . . . . . . . . . . 20
4.2. Media Types . . . . . . . . . . . . . . . . . . . . . . . 19 4.2. Media Types . . . . . . . . . . . . . . . . . . . . . . . 20
4.2.1. Media Type application/yang-patch . . . . . . . . . . 19 4.2.1. Media Type application/yang-patch-xml . . . . . . . . 20
4.2.2. Media Type application/yang-patch+json . . . . . . . 20 4.2.2. Media Type application/yang-patch+json . . . . . . . 22
4.3. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 22 4.3. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 24
5. Security Considerations . . . . . . . . . . . . . . . . . . . 23 5. Security Considerations . . . . . . . . . . . . . . . . . . . 24
6. Normative References . . . . . . . . . . . . . . . . . . . . 23 6. Normative References . . . . . . . . . . . . . . . . . . . . 24
Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 24 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 26
Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 25 Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 26
B.1. v09 to v10 . . . . . . . . . . . . . . . . . . . . . . . 25 B.1. v10 to v11 . . . . . . . . . . . . . . . . . . . . . . . 26
B.2. v08 to v09 . . . . . . . . . . . . . . . . . . . . . . . 25 B.2. v09 to v10 . . . . . . . . . . . . . . . . . . . . . . . 26
B.3. v07 to v08 . . . . . . . . . . . . . . . . . . . . . . . 25 B.3. v08 to v09 . . . . . . . . . . . . . . . . . . . . . . . 27
B.4. v06 to v07 . . . . . . . . . . . . . . . . . . . . . . . 26 B.4. v07 to v08 . . . . . . . . . . . . . . . . . . . . . . . 27
B.5. v05 to v06 . . . . . . . . . . . . . . . . . . . . . . . 26 B.5. v06 to v07 . . . . . . . . . . . . . . . . . . . . . . . 27
B.6. v04 to v05 . . . . . . . . . . . . . . . . . . . . . . . 26 B.6. v05 to v06 . . . . . . . . . . . . . . . . . . . . . . . 28
B.7. v03 to v04 . . . . . . . . . . . . . . . . . . . . . . . 26 B.7. v04 to v05 . . . . . . . . . . . . . . . . . . . . . . . 28
B.8. v02 to v03 . . . . . . . . . . . . . . . . . . . . . . . 27 B.8. v03 to v04 . . . . . . . . . . . . . . . . . . . . . . . 28
B.9. v01 to v02 . . . . . . . . . . . . . . . . . . . . . . . 27 B.9. v02 to v03 . . . . . . . . . . . . . . . . . . . . . . . 28
B.10. v00 to v01 . . . . . . . . . . . . . . . . . . . . . . . 27 B.10. v01 to v02 . . . . . . . . . . . . . . . . . . . . . . . 29
B.11. bierman:yang-patch-00 to ietf:yang-patch-00 . . . . . . . 28 B.11. v00 to v01 . . . . . . . . . . . . . . . . . . . . . . . 29
Appendix C. Open Issues . . . . . . . . . . . . . . . . . . . . 28 B.12. bierman:yang-patch-00 to ietf:yang-patch-00 . . . . . . . 30
Appendix D. Example YANG Module . . . . . . . . . . . . . . . . 28 Appendix C. Open Issues . . . . . . . . . . . . . . . . . . . . 30
D.1. YANG Patch Examples . . . . . . . . . . . . . . . . . . . 29 Appendix D. Example YANG Module . . . . . . . . . . . . . . . . 30
D.1.1. Add Resources: Error . . . . . . . . . . . . . . . . 29 D.1. YANG Patch Examples . . . . . . . . . . . . . . . . . . . 31
D.1.2. Add Resources: Success . . . . . . . . . . . . . . . 32 D.1.1. Add Resources: Error . . . . . . . . . . . . . . . . 31
D.1.3. Move list entry example . . . . . . . . . . . . . . . 33 D.1.2. Add Resources: Success . . . . . . . . . . . . . . . 34
D.1.4. Edit datastore resource example . . . . . . . . . . . 34 D.1.3. Insert list entry example . . . . . . . . . . . . . . 36
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 36 D.1.4. Move list entry example . . . . . . . . . . . . . . . 38
D.1.5. Edit datastore resource example . . . . . . . . . . . 39
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 41
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 [I-D.ietf-netmod-rfc6020bis]. An "ordered edit specified with YANG [I-D.ietf-netmod-rfc6020bis]. An "ordered edit
list" approach is needed to provide client developers with more list" approach is needed to provide RESTCONF client developers with
precise client control of the edit procedure than existing more precise RESTCONF client control of the edit procedure than
mechanisms. existing mechanisms found in [I-D.ietf-netconf-restconf].
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
[I-D.ietf-netconf-restconf]. [I-D.ietf-netconf-restconf].
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. It may be RESTCONF. This is outside the scope of this document. It may be
possible to use YANG Patch with datastore types other than a possible to use YANG Patch with datastore types other than a
configuration datastore. This is outside the scope of this document. configuration datastore. This is outside the scope of this document.
skipping to change at page 3, line 46 skipping to change at page 3, line 42
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP "OPTIONAL" in this document are to be interpreted as described in BCP
14, [RFC2119]. 14, [RFC2119].
1.1.1. NETCONF 1.1.1. NETCONF
The following terms are defined in [RFC6241]: The following terms are defined in [RFC6241]:
o client
o configuration data o configuration data
o datastore o datastore
o configuration datastore o configuration datastore
o protocol operation o protocol operation
o running configuration datastore o running configuration datastore
o server
o state data o state data
o user o user
1.1.2. HTTP 1.1.2. HTTP
The following terms are defined in [RFC7230]: The following terms are defined in [RFC7230]:
o header field o header field
o message body o message-body
o method
o query o query
o request URI o request URI
The following terms are defined in [RFC7231]:
o method
o request
o resource
1.1.3. YANG 1.1.3. YANG
The following terms are defined in [I-D.ietf-netmod-rfc6020bis]: The following terms are defined in [I-D.ietf-netmod-rfc6020bis]:
o container o container
o data node o data node
o key leaf
o leaf o leaf
o leaf-list o leaf-list
o list o list
o presence container (or P-container)
o RPC operation (now called protocol operation) o RPC operation (now called protocol operation)
o non-presence container (or NP-container)
o ordered-by system
o ordered-by user
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 [I-D.ietf-netconf-restconf]:
o application/yang-data o application/yang-data
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
o RESTCONF capability o RESTCONF capability
o target resource o target resource
skipping to change at page 5, line 32 skipping to change at page 5, line 20
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 server: a server which 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
data 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" 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 "application/
yang-data" or "application/yang-data+json". yang-data" or "application/yang-data+json".
1.1.6. Tree Diagrams o YANG Patch template: this is similar to a YANG data template,
except it has a representation with the media type "application/
yang-patch-xml" or "application/yang-patch+json".
1.1.6. Examples
Some protocol message lines within examples throughout the document
are split into multiple lines for display purposes only. When a line
ends with backslash ('\') as the last character, the line is wrapped
for display purposes. It is to be considered to be joined to the
next line by deleting the backslash, the following line break, and
the leading whitespace of the next line.
1.1.7. Tree Diagrams
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 meaning of the symbols in these diagrams is 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
(read-write) and "ro" state data (read-only). data (read-write), "ro" state data (read-only), and "x" 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 server. The specific fields are defined in target datastore by the RESTCONF server. The specific fields are
the YANG module in Section 3. defined in the YANG module in Section 3.
For RESTCONF, the YANG Patch operation is invoked by the client by The YANG Patch operation is invoked by the RESTCONF client by sending
sending a PATCH method request with a representation using either the a PATCH method request with a representation using either the
"application/yang-patch" or "application/yang-patch+json" media type. "application/yang-patch-xml" or "application/yang-patch+json" media
A message body representing the YANG Patch input parameters MUST be type. A message-body representing the YANG Patch input parameters
provided. MUST be provided.
YANG Patch has some features that are not possible with the PATCH
method in RESTCONF:
o YANG Patch allows multiple sub-resources to be edited at within
the same PATCH method.
o YANG Patch allows more precise edit operations than RESTCONF.
There are 7 operations supported (create, delete, insert, merge,
move, replace, remove).
o YANG Patch uses an edit list with an explicit processing order.
The edits are processed in client-specified order, and error
processing can be precise even when multiple errors occur in the
same patch request.
The YANG Patch "patch-id" may be useful for debugging, and SHOULD be
present in any audit audit logging records generated by the RESTCONF
server 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 media
type for YANG Patch. type for YANG Patch.
Note that YANG Patch can only edit data resources. The PATCH method
cannot be used to replace the datastore resource. Although the
"ietf-yang-patch" YANG module is written using YANG 1.1
[I-D.ietf-netmod-rfc6020bis], an implementation of YANG Patch can be
used with content defined in YANG 1.0 [RFC6020] as well.
Example: Example:
Accept-Patch: application/yang-patch,application/yang-patch+json Accept-Patch: application/yang-patch-xml,application/yang-patch+json
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" "JSON Encoding of Data Modeled with YANG"
[I-D.ietf-netmod-yang-json]. If any meta-data needs to be sent in a [I-D.ietf-netmod-yang-json]. If any meta-data needs to be sent in a
JSON message, it is encoded according to "Defining and Using Metadata JSON message, it is encoded according to "Defining and Using Metadata
with YANG" [I-D.ietf-netmod-yang-metadata]. with YANG" [I-D.ietf-netmod-yang-metadata].
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", or it can be a datastore resource itself, i.e., "{+restconf}/data", to edit top-
configuration data resource within the datastore resource, e.g., level configuration data resources, or it can be a configuration data
{+restconf/data/ietf-interfaces:interfaces". resource within the datastore resource, e.g., {+restconf/data/ietf-
interfaces:interfaces", to edit sub-resources within a top-level
configuration data resource.
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 Input 2.2. yang-patch Input
A YANG patch is optionally identified by a unique "patch-id" and it A YANG patch is optionally identified by a unique "patch-id" and it
may have an optional comment. A patch is an ordered collection of may have an optional comment. A patch is an ordered collection of
edits. Each edit is identified by an "edit-id" and it has an edit edits. Each edit is identified by an "edit-id" and it has an edit
operation (create, delete, insert, merge, move, replace, remove) that operation (create, delete, insert, merge, move, replace, remove) that
is applied to the target resource. Each edit can be applied to a is applied to the target resource. Each edit can be applied to a
sub-resource "target" within the target resource. If the operation sub-resource "target" within the target resource. If the operation
is "insert" or "move", then the "where" parameter indicates how the is "insert" or "move", then the "where" parameter indicates how the
node is inserted or moved. For values "before" and "after", the node is inserted or moved. For values "before" and "after", the
"point" parameter specifies the data node insertion point. "point" parameter specifies the data node insertion point.
A data element representing the YANG Patch is sent by the client to A message-body representing the YANG Patch is sent by the RESTCONF
specify the edit operation request. When used with the HTTP PATCH client to specify the edit operation request. When used with the
method, this data is identified by the YANG Patch media type. HTTP PATCH method, this data is identified by the YANG Patch media
type.
YANG Tree Diagram For "yang-patch" Container YANG tree diagram for "yang-patch" Container
+--rw yang-patch +---- yang-patch
+--rw patch-id? string +---- patch-id? string
+--rw comment? string +---- comment? string
+--rw edit [edit-id] +---- edit* [edit-id]
+--rw edit-id string +---- edit-id? string
+--rw operation enumeration +---- operation enumeration
+--rw target target-resource-offset +---- target target-resource-offset
+--rw point? target-resource-offset +---- point? target-resource-offset
+--rw where? enumeration +---- where? enumeration
+--rw value +---- value?
2.3. yang-patch-status Output 2.3. yang-patch-status Output
A data element representing the YANG Patch Status is returned to the A message-body representing the YANG Patch Status is returned to the
client to report the detailed status of the edit operation. When RESTCONF client to report the detailed status of the edit operation.
used with the HTTP PATCH method, this data is identified by the YANG When used with the HTTP PATCH method, this data is identified by the
Patch Status media type, and the syntax specification is defined in YANG Patch Status media type, and the syntax specification is defined
Section 3. in Section 3.
YANG Tree Diagram For "yang-patch-status" Container: YANG tree diagram for "yang-patch-status" Container:
+--rw yang-patch-status +---- yang-patch-status
+--rw patch-id? string +---- patch-id? string
+--rw (global-status)? +---- (global-status)?
| +--:(global-errors) | +--:(global-errors)
| | +--ro errors | | +---- errors
| | | | +---- error*
| +--:(ok) | | +---- error-type enumeration
| +--rw ok? empty | | +---- error-tag string
+--rw edit-status | | +---- error-app-tag? string
+--rw edit [edit-id] | | +---- error-path? instance-identifier
+--rw edit-id string | | +---- error-message? string
+--rw (edit-status-choice)? | | +---- error-info?
+--:(ok) | +--:(ok)
| +--rw ok? empty | +---- ok? empty
+--:(errors) +---- edit-status
+--ro errors +---- edit* [edit-id]
+---- edit-id? string
+---- (edit-status-choice)?
+--:(ok)
| +---- ok? empty
+--:(errors)
+---- errors
+---- error*
+---- error-type enumeration
+---- error-tag string
+---- error-app-tag? string
+---- error-path? instance-identifier
+---- error-message? string
+---- error-info?
2.4. Target Data Node 2.4. Target Data Node
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
skipping to change at page 8, line 43 skipping to change at page 10, line 14
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 or error |
| delete | delete a data resource if it already exists or | | delete | delete a data resource if it already exists or error |
| | 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 | | | create if it does not already exist |
| | resource; create if it does not already exist | | move | re-order the target data resource |
| move | re-order the target data resource | | replace | replace the target data resource with the edit value |
| replace | replace the target data resource with the edit | | remove | remove a data resource if it already exists |
| | value | +-----------+-------------------------------------------------------+
| remove | remove a data resource if it already exists or no |
| | error |
+---------------+---------------------------------------------------+
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 server SHOULD return If a YANG Patch is completed without errors, the RESTCONF server
a "yang-patch-status" message. SHOULD return a "yang-patch-status" message.
The server will save the running datastore to non-volatile storage if The RESTCONF server will save the running datastore to non-volatile
it supports non-volatile storage, and if the running datastore storage if it supports non-volatile storage, and if the running
contents have changed. This will be done in an implementation- datastore contents have changed, as specified in
specific manner. [I-D.ietf-netconf-restconf].
Refer to Appendix D.1.2 for a example of a successful YANG Patch Refer to Appendix D.1.2 for a 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 server will process the supplied edits in ascending order. The the RESTCONF server will process the supplied edits in ascending
following error modes apply to the processing of this edit list: order. The following error modes apply to the processing of this
edit list:
If a YANG Patch is completed with errors, the server SHOULD return a If a YANG Patch is completed with errors, the RESTCONF server SHOULD
"yang-patch-status" message. return a "yang-patch-status" message.
Refer to Appendix D.1.1 for a example of an error YANG Patch Refer to Appendix D.1.1 for a 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 server supports the YANG Patch media type, RESTCONF protocol. If the RESTCONF server supports the YANG Patch
then the "yang-patch" RESTCONF capability defined in Section 4.3 MUST media type, then the "yang-patch" RESTCONF capability defined in
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
[I-D.ietf-netconf-restconf]. [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 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 [I-D.ietf-netconf-restconf] is used
by this module for the 'yang-data' extension definition. by this module for the 'yang-data' extension definition.
RFC Ed.: update the date below with the date of RFC publication and RFC Ed.: update the date below with the date of RFC publication and
remove this note. remove this note.
<CODE BEGINS> file "ietf-yang-patch@2016-07-07.yang" <CODE BEGINS> file "ietf-yang-patch@2016-08-15.yang"
module ietf-yang-patch { module ietf-yang-patch {
yang-version 1.1; yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-patch"; namespace "urn:ietf:params:xml:ns:yang:ietf-yang-patch";
prefix "ypatch"; prefix "ypatch";
import ietf-restconf { prefix rc; } import ietf-restconf { prefix rc; }
organization organization
"IETF NETCONF (Network Configuration) Working Group"; "IETF NETCONF (Network Configuration) Working Group";
contact contact
"WG Web: <http://tools.ietf.org/wg/netconf/> "WG Web: <http://tools.ietf.org/wg/netconf/>
WG List: <mailto:netconf@ietf.org> WG List: <mailto:netconf@ietf.org>
Editor: Andy Bierman Author: Andy Bierman
<mailto:andy@yumaworks.com> <mailto:andy@yumaworks.com>
Editor: Martin Bjorklund Author: Martin Bjorklund
<mailto:mbj@tail-f.com> <mailto:mbj@tail-f.com>
Editor: Kent Watsen Author: Kent Watsen
<mailto:kwatsen@juniper.net>"; <mailto:kwatsen@juniper.net>";
description description
"This module contains conceptual YANG specifications "This module contains conceptual YANG specifications
for the YANG Patch and YANG Patch Status data structures. for the YANG Patch and YANG Patch Status data structures.
Note that the YANG definitions within this module do not Note that the YANG definitions within this module do not
represent configuration data of any kind. represent configuration data of any kind.
The YANG grouping statements provide a normative syntax The YANG grouping statements provide a normative syntax
for XML and JSON message encoding purposes. for XML and JSON message encoding purposes.
skipping to change at page 11, line 17 skipping to change at page 12, line 31
Relating to IETF Documents Relating to IETF Documents
(http://trustee.ietf.org/license-info). (http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; see This version of this YANG module is part of RFC XXXX; see
the RFC itself for full legal notices."; the RFC itself for full legal notices.";
// RFC Ed.: replace XXXX with actual RFC number and remove this // RFC Ed.: replace XXXX with actual RFC number and remove this
// note. // note.
// RFC Ed.: remove this note // RFC Ed.: remove this note
// Note: extracted from draft-ietf-netconf-yang-patch-10.txt // Note: extracted from draft-ietf-netconf-yang-patch-11.txt
// RFC Ed.: update the date below with the date of RFC publication // RFC Ed.: update the date below with the date of RFC publication
// and remove this note. // and remove this note.
revision 2016-07-07 { revision 2016-08-15 {
description description
"Initial revision."; "Initial revision.";
reference reference
"RFC XXXX: YANG Patch Media Type."; "RFC XXXX: YANG Patch Media Type.";
} }
typedef target-resource-offset { typedef target-resource-offset {
type string; type string;
description description
"Contains a data resource identifier string representing "Contains a data resource identifier string representing
skipping to change at page 12, line 39 skipping to change at page 13, line 52
included in the edit list. Any validation errors MUST included in the edit list. Any validation errors MUST
be reported in the reply message."; be reported in the reply message.";
reference reference
"draft-ietf-netmod-rfc6020bis, section 8.3."; "draft-ietf-netmod-rfc6020bis, section 8.3.";
leaf patch-id { leaf patch-id {
type string; type string;
description description
"An arbitrary string provided by the client to identify "An arbitrary string provided by the client to identify
the entire patch. This value SHOULD be present in any the entire patch. Error messages returned by the server
audit logging records generated by the server for the pertaining to this patch will be identified by this
patch. Error messages returned by the server pertaining patch-id value.";
to this patch will be identified by this patch-id value.";
} }
leaf comment { leaf comment {
type string; type string;
description description
"An arbitrary string provided by the client to describe "An arbitrary string provided by the client to describe
the entire patch. This value SHOULD be present in any the entire patch. This value SHOULD be present in any
audit logging records generated by the server for the audit logging records generated by the server for the
patch."; patch.";
} }
list edit { list edit {
key edit-id; key edit-id;
ordered-by user; ordered-by user;
description description
"Represents one edit within the YANG Patch "Represents one edit within the YANG Patch
request message. The edit list is applied request message. The edit list is applied
in the following manner: in the following manner:
skipping to change at page 17, line 25 skipping to change at page 18, line 35
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 unrelated to a specific edit occurred."; errors that are unrelated to a specific edit
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.";
} }
} }
skipping to change at page 18, line 48 skipping to change at page 20, line 13
<CODE ENDS> <CODE ENDS>
4. IANA Considerations 4. IANA Considerations
4.1. YANG Module Registry 4.1. YANG Module Registry
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]. Following the format in RFC 3688, the following
registration is requested to be made. 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 NETCONF WG of the IETF.
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 // RFC Ed.: replace XXXX with RFC number and remove this note
reference: RFC XXXX reference: RFC XXXX
4.2. Media Types 4.2. Media Types
4.2.1. Media Type application/yang-patch 4.2.1. Media Type application/yang-patch-xml
Type name: application Type name: application
Subtype name: yang-patch Subtype name: yang-patch
Required parameters: None Required parameters: None
Optional parameters: None Optional parameters: None
// RFC Ed.: replace draft-ietf-netmod-rfc6020bis with // RFC Ed.: replace draft-ietf-netmod-rfc6020bis with
// the actual RFC reference for YANG 1.1, and remove this note. // the actual RFC reference for YANG 1.1, and remove this note.
// RFC Ed.: replace 'XXXX' with the real RFC number, // RFC Ed.: replace 'XXXX' with the real RFC number,
// and remove this note // and remove this note
Encoding considerations: 8-bit Encoding considerations: 8-bit
Each conceptual YANG data node is encoded according to the Each conceptual YANG data node is encoded according to the
XML Encoding Rules and Canonical Format for the specific XML Encoding Rules and Canonical Format for the specific
YANG data node type defined in [draft-ietf-netmod-rfc6020bis]. YANG data node type defined in [draft-ietf-netmod-rfc6020bis].
In addition, the "yang-patch" YANG data template found In addition, the "yang-patch" YANG Patch template found
in [RFCXXXX] defines the structure of a YANG Patch request. in [RFCXXXX] defines the structure of a YANG Patch request.
// RFC Ed.: replace 'NN' in Section NN of [RFCXXXX] with the // RFC Ed.: replace 'NN' in Section NN of [RFCXXXX] with the
// section number for Security Considerations // section number for Security Considerations
// Replace 'XXXX' in Section NN of [RFCXXXX] with the actual // Replace 'XXXX' in Section NN of [RFCXXXX] with the actual
// RFC number, and remove this note. // RFC number, and remove this note.
Security considerations: Security considerations related Security considerations: Security considerations related
to the generation and consumption of RESTCONF messages to the generation and consumption of RESTCONF messages
are discussed in Section NN of [RFCXXXX]. are discussed in Section NN of [RFCXXXX].
skipping to change at page 21, line 25 skipping to change at page 22, line 37
// the actual RFC reference for JSON Encoding of YANG Data, // the actual RFC reference for JSON Encoding of YANG Data,
// and remove this note. // and remove this note.
// RFC Ed.: replace 'XXXX' with the real RFC number, // RFC Ed.: replace 'XXXX' with the real RFC number,
// and remove this note // and remove this note
Encoding considerations: 8-bit Encoding considerations: 8-bit
Each conceptual YANG data node is encoded according to Each conceptual YANG data node is encoded according to
[draft-ietf-netmod-yang-json]. A data annotation is [draft-ietf-netmod-yang-json]. A data annotation is
encoded according to [draft-ietf-netmod-yang-metadata] encoded according to [draft-ietf-netmod-yang-metadata]
In addition, the "yang-patch" YANG data template found In addition, the "yang-patch" YANG Patch template found
in [RFCXXXX] defines the structure of a YANG Patch request. in [RFCXXXX] defines the structure of a YANG Patch request.
// RFC Ed.: replace 'NN' in Section NN of [RFCXXXX] with the // RFC Ed.: replace 'NN' in Section NN of [RFCXXXX] with the
// section number for Security Considerations // section number for Security Considerations
// Replace 'XXXX' in Section NN of [RFCXXXX] with the actual // Replace 'XXXX' in Section NN of [RFCXXXX] with the actual
// RFC number, and remove this note. // RFC number, and remove this note.
Security considerations: Security considerations related Security considerations: Security considerations related
to the generation and consumption of RESTCONF messages to the generation and consumption of RESTCONF messages
are discussed in Section NN of [RFCXXXX]. are discussed in Section NN of [RFCXXXX].
skipping to change at page 23, line 16 skipping to change at page 24, line 28
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
[I-D.ietf-netconf-restconf]. This document defines edit processing [I-D.ietf-netconf-restconf]. This document defines edit processing
instructions for a variant of the PATCH method, as used within the instructions for a variant of the PATCH method, as used within the
RESTCONF protocol. 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, which is outside the scope of this document. RESTCONF, which is outside the scope of this document.
It is important for server implementations to carefully validate all It is important for RESTCONF server implementations to carefully
the edit request parameters in some manner. If the entire YANG Patch validate all the edit request parameters in some manner. If the
request cannot be completed, then no configuration changes to the entire YANG Patch request cannot be completed, then no configuration
system are done. changes to the system are done. A PATCH request MUST be applied
atomically, as specified in section 2 of [RFC5789].
A server implementation SHOULD attempt to prevent system disruption A RESTCONF server implementation SHOULD attempt to prevent system
due to partial processing of the YANG Patch edit list. It may be disruption due to partial processing of the YANG Patch edit list. It
possible to construct an attack on such a server, which relies on the may be possible to construct an attack on such a RESTCONF server,
edit processing order mandated by YANG Patch. which relies on the edit processing order mandated by YANG Patch.
A RESTCONF server implementation SHOULD attempt to prevent system
disruption due to excessive resource consumption required to fulfill
YANG Patch edit requests. It may be possible to construct an attack
on such a RESTCONF server, which attempts to consume all available
memory or other resource types.
6. Normative References 6. Normative References
[I-D.ietf-netconf-restconf] [I-D.ietf-netconf-restconf]
Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF
Protocol", draft-ietf-netconf-restconf-13 (work in Protocol", draft-ietf-netconf-restconf-13 (work in
progress), April 2016. progress), April 2016.
[I-D.ietf-netmod-rfc6020bis] [I-D.ietf-netmod-rfc6020bis]
Bjorklund, M., "The YANG 1.1 Data Modeling Language", Bjorklund, M., "The YANG 1.1 Data Modeling Language",
skipping to change at page 24, line 9 skipping to change at page 25, line 27
draft-ietf-netmod-yang-metadata-07 (work in progress), draft-ietf-netmod-yang-metadata-07 (work in progress),
March 2016. March 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, March 1997.
[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", RFC [RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP",
5789, March 2010. RFC 5789, March 2010.
[RFC6020] Bjorklund, M., "YANG - A Data Modeling Language for the [RFC6020] Bjorklund, M., "YANG - A Data Modeling Language for the
Network Configuration Protocol (NETCONF)", RFC 6020, Network Configuration Protocol (NETCONF)", RFC 6020,
October 2010. October 2010.
[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, June 2011.
[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, March
2014, <http://www.rfc-editor.org/info/rfc7159>. 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 Transfer
Protocol (HTTP/1.1): Message Syntax and Routing", RFC Protocol (HTTP/1.1): Message Syntax and Routing",
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
(HTTP/1.1): Semantics and Content", RFC 7231, June 2014.
[W3C.REC-xml-20081126] [W3C.REC-xml-20081126]
Yergeau, F., Maler, E., Paoli, J., Sperberg-McQueen, C., Yergeau, F., Maler, E., Paoli, J., Sperberg-McQueen, C.,
and T. Bray, "Extensible Markup Language (XML) 1.0 (Fifth and T. Bray, "Extensible Markup Language (XML) 1.0 (Fifth
Edition)", World Wide Web Consortium Recommendation REC- Edition)", World Wide Web Consortium Recommendation REC-
xml-20081126, November 2008, 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 Appendix A. Acknowledgements
The authors would like to thank the following people for their The authors would like to thank the following people for their
skipping to change at page 25, line 7 skipping to change at page 26, line 26
Contributions to this material by Andy Bierman are based upon work Contributions to this material by Andy Bierman are based upon work
supported by the The Space & Terrestrial Communications Directorate supported by the The Space & Terrestrial Communications Directorate
(S&TCD) under Contract No. W15P7T-13-C-A616. Any opinions, findings (S&TCD) under Contract No. W15P7T-13-C-A616. Any opinions, findings
and conclusions or recommendations expressed in this material are and conclusions or recommendations expressed in this material are
those of the author(s) and do not necessarily reflect the views of those of the author(s) and do not necessarily reflect the views of
The Space & Terrestrial Communications Directorate (S&TCD). The Space & Terrestrial Communications Directorate (S&TCD).
Appendix B. Change Log Appendix B. Change Log
-- RFC Ed.: remove this section before publication. -- RFC Ed.: remove this section before publication.
The YANG Patch issue tracker can be found here: https://github.com/ The YANG Patch issue tracker can be found here: https://github.com/
netconf-wg/yang-patch/issues netconf-wg/yang-patch/issues
B.1. v09 to v10 B.1. 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 exmaples
o added insert list example
B.2. v09 to v10
o change yang-patch+xml to yang-patch o change yang-patch+xml to yang-patch
o clarify application/yang-patch+json media type o clarify application/yang-patch+json media type
o add edit datastore example o add edit datastore example
o change data-resource-offset typedef so it is consistent for XML o change data-resource-offset typedef so it is consistent for XML
and JSON and JSON
B.2. v08 to v09 B.3. v08 to v09
o change RFC 7158 reference to RFC 7159 reference o change RFC 7158 reference to RFC 7159 reference
o change RFC 2616 reference to RFC 7230 reference o change RFC 2616 reference to RFC 7230 reference
o remove unused HTTP terms o remove unused HTTP terms
o remove import-by-revision of ietf-restconf; not needed o remove import-by-revision of ietf-restconf; not needed
o change application/yang.patch media type to application/yang-patch o change application/yang.patch media type to application/yang-patch
o remove application/yang.patch-status media type; use application/ o remove application/yang.patch-status media type; use application/
yang-data instead yang-data instead
B.3. v07 to v08 B.4. v07 to v08
o clarified target datastore and target data node terms o clarified target datastore and target data node terms
o clarified that target leaf can be single forward slash '/' o clarified that target leaf can be single forward slash '/'
o added Successful edit response handling section o added Successful edit response handling section
o clarified that YANG Patch draft is for RESTCONF protocol only but o clarified that YANG Patch draft is for RESTCONF protocol only but
may be defined for other protocols outside this document may be defined for other protocols outside this document
o clarified that YANG Patch draft is for configuration datastores o clarified that YANG Patch draft is for configuration datastores
only but may be defined for other datastore types outside this only but may be defined for other datastore types outside this
document document
o fixed typos o fixed typos
B.4. v06 to v07 B.5. v06 to v07
o converted YANG module to YANG 1.1 o converted YANG module to YANG 1.1
o changed anyxml value to anydata value o changed anyxml value to anydata value
o updated import revision date for ietf-restconf o updated import revision date for ietf-restconf
o updated revision date for ietf-yang-patch because import-by- o updated revision date for ietf-yang-patch because import-by-
revision date needed to be changed revision date needed to be changed
B.5. v05 to v06 B.6. v05 to v06
o changed errors example so a full request and error response is o changed errors example so a full request and error response is
shown in XML format shown in XML format
o fixed error-path to match instance-identifier encoding for both o fixed error-path to match instance-identifier encoding for both
XML and JSON XML and JSON
o added references for YANG to JSON and YANG Metadata drafts o added references for YANG to JSON and YANG Metadata drafts
o clarified that YANG JSON drafts are used for encoding, not plain o clarified that YANG JSON drafts are used for encoding, not plain
JSON JSON
B.6. v04 to v05 B.7. v04 to v05
o updated reference to RESTCONF o updated reference to RESTCONF
B.7. v03 to v04 B.8. v03 to v04
o removed NETCONF specific text o removed NETCONF specific text
o changed data-resource-offset typedef from a relative URI to an o changed data-resource-offset typedef from a relative URI to an
XPath absolute path expression XPath absolute path expression
o clarified insert operation o clarified insert operation
o removed requirement that edits MUST be applied in ascending order o removed requirement that edits MUST be applied in ascending order
o change SHOULD keep datastore unchanged on error to MUST (this is o change SHOULD keep datastore unchanged on error to MUST (this is
required by HTTP PATCH) required by HTTP PATCH)
o removed length restriction on 'comment' leaf o removed length restriction on 'comment' leaf
o updated YANG tree for example-jukebox library o updated YANG tree for example-jukebox library
B.8. v02 to v03 B.9. v02 to v03
o added usage of restconf-media-type extension to map the yang-patch o added usage of restconf-media-type extension to map the yang-patch
and yang-patch-status groupings to media types and yang-patch-status groupings to media types
o added yang-patch RESTCONF capability URI o added yang-patch RESTCONF capability URI
o Added sub-section for terms used from RESTCONF o Added sub-section for terms used from RESTCONF
o filled in security considerations section o filled in security considerations section
B.9. v01 to v02 B.10. v01 to v02
o Reversed order of change log o Reversed order of change log
o Clarified anyxml structure of "value" parameter within a YANG o Clarified anyxml structure of "value" parameter within a YANG
patch request (github issue #1) patch request (github issue #1)
o Updated RESTCONF reference o Updated RESTCONF reference
o Added note to open issues section to check github instead o Added note to open issues section to check github instead
B.10. v00 to v01 B.11. v00 to v01
o Added text requiring support for Accept-Patch header field, and o Added text requiring support for Accept-Patch header field, and
removed 'Identification of YANG Patch capabilities' open issue. removed 'Identification of YANG Patch capabilities' open issue.
o Removed 'location' leaf from yang-patch-status grouping o Removed 'location' leaf from yang-patch-status grouping
o Removed open issue 'Protocol independence' because the location o Removed open issue 'Protocol independence' because the location
leaf was removed. leaf was removed.
o Removed open issue 'RESTCONF coupling' because there is no concern o Removed open issue 'RESTCONF coupling' because there is no concern
skipping to change at page 28, line 18 skipping to change at page 30, line 5
o Removed open issue 'Bulk editing support in yang-patch-status'. o Removed open issue 'Bulk editing support in yang-patch-status'.
The 'location' leaf has been removed so this issue is no longer The 'location' leaf has been removed so this issue is no longer
applicable. applicable.
o Removed open issue 'Edit list mechanism'. Added text to the o Removed open issue 'Edit list mechanism'. Added text to the
'edit' list description-stmt about how the individual edits must 'edit' list description-stmt about how the individual edits must
be processed. There is no concern about duplicate edits which be processed. There is no concern about duplicate edits which
cause intermediate results to be altered by subsequent edits in cause intermediate results to be altered by subsequent edits in
the same edit list. the same edit list.
B.11. bierman:yang-patch-00 to ietf:yang-patch-00 B.12. bierman:yang-patch-00 to ietf:yang-patch-00
o Created open issues section o Created open issues section
Appendix C. Open Issues Appendix C. Open Issues
-- RFC Ed.: remove this section before publication. -- RFC Ed.: remove this section before publication.
Refer to the github issue tracker for any open issues: Refer to the github issue tracker for any open issues:
https://github.com/netconf-wg/yang-patch/issues https://github.com/netconf-wg/yang-patch/issues
Appendix D. Example YANG Module Appendix D. 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 [I-D.ietf-netconf-restconf].
YANG Tree Diagram for "example-jukebox" Module: YANG tree diagram for "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
| | | +--rw label? string | | | +--rw label? string
| | | +--rw catalogue-number? string | | | +--rw catalogue-number? string
| | +--rw song* [name] | | +--rw song* [name]
| | +--rw name string | | +--rw name string
| | +--rw location string | | +--rw location string
| | +--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 leafref
+--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 D.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 D.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. The XML encoding is
used in this example. used in this example.
Request from 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 Accept: application/yang-data
Content-Type: application/yang-patch Content-Type: application/yang-patch-xml
<yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch"> <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> <edit>
<edit-id>edit1</edit-id> <edit-id>edit1</edit-id>
<operation>create</operation> <operation>create</operation>
<target>/song</target> <target>/song=Bridge%20Burning</target>
<value> <value>
<song xmlns="http://example.com/ns/example-jukebox"> <song xmlns="http://example.com/ns/example-jukebox">
<name>Bridge Burning</name> <name>Bridge Burning</name>
<location>/media/bridge_burning.mp3</location> <location>/media/bridge_burning.mp3</location>
<format>MP3</format> <format>MP3</format>
<length>288</length> <length>288</length>
</song> </song>
</value> </value>
</edit> </edit>
<edit> <edit>
<edit-id>edit2</edit-id> <edit-id>edit2</edit-id>
<operation>create</operation> <operation>create</operation>
<target>/song</target> <target>/song=Rope</target>
<value> <value>
<song xmlns="http://example.com/ns/example-jukebox"> <song xmlns="http://example.com/ns/example-jukebox">
<name>Rope</name> <name>Rope</name>
<location>/media/rope.mp3</location> <location>/media/rope.mp3</location>
<format>MP3</format> <format>MP3</format>
<length>259</length> <length>259</length>
</song> </song>
</value> </value>
</edit> </edit>
<edit> <edit>
<edit-id>edit3</edit-id> <edit-id>edit3</edit-id>
<operation>create</operation> <operation>create</operation>
<target>/song</target> <target>/song=Dear%20Rosemary</target>
<value> <value>
<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 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: Mon, 23 Apr 2012 13:01:20 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT
Content-Type: application/yang-data Content-Type: application/yang-data
<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='Burning Light']
</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 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 instance-identifier encoding in the "JSON Encoding of YANG Data"
Data" draft is used. The "error-path" string is wrapped for draft is used.
display purposes.
HTTP/1.1 409 Conflict HTTP/1.1 409 Conflict
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Mon, 23 Apr 2012 13:01:20 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Mon, 23 Apr 2012 13:01:20 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='Burning Light']",
"error-message": "error-message":
"Data already exists, cannot be created" "Data already exists, cannot be created"
} }
] ]
} }
} }
] ]
} }
} }
skipping to change at page 32, line 29 skipping to change at page 34, line 47
D.1.2. Add Resources: Success D.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 2 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 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
{ {
"ietf-yang-patch:yang-patch" : { "ietf-yang-patch:yang-patch" : {
"patch-id" : "add-songs-patch-2", "patch-id" : "add-songs-patch-2",
"edit" : [ "edit" : [
{ {
"edit-id" : "edit1", "edit-id" : "edit1",
"operation" : "create", "operation" : "create",
"target" : "/song", "target" : "/song=Rope",
"value" : { "value" : {
"song" : { "song" : {
"name" : "Rope", "name" : "Rope",
"location" : "/media/rope.mp3", "location" : "/media/rope.mp3",
"format" : "MP3", "format" : "MP3",
"length" : 259 "length" : 259
} }
} }
}, },
{ {
"edit-id" : "edit2", "edit-id" : "edit2",
"operation" : "create", "operation" : "create",
"target" : "/song", "target" : "/song=Dear%20Rosemary",
"value" : { "value" : {
"song" : { "song" : {
"name" : "Dear Rosemary", "name" : "Dear Rosemary",
"location" : "/media/dear_rosemary.mp3", "location" : "/media/dear_rosemary.mp3",
"format" : "MP3", "format" : "MP3",
"length" : 269 "length" : 269
} }
} }
} }
] ]
} }
} }
Response from server: Response from the RESTCONF server:
HTTP/1.1 200 Success HTTP/1.1 200 Success
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Mon, 23 Apr 2012 13:01:20 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Mon, 23 Apr 2012 13:01:20 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. Move list entry example D.1.3. Insert list entry example
The following example shows a song being inserted within an existing
playlist. Song "6" in playlist "Foo-One" is being inserted after
song "5" in the playlist. The operation succeeds, so a non-error
reply example can be shown.
Request from the RESTCONF client:
PATCH /restconf/data/example-jukebox:jukebox/
playlist=Foo-One HTTP/1.1
Host: example.com
Accept: application/yang-data+json
Content-Type: application/yang-patch+json
{
"ietf-yang-patch:yang-patch" : {
"patch-id" : "move-song-patch",
"comment" : "Insert song 6 after song 5",
"edit" : [
{
"edit-id" : "edit1",
"operation" : "insert",
"target" : "/song=6",
"point" : "/song=5",
"where" : "after",
"value" : {
"example-jukebox:song" : {
"name" : "Dear Prudence",
"location" : "/media/dear_prudence.mp3",
"format" : "MP3",
"length" : 236
}
}
}
]
}
}
Response from the RESTCONF server:
HTTP/1.1 400 OK
Date: Mon, 23 Apr 2012 13:01:20 GMT
Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT
Content-Type: application/yang-data+json
{
"ietf-restconf:yang-patch-status" : {
"patch-id" : "move-song-patch",
"ok" : [null]
}
}
D.1.4. Move list entry example
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 song
"3" in the playlist. The operation succeeds, so a non-error reply "3" in the playlist. Note that no "value" parameter is needed for a
"move" operation. The operation succeeds, so a non-error reply
example can be shown. example can be shown.
Request from 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" : "move-song-patch",
"comment" : "Move song 1 after song 3", "comment" : "Move song 1 after song 3",
"edit" : [ "edit" : [
{ {
"edit-id" : "edit1", "edit-id" : "edit1",
"operation" : "move", "operation" : "move",
"target" : "/song/1", "target" : "/song=1",
"point" : "/song3", "point" : "/song=3",
"where" : "after" "where" : "after"
} }
] ]
} }
} }
Response from server: Response from the RESTCONF server:
HTTP/1.1 400 OK HTTP/1.1 400 OK
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Mon, 23 Apr 2012 13:01:20 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Mon, 23 Apr 2012 13:01:20 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.4. Edit datastore resource example D.1.5. Edit datastore resource example
The following example shows how 3 top-level data nodes from different The following example shows how 3 top-level data nodes from different
modules can be edited at the same time. 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 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
Content-Type: application/yang-patch+json Content-Type: application/yang-patch+json
{ {
"ietf-yang-patch:yang-patch" : { "ietf-yang-patch:yang-patch" : {
"patch-id" : "datastore-patch-1", "patch-id" : "datastore-patch-1",
"comment" : "Edit 3 top-level data nodes at once", "comment" : "Edit 3 top-level data nodes at once",
"edit" : [ "edit" : [
{ {
"edit-id" : "edit1", "edit-id" : "edit1",
"operation" : "create", "operation" : "create",
"target" : "/foo:X", "target" : "/foo:X",
"value" : { "value" : {
skipping to change at page 35, line 44 skipping to change at page 40, line 50
"C" : 2, "C" : 2,
"D" : 100, "D" : 100,
"E" : false "E" : false
} }
} }
} }
] ]
} }
} }
Response from server: Response from the RESTCONF server:
HTTP/1.1 400 OK HTTP/1.1 400 OK
Date: Mon, 23 Apr 2012 13:02:20 GMT Date: Mon, 23 Apr 2012 13:02:20 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Mon, 23 Apr 2012 13:01:20 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" : "datastore-patch-1", "patch-id" : "datastore-patch-1",
"ok" : [null] "ok" : [null]
} }
} }
Authors' Addresses Authors' Addresses
Andy Bierman Andy Bierman
 End of changes. 102 change blocks. 
320 lines changed or deleted 453 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/