draft-ietf-netconf-yang-patch-05.txt | draft-ietf-netconf-yang-patch-06.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 7, 2016 Tail-f Systems | Expires: April 20, 2016 Tail-f Systems | |||
K. Watsen | K. Watsen | |||
Juniper Networks | Juniper Networks | |||
July 6, 2015 | October 18, 2015 | |||
YANG Patch Media Type | YANG Patch Media Type | |||
draft-ietf-netconf-yang-patch-05 | draft-ietf-netconf-yang-patch-06 | |||
Abstract | Abstract | |||
This document describes a method for applying patches to NETCONF | This document describes a method for applying patches to NETCONF | |||
datastores using data defined with the YANG data modeling language. | datastores using data defined with the YANG data 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 | |||
provisions of BCP 78 and BCP 79. | provisions of BCP 78 and BCP 79. | |||
skipping to change at page 1, line 34 | skipping to change at page 1, line 34 | |||
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 7, 2016. | This Internet-Draft will expire on April 20, 2016. | |||
Copyright Notice | Copyright Notice | |||
Copyright (c) 2015 IETF Trust and the persons identified as the | Copyright (c) 2015 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 . . . . . . . . . . . . . . . . . . . . . . . . 2 | 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 . . . . . . . . . . . . . . . . . . . . . . . . 3 | 1.1.2. HTTP . . . . . . . . . . . . . . . . . . . . . . . . 4 | |||
1.1.3. YANG . . . . . . . . . . . . . . . . . . . . . . . . 4 | 1.1.3. YANG . . . . . . . . . . . . . . . . . . . . . . . . 4 | |||
1.1.4. RESTCONF . . . . . . . . . . . . . . . . . . . . . . 4 | 1.1.4. RESTCONF . . . . . . . . . . . . . . . . . . . . . . 5 | |||
1.1.5. YANG Patch . . . . . . . . . . . . . . . . . . . . . 5 | 1.1.5. YANG Patch . . . . . . . . . . . . . . . . . . . . . 5 | |||
1.1.6. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 5 | 1.1.6. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 5 | |||
2. YANG Patch . . . . . . . . . . . . . . . . . . . . . . . . . 5 | 2. YANG Patch . . . . . . . . . . . . . . . . . . . . . . . . . 6 | |||
2.1. Target Resource . . . . . . . . . . . . . . . . . . . . . 6 | 2.1. Target Resource . . . . . . . . . . . . . . . . . . . . . 6 | |||
2.2. yang-patch Input . . . . . . . . . . . . . . . . . . . . 6 | 2.2. yang-patch Input . . . . . . . . . . . . . . . . . . . . 6 | |||
2.3. yang-patch-status Output . . . . . . . . . . . . . . . . 7 | 2.3. yang-patch-status Output . . . . . . . . . . . . . . . . 7 | |||
2.4. Target Data Node . . . . . . . . . . . . . . . . . . . . 7 | 2.4. Target Data Node . . . . . . . . . . . . . . . . . . . . 7 | |||
2.5. Edit Operations . . . . . . . . . . . . . . . . . . . . . 7 | 2.5. Edit Operations . . . . . . . . . . . . . . . . . . . . . 8 | |||
2.6. Error Handling . . . . . . . . . . . . . . . . . . . . . 8 | 2.6. Error Handling . . . . . . . . . . . . . . . . . . . . . 8 | |||
2.7. yang-patch RESTCONF Capability . . . . . . . . . . . . . 8 | 2.7. yang-patch RESTCONF Capability . . . . . . . . . . . . . 9 | |||
3. YANG Module . . . . . . . . . . . . . . . . . . . . . . . . . 8 | 3. YANG Module . . . . . . . . . . . . . . . . . . . . . . . . . 9 | |||
4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17 | 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 18 | |||
4.1. YANG Module Registry . . . . . . . . . . . . . . . . . . 17 | 4.1. YANG Module Registry . . . . . . . . . . . . . . . . . . 18 | |||
4.2. application/yang.patch Media Types . . . . . . . . . . . 18 | 4.2. application/yang.patch Media Types . . . . . . . . . . . 18 | |||
4.3. application/yang.patch-status Media Types . . . . . . . . 18 | 4.3. application/yang.patch-status Media Types . . . . . . . . 19 | |||
4.4. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 19 | 4.4. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 19 | |||
5. Security Considerations . . . . . . . . . . . . . . . . . . . 19 | 5. Security Considerations . . . . . . . . . . . . . . . . . . . 19 | |||
6. Normative References . . . . . . . . . . . . . . . . . . . . 19 | 6. Normative References . . . . . . . . . . . . . . . . . . . . 20 | |||
Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 20 | Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 21 | |||
Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 20 | Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 21 | |||
B.1. 04 to 05 . . . . . . . . . . . . . . . . . . . . . . . . 20 | B.1. v05 to v06 . . . . . . . . . . . . . . . . . . . . . . . 21 | |||
B.2. 03 to 04 . . . . . . . . . . . . . . . . . . . . . . . . 20 | B.2. v04 to v05 . . . . . . . . . . . . . . . . . . . . . . . 21 | |||
B.3. 02 to 03 . . . . . . . . . . . . . . . . . . . . . . . . 21 | B.3. v03 to v04 . . . . . . . . . . . . . . . . . . . . . . . 21 | |||
B.4. 01 to 02 . . . . . . . . . . . . . . . . . . . . . . . . 21 | B.4. v02 to v03 . . . . . . . . . . . . . . . . . . . . . . . 22 | |||
B.5. 00 to 01 . . . . . . . . . . . . . . . . . . . . . . . . 21 | B.5. v01 to v02 . . . . . . . . . . . . . . . . . . . . . . . 22 | |||
B.6. bierman:yang-patch-00 to ietf:yang-patch-00 . . . . . . . 22 | B.6. v00 to v01 . . . . . . . . . . . . . . . . . . . . . . . 22 | |||
Appendix C. Open Issues . . . . . . . . . . . . . . . . . . . . 22 | B.7. bierman:yang-patch-00 to ietf:yang-patch-00 . . . . . . . 23 | |||
Appendix D. Example YANG Module . . . . . . . . . . . . . . . . 22 | Appendix C. Open Issues . . . . . . . . . . . . . . . . . . . . 23 | |||
D.1. YANG Patch Examples . . . . . . . . . . . . . . . . . . . 23 | Appendix D. Example YANG Module . . . . . . . . . . . . . . . . 23 | |||
D.1.1. Add Resources: Error . . . . . . . . . . . . . . . . 23 | D.1. YANG Patch Examples . . . . . . . . . . . . . . . . . . . 24 | |||
D.1.2. Add Resources: Success . . . . . . . . . . . . . . . 25 | D.1.1. Add Resources: Error . . . . . . . . . . . . . . . . 24 | |||
D.1.3. Move list entry example . . . . . . . . . . . . . . . 27 | D.1.2. Add Resources: Success . . . . . . . . . . . . . . . 27 | |||
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 28 | D.1.3. Move list entry example . . . . . . . . . . . . . . . 28 | |||
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 29 | ||||
1. Introduction | 1. Introduction | |||
There is a need for standard mechanisms to patch NETCONF [RFC6241] | There is a need for standard mechanisms to patch NETCONF [RFC6241] | |||
datastores which contain conceptual data that conforms to schema | datastores which contain conceptual data that conforms to schema | |||
specified with YANG [RFC6020]. An "ordered edit list" approach is | specified with YANG [RFC6020]. An "ordered edit list" approach is | |||
needed to provide client developers with a simpler edit request | needed to provide client developers with a simpler edit request | |||
format that can be more efficient and also allow more precise client | format that can be more efficient and also allow more precise client | |||
control of the transaction procedure than existing mechanisms. | control of the transaction procedure than existing mechanisms. | |||
skipping to change at page 6, line 9 | skipping to change at page 6, line 20 | |||
For RESTCONF, the YANG Patch operation is invoked by the client by | For RESTCONF, the YANG Patch operation is invoked by the client by | |||
sending a PATCH method request with the YANG Patch media type. A | sending a PATCH method request with the YANG Patch media type. A | |||
message body representing the YANG Patch input parameters MUST be | message body representing the YANG Patch input parameters MUST be | |||
provided. | provided. | |||
The RESTCONF server MUST return the Accept-Patch header in an OPTIONS | The RESTCONF server MUST return the Accept-Patch header in an OPTIONS | |||
response, as specified in [RFC5789], which includes the media type | response, as specified in [RFC5789], which includes the media type | |||
for YANG Patch. | for YANG Patch. | |||
A YANG Patch can be encoded in XML format according to | ||||
[W3C.REC-xml-20081126]. It can also be encoded in JSON, according to | ||||
"JSON Encoding of Data Modeled with YANG" | ||||
[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 | ||||
with YANG" [I-D.ietf-netmod-yang-metadata]. | ||||
Example: | Example: | |||
Accept-Patch: application/yang.patch | Accept-Patch: application/yang.patch | |||
2.1. Target Resource | 2.1. Target Resource | |||
The YANG Patch operation uses a conceptual root within a NETCONF | The YANG Patch operation uses a conceptual root within a NETCONF | |||
configuration datastore to identity the patch point for the edit | configuration datastore to identity the patch point for the edit | |||
operation. This root can be the datastore itself, or 1 or more data | operation. This root can be the datastore itself, or 1 or more data | |||
nodes within the datastore. | nodes within the datastore. | |||
For RESTCONF, the target resource is derived from the request URI. | For RESTCONF, the target resource is derived from the request URI. | |||
skipping to change at page 6, line 40 | skipping to change at page 7, line 11 | |||
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 data element representing the YANG Patch is sent by the client to | |||
specify the edit operation request. When used with the HTTP PATCH | specify the edit operation request. When used with the HTTP PATCH | |||
method, this data is identified by the YANG Patch media type. | 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 | +--rw yang-patch | |||
+--rw patch-id? string | +--rw patch-id? string | |||
+--rw comment? string | +--rw comment? string | |||
+--rw edit [edit-id] | +--rw edit [edit-id] | |||
+--rw edit-id string | +--rw edit-id string | |||
+--rw operation enumeration | +--rw operation enumeration | |||
+--rw target target-resource-offset | +--rw target target-resource-offset | |||
+--rw point? target-resource-offset | +--rw point? target-resource-offset | |||
+--rw where? enumeration | +--rw where? enumeration | |||
+--rw value | +--rw 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 data element representing the YANG Patch Status is returned to the | |||
client to report the detailed status of the edit operation. When | client to report the detailed status of the edit operation. When | |||
used with the HTTP PATCH method, this data is identified by the YANG | used with the HTTP PATCH method, this data is identified by the YANG | |||
Patch Status media type, and the syntax specification is defined in | Patch Status media type, and the syntax specification is defined in | |||
Section 3. | Section 3. | |||
YANG Tree Diagram For "yang-patch-status" Container: | YANG Tree Diagram For "yang-patch-status" Container: | |||
+--rw yang-patch-status | +--rw yang-patch-status | |||
+--rw patch-id? string | +--rw patch-id? string | |||
+--rw (global-status)? | +--rw (global-status)? | |||
| +--:(global-errors) | | +--:(global-errors) | |||
| | +--ro errors | | | +--ro errors | |||
| | | | | | |||
| +--:(ok) | | +--:(ok) | |||
| +--rw ok? empty | | +--rw ok? empty | |||
+--rw edit-status | +--rw edit-status | |||
+--rw edit [edit-id] | +--rw edit [edit-id] | |||
+--rw edit-id string | +--rw edit-id string | |||
+--rw (edit-status-choice)? | +--rw (edit-status-choice)? | |||
+--:(ok) | +--:(ok) | |||
| +--rw ok? empty | | +--rw ok? empty | |||
+--:(errors) | +--:(errors) | |||
+--ro errors | +--ro errors | |||
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 an | datastore resource, then the path string in the "target" leaf is an | |||
absolute path expression. The first node specified in the "target" | absolute path expression. The first node specified in the "target" | |||
leaf is a top-level data node defined within a YANG module. | leaf is a top-level data node defined within a YANG module. | |||
If the target resource specified in the request URI identifies a data | If the target resource specified in the request URI identifies a data | |||
skipping to change at page 8, line 5 | skipping to change at page 8, line 24 | |||
resource, then the path string in the "target" leaf is a relative | resource, then the path string in the "target" leaf is a relative | |||
path expression. The first node specified in the "target" leaf is a | path expression. The first node specified in the "target" leaf is a | |||
child node of the data node associated with the target resource. | child node of the data node associated with the target resource. | |||
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 error | | | delete | delete a data resource if it already exists or | | |||
| insert | insert a new user-ordered data resource | | | | error | | |||
| merge | merge the edit value with the target data resource; | | | insert | insert a new user-ordered data resource | | |||
| | create if it does not already exist | | | merge | merge the edit value with the target data | | |||
| move | re-order the target data resource | | | | resource; create if it does not already exist | | |||
| replace | replace the target data resource with the edit value | | | move | re-order the target data resource | | |||
| remove | remove a data resource if it already exists or no | | | replace | replace the target data resource with the edit | | |||
| | error | | | | value | | |||
+-----------+-------------------------------------------------------+ | | remove | remove a data resource if it already exists or no | | |||
| | error | | ||||
+---------------+---------------------------------------------------+ | ||||
YANG Patch Edit Operations | YANG Patch Edit Operations | |||
2.6. Error Handling | 2.6. 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 server will process the supplied edits in ascending order. The | |||
following error modes apply to the processing of this edit list: | following error modes apply to the processing of this edit list: | |||
All the specified edits MUST be applied or the target datastore | All the specified edits MUST be applied or the target datastore | |||
skipping to change at page 9, line 18 | skipping to change at page 9, line 39 | |||
<CODE BEGINS> file "ietf-yang-patch@2015-04-30.yang" | <CODE BEGINS> file "ietf-yang-patch@2015-04-30.yang" | |||
module ietf-yang-patch { | module 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"; | |||
import ietf-yang-types { prefix yang; } | import ietf-yang-types { prefix yang; } | |||
import ietf-restconf { | import ietf-restconf { | |||
prefix rc; | prefix rc; | |||
revision-date 2015-06-04; | revision-date 2015-10-07; | |||
} | } | |||
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> | |||
WG Chair: Mehmet Ersue | WG Chair: Mehmet Ersue | |||
skipping to change at page 10, line 20 | skipping to change at page 10, line 41 | |||
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-04.txt | // Note: extracted from draft-ietf-netconf-yang-patch-06.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 2015-06-04 { | revision 2015-06-04 { | |||
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 yang:xpath1.0; | type yang:xpath1.0; | |||
description | description | |||
"Contains an XPath absolute path expression identifying | "Contains an XPath absolute path expression identifying | |||
a sub-resource within the target resource. | a sub-resource within the target resource. | |||
The document root for this XPath expression is the | The document root for this XPath expression is the | |||
target resource that is specified in the | target resource that is specified in the | |||
protocol operation (e.g., the URI for the PATCH request)."; | protocol operation (e.g., the URI for the PATCH request)."; | |||
} | } | |||
skipping to change at page 15, line 4 | skipping to change at page 15, line 24 | |||
} | } | |||
anyxml value { | anyxml value { | |||
when "(../operation = 'create' or " + | when "(../operation = 'create' or " + | |||
"../operation = 'merge' " + | "../operation = 'merge' " + | |||
"or ../operation = 'replace' or " + | "or ../operation = 'replace' or " + | |||
"../operation = 'insert')" { | "../operation = 'insert')" { | |||
description | description | |||
"Value node only used for create, merge, | "Value node only used for create, merge, | |||
replace, and insert operations"; | replace, and insert operations"; | |||
} | } | |||
description | description | |||
"Value used for this edit operation. | "Value used for this edit operation. | |||
The anyxml value MUST represent a container with | The anyxml value MUST represent a container with | |||
exactly one child node, which MUST identify the | exactly one child node, which MUST identify the | |||
target resource associated with the 'target' leaf. | target resource associated with the 'target' leaf. | |||
The descendants of this node MUST NOT contain | ||||
an 'anyxml' data node. Only 'list', 'container', | ||||
'leaf', and 'leaf-list' data nodes can appear as | ||||
descendant nodes of this object. | ||||
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 will contain one instance of foo: | The value node will contain one instance of foo: | |||
skipping to change at page 17, line 39 | skipping to change at page 18, line 17 | |||
<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 in the IETF XML registry [RFC3688]. | This document registers one URI in the IETF XML registry [RFC3688]. | |||
Following the format in RFC 3688, the following registration is | Following the format in RFC 3688, the following registration is | |||
requested to be made. | 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 NETMOD WG of the IETF. | Registrant Contact: The NETMOD 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. application/yang.patch Media Types | 4.2. application/yang.patch Media Types | |||
The MIME media type for a YANG Patch document is application/ | The MIME media type for a YANG Patch document is application/ | |||
yang.patch. | yang.patch. | |||
Type name: application | Type name: application | |||
Subtype name: yang.patch | Subtype name: yang.patch | |||
skipping to change at page 19, line 39 | skipping to change at page 20, line 14 | |||
A server implementation SHOULD attempt to prevent system disruption | A server implementation SHOULD attempt to prevent system disruption | |||
due to partial processing of the YANG Patch edit list. It may be | due to partial processing of the YANG Patch edit list. It may be | |||
possible to construct an attack on such a server, which relies on the | possible to construct an attack on such a server, which relies on the | |||
edit processing order mandated by YANG Patch. | edit processing order mandated by YANG Patch. | |||
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-07 (work in | Protocol", draft-ietf-netconf-restconf-08 (work in | |||
progress), July 2015. | progress), October 2015. | |||
[I-D.ietf-netmod-yang-json] | ||||
Lhotka, L., "JSON Encoding of Data Modeled with YANG", | ||||
draft-ietf-netmod-yang-json-06 (work in progress), October | ||||
2015. | ||||
[I-D.ietf-netmod-yang-metadata] | ||||
Lhotka, L., "Defining and Using Metadata with YANG", | ||||
draft-ietf-netmod-yang-metadata-02 (work in progress), | ||||
September 2015. | ||||
[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. | |||
[RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., | [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., | |||
Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext | Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext | |||
Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. | Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. | |||
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, | [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, | |||
January 2004. | January 2004. | |||
skipping to change at page 20, line 31 | skipping to change at page 21, line 15 | |||
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 | |||
contributions to this document: Rex Fernando. | 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 | 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. 04 to 05 | B.1. 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.2. v04 to v05 | ||||
o updated reference to RESTCONF | o updated reference to RESTCONF | |||
B.2. 03 to 04 | B.3. 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.3. 02 to 03 | B.4. 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.4. 01 to 02 | B.5. 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.5. 00 to 01 | B.6. v00 to v01 | |||
o Added text requiring support for Accept-Patch header, and removed | o Added text requiring support for Accept-Patch header, and removed | |||
'Identification of YANG Patch capabilities' open issue. | '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 22, line 23 | skipping to change at page 23, line 28 | |||
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.6. bierman:yang-patch-00 to ietf:yang-patch-00 | B.7. 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 [RFC7158], and some are shown in XML encoding | JSON encoding [RFC7158], 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. | were not attempted, since the first edit failed. The XML encoding is | |||
used in this example. | ||||
Request from client: | Request from 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.patch-status+json | Accept: application/yang.patch-status+xml | |||
Content-Type: application/yang.patch+json | Content-Type: application/yang.patch+xml | |||
{ | <yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch"> | |||
"ietf-yang-patch:yang-patch" : { | <patch-id>add-songs-patch</patch-id> | |||
"patch-id" : "add-songs-patch", | <edit> | |||
"edit" : [ | <edit-id>edit1</edit-id> | |||
{ | <operation>create</operation> | |||
"edit-id" : "edit1", | <target>/song</target> | |||
"operation" : "create", | <value> | |||
"target" : "/song", | <song xmlns="http://example.com/ns/example-jukebox"> | |||
"value" : { | <name>Bridge Burning</name> | |||
"song" : { | <location>/media/bridge_burning.mp3</location> | |||
"name" : "Bridge Burning", | <format>MP3</format> | |||
"location" : "/media/bridge_burning.mp3", | <length>288</length> | |||
"format" : "MP3", | </song> | |||
"length" : 288 | </value> | |||
} | </edit> | |||
} | <edit> | |||
}, | <edit-id>edit2</edit-id> | |||
{ | <operation>create</operation> | |||
"edit-id" : "edit2", | <target>/song</target> | |||
"operation" : "create", | <value> | |||
"target" : "/song", | <song xmlns="http://example.com/ns/example-jukebox"> | |||
"value" : { | <name>Rope</name> | |||
"song" : { | <location>/media/rope.mp3</location> | |||
"name" : "Rope", | <format>MP3</format> | |||
"location" : "/media/rope.mp3", | <length>259</length> | |||
"format" : "MP3", | </song> | |||
"length" : 259 | </value> | |||
} | </edit> | |||
} | <edit> | |||
}, | <edit-id>edit3</edit-id> | |||
{ | <operation>create</operation> | |||
"edit-id" : "edit3", | <target>/song</target> | |||
"operation" : "create", | <value> | |||
"target" : "/song", | <song xmlns="http://example.com/ns/example-jukebox"> | |||
"value" : { | <name>Dear Rosemary</name> | |||
"song" : { | <location>/media/dear_rosemary.mp3</location> | |||
"name" : "Dear Rosemary", | <format>MP3</format> | |||
"location" : "/media/dear_rosemary.mp3", | <length>269</length> | |||
"format" : "MP3", | </song> | |||
"length" : 269 | </value> | |||
</edit> | ||||
</yang-patch> | ||||
XML Response from server: | ||||
} | HTTP/1.1 409 Conflict | |||
} | 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.patch-status+xml | |||
} | ||||
Response from server: | <yang-patch-status | |||
xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch"> | ||||
<patch-id>add-songs-patch</patch-id> | ||||
<edit-status> | ||||
<edit> | ||||
<edit-id>edit1</edit-id> | ||||
<errors> | ||||
<error> | ||||
<error-type>application</error-type> | ||||
<error-tag>data-exists</error-tag> | ||||
<error-path | ||||
xmlns:jb="http://example.com/ns/example-jukebox"> | ||||
/jb:jukebox/jb:library | ||||
/jb:artist[jb:name='Foo Fighters'] | ||||
/jb:album[jb:name='Wasting Light'] | ||||
/jb:song[jb:name='Burning Light'] | ||||
</error-path> | ||||
<error-message> | ||||
Data already exists, cannot be created | ||||
</error-message> | ||||
</error> | ||||
</errors> | ||||
</edit> | ||||
</edit-status> | ||||
</yang-patch-status> | ||||
JSON Response from server: | ||||
The following response is shown in JSON format to highlight the | ||||
difference in the "error-path" object encoding. For JSON, the | ||||
instance-identifier encoding in the "JSON Encoding of YANG | ||||
Data" draft is used. The "error-path" string is wrapped for | ||||
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.patch-status+json | Content-Type: application/yang.patch-status+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" : [ | |||
{ | { | |||
skipping to change at page 25, line 33 | skipping to change at page 27, line 17 | |||
"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=Foo%20Fighters/album=Wasting%20Light | /artist[name='Foo Fighters'] | |||
/song=Burning%20Light", | /album[name='Wasting Light'] | |||
/song[name='Burning Light']", | ||||
"error-message": | "error-message": | |||
"Data already exists, cannot be created" | "Data already exists, cannot be created" | |||
} | } | |||
] | ] | |||
} | } | |||
} | } | |||
] | ] | |||
} | } | |||
} | } | |||
} | } | |||
End of changes. 48 change blocks. | ||||
180 lines changed or deleted | 259 lines changed or added | |||
This html diff was produced by rfcdiff 1.42. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |