draft-ietf-netconf-restconf-09.txt   draft-ietf-netconf-restconf-10.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: June 17, 2016 Tail-f Systems Expires: September 17, 2016 Tail-f Systems
K. Watsen K. Watsen
Juniper Networks Juniper Networks
December 15, 2015 March 16, 2016
RESTCONF Protocol RESTCONF Protocol
draft-ietf-netconf-restconf-09 draft-ietf-netconf-restconf-10
Abstract Abstract
This document describes an HTTP-based protocol that provides a This document describes an HTTP-based protocol that provides a
programmatic interface for accessing data defined in YANG, using the programmatic interface for accessing data defined in YANG, using the
datastores defined in NETCONF. datastores defined in NETCONF.
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 June 17, 2016. This Internet-Draft will expire on September 17, 2016.
Copyright Notice Copyright Notice
Copyright (c) 2015 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
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 . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1. Simple Subset of NETCONF Functionality . . . . . . . . . 5 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 5
1.2. Data Model Driven API . . . . . . . . . . . . . . . . . . 6 1.1.1. NETCONF . . . . . . . . . . . . . . . . . . . . . . . 6
1.3. Coexistence with NETCONF . . . . . . . . . . . . . . . . 7 1.1.2. HTTP . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4. Terminology . . . . . . . . . . . . . . . . . . . . . . . 8 1.1.3. YANG . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4.1. NETCONF . . . . . . . . . . . . . . . . . . . . . . . 8 1.1.4. Terms . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4.2. HTTP . . . . . . . . . . . . . . . . . . . . . . . . 8 1.1.5. URI Template . . . . . . . . . . . . . . . . . . . . 9
1.4.3. YANG . . . . . . . . . . . . . . . . . . . . . . . . 9 1.1.6. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 9
1.4.4. Terms . . . . . . . . . . . . . . . . . . . . . . . . 10 1.2. Subset of NETCONF Functionality . . . . . . . . . . . . . 9
1.4.5. URI Template . . . . . . . . . . . . . . . . . . . . 11 1.3. Data Model Driven API . . . . . . . . . . . . . . . . . . 10
1.4.6. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 11 1.4. Coexistence with NETCONF . . . . . . . . . . . . . . . . 11
2. Transport Protocol Requirements . . . . . . . . . . . . . . . 12 1.5. RESTCONF Extensibility . . . . . . . . . . . . . . . . . 12
2.1. Integrity and Confidentiality . . . . . . . . . . . . . . 12 2. Transport Protocol Requirements . . . . . . . . . . . . . . . 13
2.2. HTTPS with X.509v3 Certificates . . . . . . . . . . . . . 12 2.1. Integrity and Confidentiality . . . . . . . . . . . . . . 13
2.3. Certificate Validation . . . . . . . . . . . . . . . . . 12 2.2. HTTPS with X.509v3 Certificates . . . . . . . . . . . . . 13
2.4. Authenticated Server Identity . . . . . . . . . . . . . . 13 2.3. Certificate Validation . . . . . . . . . . . . . . . . . 13
2.5. Authenticated Client Identity . . . . . . . . . . . . . . 13 2.4. Authenticated Server Identity . . . . . . . . . . . . . . 14
3. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.5. Authenticated Client Identity . . . . . . . . . . . . . . 14
3.1. Root Resource Discovery . . . . . . . . . . . . . . . . . 14 3. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2. RESTCONF Resource Types . . . . . . . . . . . . . . . . . 15 3.1. Root Resource Discovery . . . . . . . . . . . . . . . . . 15
3.3. API Resource . . . . . . . . . . . . . . . . . . . . . . 15 3.2. RESTCONF Media Types . . . . . . . . . . . . . . . . . . 17
3.3.1. {+restconf}/data . . . . . . . . . . . . . . . . . . 16 3.3. API Resource . . . . . . . . . . . . . . . . . . . . . . 17
3.3.2. {+restconf}/operations . . . . . . . . . . . . . . . 17 3.3.1. {+restconf}/data . . . . . . . . . . . . . . . . . . 18
3.4. Datastore Resource . . . . . . . . . . . . . . . . . . . 17 3.3.2. {+restconf}/operations . . . . . . . . . . . . . . . 18
3.4.1. Edit Collision Detection . . . . . . . . . . . . . . 17 3.3.3. {+restconf}/yang-library-version . . . . . . . . . . 19
3.5. Data Resource . . . . . . . . . . . . . . . . . . . . . . 18 3.4. Datastore Resource . . . . . . . . . . . . . . . . . . . 19
3.5.1. Encoding Data Resource Identifiers in the Request URI 19 3.4.1. Edit Collision Detection . . . . . . . . . . . . . . 20
3.5.2. Defaults Handling . . . . . . . . . . . . . . . . . . 22 3.5. Data Resource . . . . . . . . . . . . . . . . . . . . . . 21
3.6. Operation Resource . . . . . . . . . . . . . . . . . . . 22 3.5.1. Encoding Data Resource Identifiers in the Request URI 22
3.6.1. Encoding Operation Input Parameters . . . . . . . . . 23 3.5.2. Defaults Handling . . . . . . . . . . . . . . . . . . 25
3.6.2. Encoding Operation Output Parameters . . . . . . . . 24 3.6. Operation Resource . . . . . . . . . . . . . . . . . . . 25
3.6.3. Encoding Operation Errors . . . . . . . . . . . . . . 25 3.6.1. Encoding Operation Resource Input Parameters . . . . 26
3.7. Schema Resource . . . . . . . . . . . . . . . . . . . . . 26 3.6.2. Encoding Operation Resource Output Parameters . . . . 29
3.8. Event Stream Resource . . . . . . . . . . . . . . . . . . 27 3.6.3. Encoding Operation Resource Errors . . . . . . . . . 31
3.9. Errors Media Type . . . . . . . . . . . . . . . . . . . . 27 3.7. Schema Resource . . . . . . . . . . . . . . . . . . . . . 32
4. Operations . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.8. Event Stream Resource . . . . . . . . . . . . . . . . . . 33
4.1. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.9. Errors Media Type . . . . . . . . . . . . . . . . . . . . 33
4.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4. Operations . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.3. GET . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.1. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.4. POST . . . . . . . . . . . . . . . . . . . . . . . . . . 30 4.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.4.1. Create Resource Mode . . . . . . . . . . . . . . . . 30 4.3. GET . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.4.2. Invoke Operation Mode . . . . . . . . . . . . . . . . 31 4.4. POST . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.5. PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.4.1. Create Resource Mode . . . . . . . . . . . . . . . . 37
4.6. PATCH . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.4.2. Invoke Operation Mode . . . . . . . . . . . . . . . . 38
4.6.1. Plain Patch . . . . . . . . . . . . . . . . . . . . . 33 4.5. PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.7. DELETE . . . . . . . . . . . . . . . . . . . . . . . . . 34 4.6. PATCH . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.8. Query Parameters . . . . . . . . . . . . . . . . . . . . 35 4.6.1. Plain Patch . . . . . . . . . . . . . . . . . . . . . 41
4.8.1. The "content" Query Parameter . . . . . . . . . . . . 36 4.7. DELETE . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.8.2. The "depth" Query Parameter . . . . . . . . . . . . . 36 4.8. Query Parameters . . . . . . . . . . . . . . . . . . . . 43
4.8.3. The "fields" Query Parameter . . . . . . . . . . . . 37 4.8.1. The "content" Query Parameter . . . . . . . . . . . . 44
4.8.4. The "insert" Query Parameter . . . . . . . . . . . . 38 4.8.2. The "depth" Query Parameter . . . . . . . . . . . . . 45
4.8.5. The "point" Query Parameter . . . . . . . . . . . . . 39 4.8.3. The "fields" Query Parameter . . . . . . . . . . . . 45
4.8.6. The "filter" Query Parameter . . . . . . . . . . . . 39 4.8.4. The "insert" Query Parameter . . . . . . . . . . . . 46
4.8.7. The "start‑time" Query Parameter . . . . . . . 40 4.8.5. The "point" Query Parameter . . . . . . . . . . . . . 47
4.8.8. The "stop‑time" Query Parameter . . . . . . . . 40 4.8.6. The "filter" Query Parameter . . . . . . . . . . . . 47
4.8.9. The "with‑defaults" Query Parameter . . . . . . 41 4.8.7. The "start-time" Query Parameter . . . . . . . . . . 48
5. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.8.8. The "stop-time" Query Parameter . . . . . . . . . . . 49
5.1. Request URI Structure . . . . . . . . . . . . . . . . . . 42 4.8.9. The "with-defaults" Query Parameter . . . . . . . . . 50
5.2. Message Headers . . . . . . . . . . . . . . . . . . . . . 43 5. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.3. Message Encoding . . . . . . . . . . . . . . . . . . . . 45 5.1. Request URI Structure . . . . . . . . . . . . . . . . . . 51
5.4. RESTCONF Meta-Data . . . . . . . . . . . . . . . . . . . 45 5.2. Message Encoding . . . . . . . . . . . . . . . . . . . . 52
5.4.1. XML MetaData Encoding Example . . . . . . . . . . . . 45 5.3. RESTCONF Meta-Data . . . . . . . . . . . . . . . . . . . 53
5.4.2. JSON MetaData Encoding Example . . . . . . . . . . . 46 5.3.1. XML MetaData Encoding Example . . . . . . . . . . . . 53
5.5. Return Status . . . . . . . . . . . . . . . . . . . . . . 47 5.3.2. JSON MetaData Encoding Example . . . . . . . . . . . 54
5.6. Message Caching . . . . . . . . . . . . . . . . . . . . . 47 5.4. Return Status . . . . . . . . . . . . . . . . . . . . . . 54
6. Notifications . . . . . . . . . . . . . . . . . . . . . . . . 47 5.5. Message Caching . . . . . . . . . . . . . . . . . . . . . 54
6.1. Server Support . . . . . . . . . . . . . . . . . . . . . 47 6. Notifications . . . . . . . . . . . . . . . . . . . . . . . . 55
6.2. Event Streams . . . . . . . . . . . . . . . . . . . . . . 48 6.1. Server Support . . . . . . . . . . . . . . . . . . . . . 55
6.3. Subscribing to Receive Notifications . . . . . . . . . . 49 6.2. Event Streams . . . . . . . . . . . . . . . . . . . . . . 55
6.3.1. NETCONF Event Stream . . . . . . . . . . . . . . . . 50 6.3. Subscribing to Receive Notifications . . . . . . . . . . 58
6.4. Receiving Event Notifications . . . . . . . . . . . . . . 51 6.3.1. NETCONF Event Stream . . . . . . . . . . . . . . . . 59
7. Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 53 6.4. Receiving Event Notifications . . . . . . . . . . . . . . 59
7.1. Error Response Message . . . . . . . . . . . . . . . . . 54 7. Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 61
8. RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 56 7.1. Error Response Message . . . . . . . . . . . . . . . . . 63
9. RESTCONF Monitoring . . . . . . . . . . . . . . . . . . . . . 62 8. RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 65
9.1. restconf-state/capabilities . . . . . . . . . . . . . . . 62 9. RESTCONF Monitoring . . . . . . . . . . . . . . . . . . . . . 71
9.1.1. Query Parameter URIs . . . . . . . . . . . . . . . . 63 9.1. restconf-state/capabilities . . . . . . . . . . . . . . . 71
9.1.2. The "defaults" Protocol Capability URI . . . . . . . 64 9.1.1. Query Parameter URIs . . . . . . . . . . . . . . . . 72
9.2. restconf-state/streams . . . . . . . . . . . . . . . . . 64 9.1.2. The "defaults" Protocol Capability URI . . . . . . . 72
9.3. RESTCONF Monitoring Module . . . . . . . . . . . . . . . 65 9.2. restconf-state/streams . . . . . . . . . . . . . . . . . 73
10. YANG Module Library . . . . . . . . . . . . . . . . . . . . . 68 9.3. RESTCONF Monitoring Module . . . . . . . . . . . . . . . 74
10.1. modules . . . . . . . . . . . . . . . . . . . . . . . . 69 10. YANG Module Library . . . . . . . . . . . . . . . . . . . . . 77
10.1.1. modules/module . . . . . . . . . . . . . . . . . . . 69 10.1. modules . . . . . . . . . . . . . . . . . . . . . . . . 77
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 69 10.1.1. modules/module . . . . . . . . . . . . . . . . . . . 78
11.1. The "restconf" Relation Type . . . . . . . . . . . . . . 69
11.2. YANG Module Registry . . . . . . . . . . . . . . . . . . 70
11.3. application/yang Media Sub Types . . . . . . . . . . . . 70
11.4. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 71
12. Security Considerations . . . . . . . . . . . . . . . . . . . 72
13. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 73
14. References . . . . . . . . . . . . . . . . . . . . . . . . . 73
14.1. Normative References . . . . . . . . . . . . . . . . . . 73
14.2. Informative References . . . . . . . . . . . . . . . . . 76
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 76
A.1. v08 - v09 . . . . . . . . . . . . . . . . . . . . . . . . 76
A.2. v07 - v08 . . . . . . . . . . . . . . . . . . . . . . . . 76
A.3. v06 - v07 . . . . . . . . . . . . . . . . . . . . . . . . 77
A.4. v05 - v06 . . . . . . . . . . . . . . . . . . . . . . . . 77
A.5. v04 - v05 . . . . . . . . . . . . . . . . . . . . . . . . 77
A.6. v03 - v04 . . . . . . . . . . . . . . . . . . . . . . . . 78
A.7. v02 - v03 . . . . . . . . . . . . . . . . . . . . . . . . 79
A.8. v01 - v02 . . . . . . . . . . . . . . . . . . . . . . . . 79
A.9. v00 - v01 . . . . . . . . . . . . . . . . . . . . . . . . 80
A.10. bierman:restconf-04 to ietf:restconf-00 . . . . . . . . . 81
Appendix B. Open Issues . . . . . . . . . . . . . . . . . . . . 81
Appendix C. Example YANG Module . . . . . . . . . . . . . . . . 81
C.1. example-jukebox YANG Module . . . . . . . . . . . . . . . 82
Appendix D. RESTCONF Message Examples . . . . . . . . . . . . . 87
D.1. Resource Retrieval Examples . . . . . . . . . . . . . . . 87
D.1.1. Retrieve the Top-level API Resource . . . . . . . . . 87
D.1.2. Retrieve The Server Module Information . . . . . . . 88
D.1.3. Retrieve The Server Capability Information . . . . . 90
D.2. Edit Resource Examples . . . . . . . . . . . . . . . . . 90
D.2.1. Create New Data Resources . . . . . . . . . . . . . . 91
D.2.2. Detect Resource Entity Tag Change . . . . . . . . . . 92
D.2.3. Edit a Datastore Resource . . . . . . . . . . . . . . 92
D.3. Query Parameter Examples . . . . . . . . . . . . . . . . 93
D.3.1. "content" Parameter . . . . . . . . . . . . . . . . . 93
D.3.2. "depth" Parameter . . . . . . . . . . . . . . . . . . 96
D.3.3. "fields" Parameter . . . . . . . . . . . . . . . . . 99
D.3.4. "insert" Parameter . . . . . . . . . . . . . . . . . 100
D.3.5. "point" Parameter . . . . . . . . . . . . . . . . . . 100
D.3.6. "filter" Parameter . . . . . . . . . . . . . . . . . 101
D.3.7. "start‑time" Parameter . . . . . . . . . . . . 102
D.3.8. "stop‑time" Parameter . . . . . . . . . . . . . 102
D.3.9. "with‑defaults" Parameter . . . . . . . . . . . 102
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 104
1. Introduction 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 78
11.1. The "restconf" Relation Type . . . . . . . . . . . . . . 78
11.2. YANG Module Registry . . . . . . . . . . . . . . . . . . 78
11.3. application/yang Media Sub Types . . . . . . . . . . . . 79
11.4. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 80
12. Security Considerations . . . . . . . . . . . . . . . . . . . 81
13. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 82
14. References . . . . . . . . . . . . . . . . . . . . . . . . . 82
14.1. Normative References . . . . . . . . . . . . . . . . . . 82
14.2. Informative References . . . . . . . . . . . . . . . . . 85
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 85
A.1. v09 - v10 . . . . . . . . . . . . . . . . . . . . . . . . 85
A.2. v08 - v09 . . . . . . . . . . . . . . . . . . . . . . . . 87
A.3. v07 - v08 . . . . . . . . . . . . . . . . . . . . . . . . 88
A.4. v06 - v07 . . . . . . . . . . . . . . . . . . . . . . . . 88
A.5. v05 - v06 . . . . . . . . . . . . . . . . . . . . . . . . 88
A.6. v04 - v05 . . . . . . . . . . . . . . . . . . . . . . . . 88
A.7. v03 - v04 . . . . . . . . . . . . . . . . . . . . . . . . 89
A.8. v02 - v03 . . . . . . . . . . . . . . . . . . . . . . . . 90
A.9. v01 - v02 . . . . . . . . . . . . . . . . . . . . . . . . 90
A.10. v00 - v01 . . . . . . . . . . . . . . . . . . . . . . . . 91
A.11. bierman:restconf-04 to ietf:restconf-00 . . . . . . . . . 92
Appendix B. Open Issues . . . . . . . . . . . . . . . . . . . . 92
Appendix C. Example YANG Module . . . . . . . . . . . . . . . . 92
C.1. example-jukebox YANG Module . . . . . . . . . . . . . . . 93
Appendix D. RESTCONF Message Examples . . . . . . . . . . . . . 98
D.1. Resource Retrieval Examples . . . . . . . . . . . . . . . 99
D.1.1. Retrieve the Top-level API Resource . . . . . . . . . 99
D.1.2. Retrieve The Server Module Information . . . . . . . 100
D.1.3. Retrieve The Server Capability Information . . . . . 101
D.2. Edit Resource Examples . . . . . . . . . . . . . . . . . 102
D.2.1. Create New Data Resources . . . . . . . . . . . . . . 102
D.2.2. Detect Resource Entity Tag Change . . . . . . . . . . 103
D.2.3. Edit a Datastore Resource . . . . . . . . . . . . . . 104
D.3. Query Parameter Examples . . . . . . . . . . . . . . . . 104
D.3.1. "content" Parameter . . . . . . . . . . . . . . . . . 104
D.3.2. "depth" Parameter . . . . . . . . . . . . . . . . . . 107
D.3.3. "fields" Parameter . . . . . . . . . . . . . . . . . 110
D.3.4. "insert" Parameter . . . . . . . . . . . . . . . . . 111
D.3.5. "point" Parameter . . . . . . . . . . . . . . . . . . 112
D.3.6. "filter" Parameter . . . . . . . . . . . . . . . . . 113
D.3.7. "start-time" Parameter . . . . . . . . . . . . . . . 113
D.3.8. "stop-time" Parameter . . . . . . . . . . . . . . . . 113
D.3.9. "with-defaults" Parameter . . . . . . . . . . . . . . 114
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 115
1. Introduction
There is a need for standard mechanisms to allow Web applications to There is a need for standard mechanisms to allow Web applications to
access the configuration data, operational data, data-model specific access the configuration data, operational data, data-model specific
protocol operations, and event notifications within a networking protocol operations, and event notifications within a networking
device, in a modular and extensible manner. device, in a modular and extensible manner.
This document describes an HTTP [RFC7230] based protocol called This document defines an HTTP [RFC7230] based protocol called
RESTCONF, for accessing data defined in YANG version 1 [RFC6020] or RESTCONF, for configuring data defined in YANG version 1 [RFC6020] or
YANG version 1.1 [I-D.ietf-netmod-rfc6020bis], using datastores YANG version 1.1 [I-D.ietf-netmod-rfc6020bis], using datastores
defined in NETCONF [RFC6241]. defined in NETCONF [RFC6241].
The NETCONF protocol defines configuration datastores and a set of NETCONF defines configuration datastores and a set of Create,
Create, Retrieve, Update, Delete (CRUD) operations that can be used Retrieve, Update, Delete (CRUD) operations that can be used to access
to access these datastores. The YANG language defines the syntax and these datastores. The YANG language defines the syntax and semantics
semantics of datastore content, operational data, protocol of datastore content, operational data, protocol operations, and
operations, and event notifications. RESTCONF uses HTTP operations event notifications.
to provide CRUD operations on a NETCONF datastore containing YANG-
defined data. Since NETCONF protocol operations are not relevant, RESTCONF uses HTTP operations to provide CRUD operations on a
the user should not need any prior knowledge of NETCONF in order to conceptual datastore containing YANG-defined data, which is
use RESTCONF. compatible with a server which implements NETCONF datastores.
If a RESTCONF server is co-located with a NETCONF server, then there
are protocol interactions to be considered, as described in
Section 1.4. The server MAY provide access to specific datastores
using operation resources, as described in Section 3.6.
Configuration data and state data are exposed as resources that can Configuration data and state data are exposed as resources that can
be retrieved with the GET method. Resources representing be retrieved with the GET method. Resources representing
configuration data can be modified with the DELETE, PATCH, POST, and configuration data can be modified with the DELETE, PATCH, POST, and
PUT methods. Data is encoded with either XML [W3C.REC-xml-20081126] PUT methods. Data is encoded with either XML [W3C.REC-xml-20081126]
or JSON [RFC7158]. or JSON [RFC7159].
Data-model specific operations defined with the YANG "rpc" or Data-model specific operations defined with the YANG "rpc" or
"action" statements can be invoked with the POST method. Data-model "action" statements can be invoked with the POST method. Data-model
specific event notifications defined with the YANG "notification" specific event notifications defined with the YANG "notification"
statement can be accessed. statement can be accessed.
1.1. Simple Subset of NETCONF Functionality 1.1. Terminology
An HTTP-based management protocol does not need to mirror the
functionality of the NETCONF protocol, but it needs to be compatible
with NETCONF. A simplified transaction model is needed that allows
basic CRUD operations on a hierarchy of conceptual resources. This
represents a limited subset of the transaction capabilities of the
NETCONF protocol.
The HTTP POST, PUT, PATCH, and DELETE methods are used to edit data
resources represented by YANG data models. These basic edit
operations allow the running configuration to be altered in an all-
or-none fashion. This is similar to the "rollback-on-error"
capability in NETCONF. Edits are usually applied to one data
resource instance at a time.
The base RESTCONF protocol is intentionally simple to allow
deployment for as many use cases as possible. Additional
functionality can be defined in external documents, outside the scope
of this document.
RESTCONF is not intended to replace NETCONF, but rather provide an
additional simplified interface that follows REST principles and is
compatible with a resource-oriented device abstraction.
The following figure shows the system components:
+-----------+ +-----------------+
| Web app | <-------> | |
+-----------+ HTTP | network device |
| |
+-----------+ | +-----------+ |
| NMS app | <-------> | | datastore | |
+-----------+ NETCONF | +-----------+ |
+-----------------+
1.2. Data Model Driven API
RESTCONF combines the simplicity of the HTTP protocol with the
predictability and automation potential of a schema-driven API.
Using YANG, a client can predict all resource endpoints, much like
using URI Templates [RFC6570], but in a more holistic manner. This
strategy obviates the need for responses provided by the server to
contain HATEOAS links, originally described in Roy Fielding's
doctoral dissertation [rest-dissertation].
In contrast, a REST client using HATEOAS principles would not use any
data modeling language to define the application-specific content of
the API. The client would need to discover each new child resource
as it traverses the URIs to discover the server capabilities. This
approach has the following significant weaknesses with regards to
control of complex networking devices:
o inefficient performance: configuration APIs will be quite complex
and may require thousands of protocol messages to discover all the
schema information. Typically the data type information has to be
passed in the protocol messages, which is also wasteful overhead.
o no data model richness: without a data model, the schema-level
semantics and validation constraints are not available to the
application.
o no tool automation: API automation tools need some sort of content
schema to function. Such tools can automate various programming
and documentation tasks related to specific data models.
Data models such as YANG modules serve as an "API contract" that will
be honored by the server. An application designer can code to the
data model, knowing in advance important details about the exact
protocol operations and datastore content a conforming server
implementation will support.
RESTCONF provides the YANG module capability information supported by
the server, in case the client wants to use it. The URIs for custom
protocol operations and datastore content are predictable, based on
the YANG module definitions.
Operational experience with CLI and SNMP indicates that operators
learn the location of specific service or device related data and do
not expect such information to be arbitrary and discovered each time
the client opens a management session to a server.
The RESTCONF protocol operates on a conceptual datastore defined with
the YANG data modeling language. The server lists each YANG module
it supports using the "ietf-yang-library" YANG module, defined in
[I-D.ietf-netconf-yang-library]. The server MUST implement the
"ietf-yang-library" module, which MUST identify all the YANG modules
used by the server.
The conceptual datastore contents, data-model-specific operations and
event notifications are identified by this set of YANG modules. All
RESTCONF content identified as either a data resource, operation
resource, or event stream resource is defined with the YANG language.
The classification of data as configuration or non-configuration is
derived from the YANG "config" statement. Data ordering behavior is
derived from the YANG "ordered-by" statement.
The RESTCONF datastore editing model is simple and direct, similar to
the behavior of the :writable-running capability in NETCONF. Each
RESTCONF edit of a datastore resource is activated upon successful
completion of the transaction.
1.3. Coexistence with NETCONF
RESTCONF can be implemented on a device that supports NETCONF.
If the device supports :writable-running, all edits to configuration
nodes in {+restconf}/data are performed in the running configuration
datastore.
Otherwise, if the device supports :candidate, all edits to
configuration nodes in {+restconf}/data are performed in the
candidate configuration datastore. The candidate is automatically
committed to running after a successful edit.
If the device supports :startup, the device automatically copies the
content of running to startup after running has been updated as a
consequence of a RESTCONF edit operation.
If a datastore that would be modified by a RESTCONF operation has an
active lock, the RESTCONF edit operation MUST fail with a 409
(Conflict) error code.
1.4. Terminology
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.4.1. NETCONF 1.1.1. NETCONF
The following terms are defined in [RFC6241]: The following terms are defined in [RFC6241]:
o candidate configuration datastore o candidate configuration datastore
o client o client
o configuration data o configuration data
o datastore o datastore
skipping to change at page 8, line 51 skipping to change at page 6, line 31
o running configuration datastore o running configuration datastore
o server o server
o startup configuration datastore o startup configuration datastore
o state data o state data
o user o user
1.4.2. HTTP 1.1.2. HTTP
The following terms are defined in [RFC3986]: The following terms are defined in [RFC3986]:
o fragment o fragment
o path o path
o query o query
The following terms are defined in [RFC7230]: The following terms are defined in [RFC7230]:
skipping to change at page 9, line 36 skipping to change at page 7, line 16
o method o method
o request o request
o resource o resource
The following terms are defined in [RFC7232]: The following terms are defined in [RFC7232]:
o entity tag o entity tag
1.4.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 action o action
o container o container
o data node o data node
o key leaf o key leaf
skipping to change at page 10, line 14 skipping to change at page 7, line 42
o list o list
o non-presence container (or NP-container) o non-presence container (or NP-container)
o ordered-by system o ordered-by system
o ordered-by user o ordered-by user
o presence container (or P-container) o presence container (or P-container)
o RPC operation (now called protocol operation) o RPC operation
1.4.4. Terms o top-level data node
1.1.4. Terms
The following terms are used within this document: The following terms are used within this document:
o API resource: a resource with the media type "application/ o API resource: a resource with the media type "application/
yang.api+xml" or "application/yang.api+json". yang.api+xml" or "application/yang.api+json".
o data resource: a resource with the media type "application/ o data resource: a resource with the media type "application/
yang.data+xml" or "application/yang.data+json". Containers, yang.data+xml" or "application/yang.data+json". Containers,
leafs, list entries, anydata and anyxml nodes can be data leafs, list entries, anydata and anyxml nodes can be data
resources. resources.
skipping to change at page 10, line 38 skipping to change at page 8, line 20
o datastore resource: a resource with the media type "application/ o datastore resource: a resource with the media type "application/
yang.datastore+xml" or "application/yang.datastore+json". yang.datastore+xml" or "application/yang.datastore+json".
Represents a datastore. Represents a datastore.
o edit operation: a RESTCONF operation on a data resource using o edit operation: a RESTCONF operation on a data resource using
either a POST, PUT, PATCH, or DELETE method. either a POST, PUT, PATCH, or DELETE method.
o event stream resource: This resource represents an SSE (Server- o event stream resource: This resource represents an SSE (Server-
Sent Events) event stream. The content consists of text using the Sent Events) event stream. The content consists of text using the
media type "text/event-stream", as defined by the HTML5 media type "text/event-stream", as defined by the HTML5
specification. Each event represents one <notification> message [W3C.REC-html5-20141028] specification. Each event represents one
generated by the server. It contains a conceptual system or data- <notification> message generated by the server. It contains a
model specific event that is delivered within an event conceptual system or data-model specific event that is delivered
notification stream. Also called a "stream resource". within an event notification stream. Also called a "stream
resource".
o media-type: HTTP uses Internet media types [RFC2046] in the o media-type: HTTP uses Internet media types [RFC2046] in the
Content-Type and Accept header fields in order to provide open and Content-Type and Accept header fields in order to provide open and
extensible data typing and type negotiation. extensible data typing and type negotiation.
o operation: the conceptual RESTCONF operation for a message, o operation: the conceptual RESTCONF operation for a message,
derived from the HTTP method, request URI, headers, and message- derived from the HTTP method, request URI, headers, and message-
body. body.
o operation resource: a resource with the media type "application/ o operation resource: a resource with the media type "application/
skipping to change at page 11, line 40 skipping to change at page 9, line 20
the client with the GET method. the client with the GET method.
o stream list: the set of data resource instances that describe the o stream list: the set of data resource instances that describe the
event stream resources available from the server. This event stream resources available from the server. This
information is defined in the "ietf-restconf-monitoring" module as information is defined in the "ietf-restconf-monitoring" module as
the "stream" list. It can be retrieved using the target resource the "stream" list. It can be retrieved using the target resource
"{+restconf}/data/ietf-restconf-monitoring:restconf-state/streams/ "{+restconf}/data/ietf-restconf-monitoring:restconf-state/streams/
stream". The stream list contains information about each stream, stream". The stream list contains information about each stream,
such as the URL to retrieve the event stream data. such as the URL to retrieve the event stream data.
1.4.5. URI Template 1.1.5. URI Template
Throughout this document, the URI template [RFC6570] syntax Throughout this document, the URI template [RFC6570] syntax
"{+restconf}" is used to refer to the RESTCONF API entry point "{+restconf}" is used to refer to the RESTCONF API entry point
outside of an example. See Section 3.1 for details. outside of an example. See Section 3.1 for details.
For simplicity, all of the examples in this document assume "/ For simplicity, all of the examples in this document assume "/
restconf" as the discovered RESTCONF API root path. restconf" as the discovered RESTCONF API root path.
1.4.6. Tree Diagrams 1.1.6. 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
data (read-write) and "ro" state data (read-only). data (read-write) and "ro" state data (read-only).
o Symbols after data node names: "?" means an optional node, "!" o Symbols after data node names: "?" means an optional node, "!"
means a presence container, and "*" denotes a list and leaf-list. means a presence container, and "*" 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.
1.2. Subset of NETCONF Functionality
RESTCONF does not need to mirror the full functionality of the
NETCONF protocol, but it does need to be compatible with NETCONF.
RESTCONF achieves this by implementing a subset of the interaction
capabilities provided by the NETCONF protocol, for instance, by
eliminating datastores and explicit locking.
RESTCONF uses HTTP methods to implement the equivalent of NETCONF
operations, enabling basic CRUD operations on a hierarchy of
conceptual resources.
The HTTP POST, PUT, PATCH, and DELETE methods are used to edit data
resources represented by YANG data models. These basic edit
operations allow the running configuration to be altered in an all-
or-none fashion.
RESTCONF is not intended to replace NETCONF, but rather provide an
additional interface that follows Representational State Transfer
(REST) principles and is compatible with a resource-oriented device
abstraction.
The following figure shows the system components if a RESTCONF server
is co-located with a NETCONF server:
+-----------+ +-----------------+
| Web app | <-------> | |
+-----------+ HTTP | network device |
| |
+-----------+ | +-----------+ |
| NMS app | <-------> | | datastore | |
+-----------+ NETCONF | +-----------+ |
+-----------------+
The following figure shows the system components if a RESTCONF server
is implemented in a device that does not have a NETCONF server:
+-----------+ +-----------------+
| Web app | <-------> | |
+-----------+ HTTP | network device |
| |
+-----------------+
1.3. Data Model Driven API
RESTCONF combines the simplicity of the HTTP protocol with the
predictability and automation potential of a schema-driven API.
Using YANG, a client can predict all management resources, much like
using URI Templates [RFC6570], but in a more holistic manner. This
strategy obviates the need for responses provided by the server to
contain Hypermedia as the Engine of Application State (HATEOAS)
links, originally described in Roy Fielding's doctoral dissertation
[rest-dissertation].
RESTCONF provides the YANG module capability information supported by
the server, in case the client wants to use it. The URIs for custom
protocol operations and datastore content are predictable, based on
the YANG module definitions.
The RESTCONF protocol operates on a conceptual datastore defined with
the YANG data modeling language. The server lists each YANG module
it supports using the "ietf-yang-library" YANG module, defined in
[I-D.ietf-netconf-yang-library]. The server MUST implement the
"ietf-yang-library" module, which MUST identify all the YANG modules
used by the server.
The conceptual datastore contents, data-model-specific operations and
event notifications are identified by this set of YANG modules.
The classification of data as configuration or non-configuration is
derived from the YANG "config" statement. Data ordering behavior is
derived from the YANG "ordered-by" statement.
The RESTCONF datastore editing model is simple and direct, similar to
the behavior of the :writable-running capability in NETCONF. Each
RESTCONF edit of a datastore resource is activated upon successful
completion of the transaction.
1.4. Coexistence with NETCONF
RESTCONF can be implemented on a device that supports NETCONF.
If the device supports :writable-running, all edits to configuration
nodes in {+restconf}/data are performed in the running configuration
datastore. The URI template "{+restconf}" is defined in
Section 1.1.5.
Otherwise, if the device supports :candidate, all edits to
configuration nodes in {+restconf}/data are performed in the
candidate configuration datastore. The candidate MUST be
automatically committed to running immediately after each successful
edit. Any edits from other sources that are in the candidate
datastore will also be committed. If a confirmed-commit procedure is
in progress, then this commit will act as the confirming commit. If
the server is expecting a "persist-id" parameter to complete the
confirmed commit procedure then the RESTCONF edit operation MUST fail
with a "409 Conflict" status-line.
If the device supports :startup, the device automatically copies the
content of running to startup after running has been updated as a
consequence of a RESTCONF edit operation.
If a datastore that would be modified by a RESTCONF operation has an
active lock, the RESTCONF edit operation MUST fail with a "409
Conflict" status-line.
1.5. RESTCONF Extensibility
There are two extensibility mechanisms built into RESTCONF:
o protocol version
o optional capabilities
This document defines version 1 of the RESTCONF protocol. If a
future version of this protocol is defined, then that document will
specify how the new version of RESTCONF is identified. It is
expected that a different entry point {+restconf2} would be defined.
The server will advertise all protocol versions that it supports in
its host-meta data.
In this example, the server supports both RESTCONF version 1 and a
fictitious version 2.
Request
-------
GET /.well-known/host-meta HTTP/1.1
Host: example.com
Accept: application/xrd+xml
Response
--------
HTTP/1.1 200 OK
Content-Type: application/xrd+xml
Content-Length: nnn
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
<Link rel='restconf' href='/restconf'/>
<Link rel='restconf2' href='/restconf2'/>
</XRD>
RESTCONF also supports a server-defined list of optional
capabilities, which are listed by a server using the
"ietf-restconf-monitoring" module defined in Section 9.3. For
example, this document defines several query parameters in
Section 4.8. Each optional parameter has a corresponding capability
URI defined in Section 9.1.1 that is advertised by the server if
supported.
The "capabilities" list can identify any sort of server extension.
Typically this extension mechanism is used to identify optional query
parameters but it is not limited to that purpose. For example, the
"defaults" URI defined in Section 9.1.2 specifies a mandatory URI
identifying server defaults handling behavior.
A new sub-resource type could be identified with a capability if it
is optional to implement. Mandatory protocol features and new
resource types require a new revision of the RESTCONF protocol.
2. Transport Protocol Requirements 2. Transport Protocol Requirements
2.1. Integrity and Confidentiality 2.1. Integrity and Confidentiality
HTTP [RFC7230] is an application layer protocol that may be layered HTTP [RFC7230] is an application layer protocol that may be layered
on any reliable transport-layer protocol. RESTCONF is defined on top on any reliable transport-layer protocol. RESTCONF is defined on top
of HTTP, but due to the sensitive nature of the information conveyed, of HTTP, but due to the sensitive nature of the information conveyed,
RESTCONF requires that the transport-layer protocol provides both RESTCONF requires that the transport-layer protocol provides both
data integrity and confidentiality, such as are provided by the TLS data integrity and confidentiality. A RESTCONF server MUST support
protocol [RFC5246]. the TLS protocol [RFC5246]. The RESTCONF protocol MUST NOT be used
over HTTP without using the TLS protocol.
HTTP/1.1 pipelining MUST be supported by the server. Responses MUST
be sent in the same order that requests are received. No other
versions of HTTP are supported for use with RESTCONF.
2.2. HTTPS with X.509v3 Certificates 2.2. HTTPS with X.509v3 Certificates
Given the nearly ubiquitous support for HTTP over TLS [RFC7230], Given the nearly ubiquitous support for HTTP over TLS [RFC7230],
RESTCONF implementations MUST support the "https" URI scheme, which RESTCONF implementations MUST support the "https" URI scheme, which
has the IANA assigned default port 443. Consistent with the has the IANA assigned default port 443.
exclusive use of X.509v3 certificates for NETCONF over TLS [RFC7589],
use of certificates in RESTCONF is also limited to X.509v3
certificates.
2.3. Certificate Validation RESTCONF servers MUST present an X.509v3 based certificate when
establishing a TLS connection with a RESTCONF client. The exclusive
use the X.509v3 based certificates is consistent with NETCONF over
TLS [RFC7589].
When presented an X.509 certificate, the RESTCONF peer MUST use X.509 2.3. Certificate Validation
certificate path validation [RFC5280] to verify the integrity of the The RESTCONF client MUST use X.509 certificate path validation
certificate. The presented X.509 certificate MAY also be considered [RFC5280] to verify the integrity of the RESTCONF server's TLS
certificate. The presented X.509 certificate MUST also be considered
valid if it matches a locally configured certificate fingerprint. If valid if it matches a locally configured certificate fingerprint. If
X.509 certificate path validation fails and the presented X.509 X.509 certificate path validation fails and the presented X.509
certificate does not match a locally configured certificate certificate does not match a locally configured certificate
fingerprint, the connection MUST be terminated as defined in fingerprint, the connection MUST be terminated as defined in
[RFC5246]. [RFC5246].
2.4. Authenticated Server Identity 2.4. Authenticated Server Identity
The RESTCONF client MUST carefully examine the certificate presented The RESTCONF client MUST check the identity of the server according
by the RESTCONF server to determine if it meets the client's to Section 6 of [RFC6125], including processing the outcome as
expectations. The RESTCONF client MUST check the identity of the described in Section 6.6 of [RFC6125].
server according to Section 6 of [RFC6125], including processing the
outcome as described in Section 6.6 of [RFC6125].
2.5. Authenticated Client Identity 2.5. Authenticated Client Identity
The RESTCONF server MUST authenticate client access to any protected The RESTCONF server MUST authenticate client access to any protected
resource. If the RESTCONF client is not authenticated to access a resource. If the RESTCONF client is not authorized to access a
resource, the server MUST send an HTTP response with status code 401 resource, the server MUST send an HTTP response with "401
(Unauthorized), as defined in Section 3.1 of [RFC7235]. Unauthorized" status-line, as defined in Section 3.1 of [RFC7235].
RESTCONF client authentication MUST either use TLS client To authenticate a client, a RESTCONF server MUST use TLS based client
certificates, like NETCONF over TLS [RFC7589], or use a standard HTTP certificates (Section 7.4.6 of [RFC5246]), or MUST use any HTTP
Authentication scheme, see Section 5.1 in [RFC7235]. A combination authentication scheme defined in the HTTP Authentication Scheme
of both client certificates and an HTTP Authentication scheme is also Registry (Section 5.1 in [RFC7235]). A server MAY also support the
allowed, with the determination of how to process this combination combination of both client certificates and an HTTP client
left as an implementation decision. authentication scheme, with the determination of how to process this
combination left as an implementation decision.
The RESTCONF client identity derived from the authentication The RESTCONF client identity derived from the authentication
mechanism used is hereafter known as the "RESTCONF username" and mechanism used is hereafter known as the "RESTCONF username" and
subject to the NETCONF Access Control Module (NACM) [RFC6536]. For subject to the NETCONF Access Control Module (NACM) [RFC6536]. When
when a client certificate is presented, this identity MUST be derived a client certificate is presented, the RESTCONF username MUST be
using the algorithm defined in Section 7 of [RFC7589]. For all other derived using the algorithm defined in Section 7 of [RFC7589]. For
cases, when HTTP Authentication is used, the identity is provided by all other cases, when HTTP authentication is used, the RESTCONF
the HTTP Authentication scheme used. username MUST be provided by the HTTP authentication scheme used.
3. Resources 3. Resources
The RESTCONF protocol operates on a hierarchy of resources, starting The RESTCONF protocol operates on a hierarchy of resources, starting
with the top-level API resource itself (Section 3.1). Each resource with the top-level API resource itself (Section 3.1). Each resource
represents a manageable component within the device. represents a manageable component within the device.
A resource can be considered a collection of conceptual data and the A resource can be considered a collection of data and the set of
set of allowed methods on that data. It can contain nested child allowed methods on that data. It can contain nested child resources.
resources. The child resource types and methods allowed on them are The child resource types and methods allowed on them are data-model
data-model specific. specific.
A resource has its own media type identifier, represented by the A resource has a media type identifier, represented by the
"Content-Type" header in the HTTP response message. A resource can "Content-Type" header in the HTTP response message. A resource can
contain zero or more nested resources. A resource can be created and contain zero or more nested resources. A resource can be created and
deleted independently of its parent resource, as long as the parent deleted independently of its parent resource, as long as the parent
resource exists. resource exists.
All RESTCONF resources are defined in this document except specific All RESTCONF resource types are defined in this document except
datastore contents, protocol operations, and event notifications. specific datastore contents, protocol operations, and event
The syntax and semantics for these resource types are defined in YANG notifications. The syntax and semantics for these resource types are
modules. defined in YANG modules.
The RESTCONF resources are accessed via a set of URIs defined in this The RESTCONF resources are accessed via a set of URIs defined in this
document. The set of YANG modules supported by the server will document. The set of YANG modules supported by the server will
determine the data model specific operations, top-level data node determine the data model specific operations, top-level data nodes,
resources, and event notification messages supported by the server. and event notification messages supported by the server.
The RESTCONF protocol does not include a resource discovery The RESTCONF protocol does not include a data resource discovery
mechanism. Instead, the definitions within the YANG modules mechanism. Instead, the definitions within the YANG modules
advertised by the server are used to construct a predictable advertised by the server are used to construct a predictable
operation or data resource identifier. operation or data resource identifier.
3.1. Root Resource Discovery 3.1. Root Resource Discovery
In line with the best practices defined by [RFC7320], RESTCONF In line with the best practices defined by [RFC7320], RESTCONF
enables deployments to specify where the RESTCONF API is located. enables deployments to specify where the RESTCONF API is located.
When first connecting to a RESTCONF server, a RESTCONF client MUST When first connecting to a RESTCONF server, a RESTCONF client MUST
determine the root of the RESTCONF API. The client discovers this by determine the root of the RESTCONF API. The client discovers this by
getting the "/.well-known/host-meta" resource ([RFC6415]) and using getting the "/.well-known/host-meta" resource ([RFC6415]) and using
the <Link> element containing the "restconf" attribute : the <Link> element containing the "restconf" attribute :
Example returning /restconf:
Request Request
------- -------
GET /.well-known/host-meta HTTP/1.1 GET /.well-known/host-meta HTTP/1.1
Host: example.com Host: example.com
Accept: application/xrd+xml Accept: application/xrd+xml
Response Response
-------- --------
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/xrd+xml Content-Type: application/xrd+xml
Content-Length: nnn Content-Length: nnn
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'> <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
<Link rel='restconf' href='/restconf'/> <Link rel='restconf' href='/restconf'/>
</XRD> </XRD>
After discovering the RESTCONF API root, the client MUST prepend it
to any subsequent request to a RESTCONF resource. In this example,
the client would use the path "/restconf" as the RESTCONF entry
point.
Once discovering the RESTCONF API root, the client MUST prepend it to Example returning /top/restconf:
any subsequent request to a RESTCONF resource. For instance, using
the "/restconf" path discovered above, the client can now determine
the operations supported by the the server. In this example a custom
"play" operation is supported:
Request Request
------- -------
GET /restconf/operations HTTP/1.1 GET /.well-known/host-meta HTTP/1.1
Host: example.com
Accept: application/xrd+xml
Response
--------
HTTP/1.1 200 OK
Content-Type: application/xrd+xml
Content-Length: nnn
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
<Link rel='restconf' href='/top/restconf'/>
</XRD>
In this example, the client would use the path "/top/restconf" as the
RESTCONF entry point.
The client can now determine the operation resources supported by the
the server. In this example a custom "play" operation is supported:
Request
-------
GET /top/restconf/operations HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.api+json Accept: application/yang.api+json
Response Response
-------- --------
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT
Content-Type: application/yang.api+json Content-Type: application/yang.api+json
{ "operations" : { "example-jukebox:play" : [ null ] } } { "operations" : { "example-jukebox:play" : {} } }
3.2. RESTCONF Resource Types If the XRD contains more than one link relation, then only the
relation named "restconf" is relevant to this specification.
3.2. RESTCONF Media Types
The RESTCONF protocol defines a set of application specific media The RESTCONF protocol defines a set of application specific media
types to identify each of the available resource types. The types to identify each of the available resource types. The
following resource types are defined in RESTCONF: following resource types are defined in RESTCONF:
+-----------+---------------------------------+ +-----------+---------------------------------+
| Resource | Media Type | | Resource | Media Type |
+-----------+---------------------------------+ +-----------+---------------------------------+
| API | application/yang.api+xml | | API | application/yang.api+xml |
| | application/yang.api+json | | | application/yang.api+json |
| Datastore | application/yang.datastore+xml | | Datastore | application/yang.datastore+xml |
| | application/yang.datastore+json | | | application/yang.datastore+json |
| Data | application/yang.data+xml | | Data | application/yang.data+xml |
| | application/yang.data+json | | | application/yang.data+json |
| Errors | application/yang.errors+xml | | [none] | application/yang.errors+xml |
| | application/yang.errors+json | | | application/yang.errors+json |
| Operation | application/yang.operation+xml | | Operation | application/yang.operation+xml |
| | application/yang.operation+json | | | application/yang.operation+json |
| Schema | application/yang | | Schema | application/yang |
+-----------+---------------------------------+ +-----------+---------------------------------+
RESTCONF Media Types RESTCONF Media Types
3.3. API Resource 3.3. API Resource
The API resource contains the entry points for the RESTCONF datastore The API resource contains the entry points for the RESTCONF datastore
and operation resources. It is the top-level resource located at and operation resources. It is the top-level resource located at
{+restconf} and has the media type "application/yang.api+xml" or {+restconf} and has the media type "application/yang.api+xml" or
"application/yang.api+json". "application/yang.api+json".
YANG Tree Diagram for an API Resource: YANG Tree Diagram for an API Resource:
+--rw restconf +--rw restconf
+--rw data +--rw data
+--rw operations +--rw operations
+--ro yang-library-version
The "application/yang.api" restconf-media-type extension in the The "application/yang.api" restconf-media-type extension in the
"ietf-restconf" module defined in Section 8 is used to specify the "ietf-restconf" module defined in Section 8 is used to specify the
structure and syntax of the conceptual child resources within the API structure and syntax of the conceptual child resources within the API
resource. resource.
The API resource can be retrieved with the GET method. The API resource can be retrieved with the GET method.
This resource has the following child resources: This resource has the following child resources:
+----------------+--------------------------------+ +----------------------+--------------------------------+
| Child Resource | Description | | Child Resource | Description |
+----------------+--------------------------------+ +----------------------+--------------------------------+
| data | Contains all data resources | | data | Contains all data resources |
| operations | Data-model specific operations | | operations | Data-model specific operations |
+----------------+--------------------------------+ | yang-library-version | ietf-yang-library module date |
+----------------------+--------------------------------+
RESTCONF API Resource RESTCONF API Resource
3.3.1. {+restconf}/data 3.3.1. {+restconf}/data
This mandatory resource represents the combined configuration and This mandatory resource represents the combined configuration and
operational data resources that can be accessed by a client. It operational data resources that can be accessed by a client. It
cannot be created or deleted by the client. The datastore resource cannot be created or deleted by the client. The datastore resource
type is defined in Section 3.4. type is defined in Section 3.4.
skipping to change at page 17, line 4 skipping to change at page 18, line 43
Accept: application/yang.data+xml Accept: application/yang.data+xml
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:30 GMT Date: Mon, 23 Apr 2012 17:01:30 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Content-Type: application/yang.data+xml Content-Type: application/yang.data+xml
<library xmlns="https://example.com/ns/example-jukebox"> <library xmlns="https://example.com/ns/example-jukebox">
<artist-count>42</artist-count> <artist-count>42</artist-count>
<album-count>59</album-count> <album-count>59</album-count>
<song-count>374</song-count> <song-count>374</song-count>
</library> </library>
3.3.2. {+restconf}/operations 3.3.2. {+restconf}/operations
This optional resource is a container that provides access to the This optional resource is a container that provides access to the
data-model specific protocol operations supported by the server. The data-model specific protocol operations supported by the server. The
server MAY omit this resource if no data-model specific operations server MAY omit this resource if no data-model specific operations
are advertised. are advertised.
Any data-model specific protocol operations defined in the YANG Any data-model specific protocol operations defined in the YANG
modules advertised by the server MAY be available as child nodes of modules advertised by the server MUST be available as child nodes of
this resource. this resource.
Operation resources are defined in Section 3.6. Operation resources are defined in Section 3.6.
3.3.3. {+restconf}/yang-library-version
This mandatory leaf identifies the revision date of the
"ietf-yang-library" YANG module that is implemented by this server.
Example:
GET /restconf/yang-library-version HTTP/1.1
Host: example.com
Accept: application/yang.data+xml
The server might respond (response wrapped for display purposes):
HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:30 GMT
Server: example-server
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/yang.data+xml
<yang-library-version
xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
2016-02-01
</yang-library-version>
3.4. Datastore Resource 3.4. Datastore Resource
The "{+restconf}/data" subtree represents the datastore resource The "{+restconf}/data" subtree represents the datastore resource
type, which is a collection of configuration and operational data type, which is a collection of configuration and operational data
nodes. nodes.
This resource type is an abstraction of the system's underlying This resource type is an abstraction of the system's underlying
datastore implementation. It is used to simplify resource editing datastore implementation. It is used to simplify resource editing
for the client. The RESTCONF datastore resource is a conceptual for the client. The RESTCONF datastore resource is a conceptual
collection of all configuration and operational data that is present collection of all configuration and operational data that is present
on the device. on the device.
Configuration edit transaction management and configuration Configuration edit transaction management and configuration
persistence are handled by the server and not controlled by the persistence are handled by the server and not controlled by the
client. A datastore resource can only be written directly with the client. A datastore resource can be written directly with the POST
PATCH method. Each RESTCONF edit of a datastore resource is saved to and PATCH methods. Each RESTCONF edit of a datastore resource is
non-volatile storage by the server. saved to non-volatile storage by the server.
3.4.1. Edit Collision Detection 3.4.1. Edit Collision Detection
Two "edit collision detection" mechanisms are provided in RESTCONF, Two "edit collision detection" mechanisms are provided in RESTCONF,
for datastore and data resources. for datastore and data resources.
3.4.1.1. Timestamp 3.4.1.1. Timestamp
The last change time is maintained and the "Last-Modified" The last change time is maintained and the "Last-Modified"
([RFC7232], Section 2.2) header is returned in the response for a ([RFC7232], Section 2.2) header is returned in the response for a
retrieval request. The "If-Unmodified-Since" header can be used in retrieval request. The "If-Unmodified-Since" header can be used in
edit operation requests to cause the server to reject the request if edit operation requests to cause the server to reject the request if
the resource has been modified since the specified timestamp. the resource has been modified since the specified timestamp.
The server MUST maintain a last-modified timestamp for the top-level The server MUST maintain a last-modified timestamp for the top-level
{+restconf}/data resource and SHOULD maintain last-modified {+restconf}/data resource. This timestamp is only affected by
timestamps for descendant resources. For all resources, the server configuration data resources, and MUST NOT be updated for changes to
MUST return the "Last-Modified" header when the resource is retrieved non-configuration data.
with the GET or HEAD methods. If the server does not maintain a
timestamp for a resource, it MUST return the timestamp of the
resource's ancestor, a process that may recurse up to the top-level
{+restconf}/data resource. Only changes to configuration data
resources within the datastore affect the timestamp.
3.4.1.2. Entity tag 3.4.1.2. Entity tag
A unique opaque string is maintained and the "ETag" ([RFC7232], A unique opaque string is maintained and the "ETag" ([RFC7232],
Section 2.3) header is returned in the response for a retrieval Section 2.3) header is returned in the response for a retrieval
request. The "If-Match" header can be used in edit operation request. The "If-Match" header can be used in edit operation
requests to cause the server to reject the request if the resource requests to cause the server to reject the request if the resource
entity tag does not match the specified value. entity tag does not match the specified value.
The server MUST maintain an entity tag for the top-level {+restconf}/ The server MUST maintain an entity tag for the top-level {+restconf}/
data resource and SHOULD maintain entity tags for descendant data resource. This entity tag is only affected by configuration
resources. For all resources, the server MUST return the "ETag" data resources, and MUST NOT be updated for changes to non-
header when the resource is retrieved with the GET or HEAD methods. configuration data.
If the server does not maintain an entity tag for a resource, it MUST
return the entity tag of the resource's ancestor, a process that may 3.4.1.3. Update Procedure
recurse up to the top-level {+restconf}/data resource. Only changes
to configuration data resources within the datastore affect the Changes to configuration data resources affect the timestamp and
entity tag. entity tag to that resource, any ancestor data resources, and the
datastore resource.
For example, an edit to disable an interface might be done by setting
the leaf "/interfaces/interface/enabled" to "false". The "enabled"
data node and its ancestors (one "interface" list instance, and the
"interfaces" container) are considered to be changed. The datastore
is considered to be changed when any top-level configuration data
node is changed (e.g., "interfaces").
3.5. Data Resource 3.5. Data Resource
A data resource represents a YANG data node that is a descendant node A data resource represents a YANG data node that is a descendant node
of a datastore resource. Each YANG-defined data node can be uniquely of a datastore resource. Each YANG-defined data node can be uniquely
targeted by the request-line of an HTTP operation. Containers, targeted by the request-line of an HTTP operation. Containers,
leafs, list entries, anydata and anyxml nodes are data resources. leafs, leaf-list entries, list entries, anydata and anyxml nodes are
data resources.
The representation maintained for each data resource is the YANG The representation maintained for each data resource is the YANG
defined subtree for that node. HTTP operations on a data resource defined subtree for that node. HTTP operations on a data resource
affect both the targeted data node and all its descendants, if any. affect both the targeted data node and all its descendants, if any.
For configuration data resources, the server MAY maintain a last- For configuration data resources, the server SHOULD maintain a last-
modified timestamp for the resource, and return the "Last-Modified" modified timestamp for the resource, and return the "Last-Modified"
header when it is retrieved with the GET or HEAD methods. If header when it is retrieved with the GET or HEAD methods. If
maintained, the resource timestamp MUST be set to the current time maintained, the resource timestamp MUST be set to the current time
whenever the resource or any configuration resource within the whenever the resource or any configuration resource within the
resource is altered. resource is altered. If not maintained, then the resource timestamp
for the datastore MUST be used instead.
For configuration data resources, the server MAY maintain a resource This timestamp is only affected by configuration data resources, and
entity tag for the resource, and return the "ETag" header when it is MUST NOT be updated for changes to non-configuration data.
retrieved as the target resource with the GET or HEAD methods. If
maintained, the resource entity tag MUST be updated whenever the For configuration data resources, the server SHOULD maintain a
resource or any configuration resource within the resource is resource entity tag for the resource, and return the "ETag" header
altered. when it is retrieved as the target resource with the GET or HEAD
methods. If maintained, the resource entity tag MUST be updated
whenever the resource or any configuration resource within the
resource is altered. If not maintained, then the resource entity tag
for the datastore MUST be used instead.
This entity tag is only affected by configuration data resources, and
MUST NOT be updated for changes to non-configuration data.
A data resource can be retrieved with the GET method. Data resources A data resource can be retrieved with the GET method. Data resources
are accessed via the "{+restconf}/data" entry point. This sub-tree are accessed via the "{+restconf}/data" entry point. This sub-tree
is used to retrieve and edit data resources. is used to retrieve and edit data resources.
A configuration data resource can be altered by the client with some A configuration data resource can be altered by the client with some
or all of the edit operations, depending on the target resource and or all of the edit operations, depending on the target resource and
the specific operation. Refer to Section 4 for more details on edit the specific operation. Refer to Section 4 for more details on edit
operations. operations.
skipping to change at page 19, line 49 skipping to change at page 22, line 35
A RESTCONF data resource identifier is not an XPath expression. It A RESTCONF data resource identifier is not an XPath expression. It
is encoded from left to right, starting with the top-level data node, is encoded from left to right, starting with the top-level data node,
according to the "api-path" rule in Section 3.5.1.1. The node name according to the "api-path" rule in Section 3.5.1.1. The node name
of each ancestor of the target resource node is encoded in order, of each ancestor of the target resource node is encoded in order,
ending with the node name for the target resource. If a node in the ending with the node name for the target resource. If a node in the
path is defined in another module than its parent node, then module path is defined in another module than its parent node, then module
name followed by a colon character (":") is prepended to the node name followed by a colon character (":") is prepended to the node
name in the resource identifier. See Section 3.5.1.1 for details. name in the resource identifier. See Section 3.5.1.1 for details.
If a data node in the path expression is a YANG leaf-list node, then
the leaf-list value MUST be encoded according to the following rules:
o The instance-identifier for the leaf-list MUST be encoded using
one path segment [RFC3986].
o The path segment is constructed by having the leaf-list name,
followed by an "=" character, followed by the leaf-list value.
(e.g., /restconf/data/top-leaflist=fred).
If a data node in the path expression is a YANG list node, then the If a data node in the path expression is a YANG list node, then the
key values for the list (if any) MUST be encoded according to the key values for the list (if any) MUST be encoded according to the
following rules: following rules:
o The key leaf values for a data resource representing a YANG list o The key leaf values for a data resource representing a YANG list
MUST be encoded using one path segment [RFC3986]. MUST be encoded using one path segment [RFC3986].
o If there is only one key leaf value, the path segment is o If there is only one key leaf value, the path segment is
constructed by having the list name followed by an "=" followed by constructed by having the list name, followed by an "=" character,
the single key leaf value. followed by the single key leaf value.
o If there are multiple key leaf values, the value of each leaf o If there are multiple key leaf values, the path segment is
identified in the "key" statement is encoded in the order constructed by having the list name, followed by the value of each
specified in the YANG "key" statement, with a comma separating leaf identified in the "key" statement, encoded in the order
them. specified in the YANG "key" statement. Each key leaf value except
the last one is followed by a comma character.
o The key value is specified as a string, using the canonical o The key value is specified as a string, using the canonical
representation for the YANG data type. Any reserved characters representation for the YANG data type. Any reserved characters
MUST be percent-encoded, according to [RFC3986], section 2.1. MUST be percent-encoded, according to [RFC3986], section 2.1.
o All the components in the "key" statement MUST be encoded. o All the components in the "key" statement MUST be encoded.
Partial instance identifiers are not supported. Partial instance identifiers are not supported.
o A missing key value is interpreted a zero-length string. o Since missing key values are not allowed, two consecutive commas
(example: list=foo,,baz). are interpreted as a zero-length string. (example:
list=foo,,baz).
o The "list-instance" ABNF rule defined in Section 3.5.1.1 o The "list-instance" ABNF rule defined in Section 3.5.1.1
represents the syntax of a list instance identifier. represents the syntax of a list instance identifier.
o Resource URI values returned in Location headers for data o Resource URI values returned in Location headers for data
resources MUST identify the module name, even if there are no resources MUST identify the module name, even if there are no
conflicting local names when the resource is created. This conflicting local names when the resource is created. This
ensures the correct resource will be identified even if the server ensures the correct resource will be identified even if the server
loads a new module that the old client does not know about. loads a new module that the old client does not know about.
skipping to change at page 20, line 48 skipping to change at page 23, line 47
container top { container top {
list list1 { list list1 {
key "key1 key2 key3"; key "key1 key2 key3";
... ...
list list2 { list list2 {
key "key4 key5"; key "key4 key5";
... ...
leaf X { type string; } leaf X { type string; }
} }
} }
leaf-list Y {
type uint32;
}
} }
For the above YANG definition, URI with key leaf values will be For the above YANG definition, a target resource URI for leaf "X"
encoded as follows (line wrapped for display purposes only): would be encoded as follows (line wrapped for display purposes only):
/restconf/data/example-top:top/list1=key1val,key2val,key3val/ /restconf/data/example-top:top/list1=key1,key2,key3/
list2=key4val,key5val/X list2=key4,key5/X
For the above YANG definition, a target resource URI for leaf-list
"Y" would be encoded as follows:
/restconf/data/example-top:top/Y=instance-value
The following example shows how reserved characters are percent- The following example shows how reserved characters are percent-
encoded within a key value. The value of "key1" contains a comma, encoded within a key value. The value of "key1" contains a comma,
single-quote, double-quote, colon, double-quote, space, and forward single-quote, double-quote, colon, double-quote, space, and forward
slash. (,'":" /). Note that double-quote is not a reserved slash. (,'":" /). Note that double-quote is not a reserved
characters and does not need to be percent-encoded. The value of characters and does not need to be percent-encoded. The value of
"key2" is the empty string, and the value of "key3" is the string "key2" is the empty string, and the value of "key3" is the string
"foo". "foo".
Example URL: Example URL:
/restconf/data/example-top:top/list1=%2C%27"%3A"%20%2F,,foo /restconf/data/example-top:top/list1=%2C%27"%3A"%20%2F,,foo
3.5.1.1. ABNF For Data Resource Identifiers 3.5.1.1. ABNF For Data Resource Identifiers
The "api-path" ABNF syntax is used to construct RESTCONF path The "api-path" Augmented Backus-Naur Form (ABNF) syntax is used to
identifiers: construct RESTCONF path identifiers:
api-path = "/" | api-path = "/" |
("/" api-identifier ("/" api-identifier
0*("/" (api-identifier | list-instance ))) 0*("/" (api-identifier | list-instance )))
api-identifier = [module-name ":"] identifier ;; note 1 api-identifier = [module-name ":"] identifier ;; note 1
module-name = identifier module-name = identifier
list-instance = api-identifier "=" key-value ["," key-value]* list-instance = api-identifier "=" key-value ["," key-value]*
skipping to change at page 22, line 12 skipping to change at page 25, line 16
to the JSON identifier encoding rules in Section 4 of to the JSON identifier encoding rules in Section 4 of
[I-D.ietf-netmod-yang-json]. [I-D.ietf-netmod-yang-json].
3.5.2. Defaults Handling 3.5.2. Defaults Handling
RESTCONF requires that a server report its default handling mode (see RESTCONF requires that a server report its default handling mode (see
Section 9.1.2 for details). If the optional "with-defaults" query Section 9.1.2 for details). If the optional "with-defaults" query
parameter is supported by the server, a client may use it to control parameter is supported by the server, a client may use it to control
retrieval of default values (see Section 4.8.9 for details). retrieval of default values (see Section 4.8.9 for details).
If a leaf or leaf-list is missing from the configuration and there is
a YANG-defined default for that data resource, then the server MUST
use the YANG-defined default as the configured value.
If the target of a GET method is a data node that represents a leaf If the target of a GET method is a data node that represents a leaf
that has a default value, and the leaf has not been given a value that has a default value, and the leaf has not been given a value
yet, the server MUST return the default value that is in use by the yet, the server MUST return the default value that is in use by the
server. server.
If the target of a GET method is a data node that represents a If the target of a GET method is a data node that represents a
container or list that has any child resources with default values, container or list that has any child resources with default values,
for the child resources that have not been given value yet, the for the child resources that have not been given value yet, the
server MAY return the default values that are in use by the server, server MAY return the default values that are in use by the server,
in accordance with its reported default handing mode and query in accordance with its reported default handing mode and query
parameters passed by the client. parameters passed by the client.
3.6. Operation Resource 3.6. Operation Resource
An operation resource represents a protocol operation defined with An operation resource represents a protocol operation defined with
one of the YANG "action" or "rpc" statements. It is invoked using a the YANG "rpc" statement or a data-model specific action defined with
POST method on the operation resource. a YANG "action" statement. It is invoked using a POST method on the
operation resource.
An RPC operation is invoked as: An RPC operation is invoked as:
POST {+restconf}/operations/<operation> POST {+restconf}/operations/<operation>
The <operation> field identifies the module name and rpc identifier The <operation> field identifies the module name and rpc identifier
string for the desired operation. string for the desired operation.
For example, if "module-A" defined a "reset" rpc operation, then For example, if "module-A" defined a "reset" rpc operation, then
invoking the operation from "module-A" would be requested as follows: invoking the operation from "module-A" would be requested as follows:
POST /restconf/operations/module-A:reset HTTP/1.1 POST /restconf/operations/module-A:reset HTTP/1.1
Server example.com Server example.com
An action is invoked as: An action is invoked as:
POST {+restconf}/data/<data-resource-identifier>/<operation> POST {+restconf}/data/<data-resource-identifier>/<action>
where <data-resource-identifier> contains the path to the data node where <data-resource-identifier> contains the path to the data node
where the action is defined, and <operation> is the name of the where the action is defined, and <action> is the name of the action.
action.
For example, if "module-A" defined a "reset-all" action in the For example, if "module-A" defined a "reset-all" action in the
container "interfaces", then invoking this action would be requested container "interfaces", then invoking this action would be requested
as follows: as follows:
POST /restconf/data/module-A:interfaces/reset-all HTTP/1.1 POST /restconf/data/module-A:interfaces/reset-all HTTP/1.1
Server example.com Server example.com
If the "action" or "rpc" statement has an "input" section, then a If the "rpc" or "action" statement has an "input" section, then a
message-body MAY be sent by the client in the request, otherwise the message-body MAY be sent by the client in the request, otherwise the
request message MUST NOT include a message-body. request message MUST NOT include a message-body. If the "input"
section contains mandatory parameters, then a message-body MUST be
sent by the client.
If the operation is successfully invoked, and if the "action" or If the operation is invoked without errors, and if the "rpc" or
"rpc" statement has an "output" section, then a message-body MAY be "action" statement has an "output" section, then a message-body MAY
sent by the server in the response, otherwise the response message be sent by the server in the response, otherwise the response message
MUST NOT include a message-body in the response message, and MUST MUST NOT include a message-body in the response message, and MUST
send a "204 No Content" status-line instead. send a "204 No Content" status-line instead.
If the operation is not successfully invoked, then a message-body If the operation input is not valid, or the operation is invoked but
SHOULD be sent by the server, containing an "errors" resource, as errors occur, then a message-body MUST be sent by the server,
defined in Section 3.9. containing an "errors" resource, as defined in Section 3.9. A
detailed example of an operation resource error response can be found
in Section 3.6.3.
3.6.1. Encoding Operation Input Parameters All operation resources representing RPC operations supported by the
server MUST be identified in the {+restconf}/operations subtree
defined in Section 3.3.2. Operation resources representing YANG
actions are not identified in this subtree since they are invoked
using a URI within the {+restconf}/data subtree.
If the "action" or "rpc" statement has an "input" section, then the 3.6.1. Encoding Operation Resource Input Parameters
If the "rpc" or "action" statement has an "input" section, then the
"input" node is provided in the message-body, corresponding to the "input" node is provided in the message-body, corresponding to the
YANG data definition statements within the "input" section. YANG data definition statements within the "input" section.
Example: Examples:
The following YANG definition is used for the examples in this The following YANG module is used for the RPC operation examples in
section. this section.
module example-ops { module example-ops {
namespace "https://example.com/ns/example-ops"; namespace "https://example.com/ns/example-ops";
prefix "ops"; prefix "ops";
revision "2016-03-10";
rpc reboot { rpc reboot {
input { input {
leaf delay { leaf delay {
units seconds; units seconds;
type uint32; type uint32;
default 0; default 0;
}
leaf message { type string; }
leaf language { type string; }
} }
leaf message { type string; }
leaf language { type string; }
} }
rpc get-reboot-info { }
output {
leaf reboot-time { rpc get-reboot-info {
units seconds; output {
type uint32; leaf reboot-time {
units seconds;
type uint32;
}
leaf message { type string; }
leaf language { type string; }
}
}
}
The following YANG module is used for the YANG action examples in
this section.
module example-actions {
yang-version 1.1;
namespace "https://example.com/ns/example-actions";
prefix "act";
import ietf-yang-types { prefix yang; }
revision "2016-03-10";
container interfaces {
list interface {
key name;
leaf name { type string; }
action reset {
input {
leaf delay {
units seconds;
type uint32;
default 0;
}
}
}
action get-last-reset-time {
output {
leaf last-reset {
type yang:date-and-time;
mandatory true;
}
} }
leaf message { type string; }
leaf language { type string; }
} }
} }
} }
The client might send the following POST request message: }
RPC Input Example:
The client might send the following POST request message to invoke
the "reboot" RPC operation:
POST /restconf/operations/example-ops:reboot HTTP/1.1 POST /restconf/operations/example-ops:reboot HTTP/1.1
Host: example.com Host: example.com
Content-Type: application/yang.operation+xml Content-Type: application/yang.operation+xml
<input xmlns="https://example.com/ns/example-ops"> <input xmlns="https://example.com/ns/example-ops">
<delay>600</delay> <delay>600</delay>
<message>Going down for system maintenance</message> <message>Going down for system maintenance</message>
<language>en-US</language> <language>en-US</language>
</input> </input>
The server might respond: The server might respond:
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Date: Mon, 25 Apr 2012 11:01:00 GMT Date: Mon, 25 Apr 2012 11:01:00 GMT
Server: example-server Server: example-server
3.6.2. Encoding Operation Output Parameters The same example request message is shown here using JSON encoding:
If the "action" or "rpc" statement has an "output" section, then the POST /restconf/operations/example-ops:reboot HTTP/1.1
Host: example.com
Content-Type: application/yang.operation+json
{
"example-ops:input" : {
"delay" : 600,
"message" : "Going down for system maintenance",
"language" : "en-US"
}
}
Action Input Example:
The client might send the following POST request message to invoke
the "reset" action (text wrap for display purposes):
POST /restconf/data/example-actions:interfaces/interface=eth0
/reset HTTP/1.1
Host: example.com
Content-Type: application/yang.operation+xml
<input xmlns="https://example.com/ns/example-actions">
<delay>600</delay>
</input>
The server might respond:
HTTP/1.1 204 No Content
Date: Mon, 25 Apr 2012 11:01:00 GMT
Server: example-server
The same example request message is shown here using JSON encoding
(text wrap for display purposes):
POST /restconf/data/example-action:interfaces/interface=eth0
/reset HTTP/1.1
Host: example.com
Content-Type: application/yang.operation+json
{ "example-action:input" : {
"delay" : 600
}
}
3.6.2. Encoding Operation Resource Output Parameters
If the "rpc" or "action" statement has an "output" section, then the
"output" node is provided in the message-body, corresponding to the "output" node is provided in the message-body, corresponding to the
YANG data definition statements within the "output" section. YANG data definition statements within the "output" section.
Example: Examples:
RPC Output Example:
The "example-ops" YANG module defined in Section 3.6.1 is used for The "example-ops" YANG module defined in Section 3.6.1 is used for
the examples in this section. this example.
The client might send the following POST request message: The client might send the following POST request message to invoke
the "get-reboot-info" operation:
POST /restconf/operations/example-ops:get-reboot-info HTTP/1.1 POST /restconf/operations/example-ops:get-reboot-info HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.operation+json Accept: application/yang.operation+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 25 Apr 2012 11:10:30 GMT Date: Mon, 25 Apr 2012 11:10:30 GMT
Server: example-server Server: example-server
Content-Type: application/yang.operation+json Content-Type: application/yang.operation+json
{ {
"example-ops:output" : { "example-ops:output" : {
"reboot-time" : 30, "reboot-time" : 30,
"message" : "Going down for system maintenance", "message" : "Going down for system maintenance",
"language" : "en-US" "language" : "en-US"
} }
} }
3.6.3. Encoding Operation Errors The same response is shown here using XML encoding:
If any errors occur while attempting to invoke the operation, then an HTTP/1.1 200 OK
"errors" data structure is returned with the appropriate error Date: Mon, 25 Apr 2012 11:10:30 GMT
status. Server: example-server
Content-Type: application/yang.operation+xml
Using the "reset" operation example above, the client might send the <output xmlns="https://example.com/ns/example-ops">
following POST request message: <reboot-time>30</reboot-time>
<message>Going down for system maintenance</message>
<language>en-US</language>
</output>
Action Output Example:
The "example-actions" YANG module defined in Section 3.6.1 is used
for this example.
The client might send the following POST request message to invoke
the "get-last-reset-time" action:
POST /restconf/data/example-actions:interfaces/interface=eth0
/get-last-reset-time HTTP/1.1
Host: example.com
Accept: application/yang.operation+json
The server might respond:
HTTP/1.1 200 OK
Date: Mon, 25 Apr 2012 11:10:30 GMT
Server: example-server
Content-Type: application/yang.operation+json
{
"example-actions:output" : {
"last-reset" : "2015-10-10T02:14:11Z"
}
}
3.6.3. Encoding Operation Resource Errors
If any errors occur while attempting to invoke the operation or
action, then an "errors" media type is returned with the appropriate
error status.
Using the "reboot" operation from the example in Section 3.6.1, the
client might send the following POST request message:
POST /restconf/operations/example-ops:reboot HTTP/1.1 POST /restconf/operations/example-ops:reboot HTTP/1.1
Host: example.com Host: example.com
Content-Type: application/yang.operation+xml Content-Type: application/yang.operation+xml
<input xmlns="https://example.com/ns/example-ops"> <input xmlns="https://example.com/ns/example-ops">
<delay>-33</delay> <delay>-33</delay>
<message>Going down for system maintenance</message> <message>Going down for system maintenance</message>
<language>en-US</language> <language>en-US</language>
</input> </input>
The server might respond with an "invalid-value" error: The server might respond with an "invalid-value" error:
HTTP/1.1 400 Bad Request HTTP/1.1 400 Bad Request
Date: Mon, 25 Apr 2012 11:10:30 GMT Date: Mon, 25 Apr 2012 11:10:30 GMT
Server: example-server Server: example-server
Content-Type: application/yang.errors+xml Content-Type: application/yang.errors+xml
<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"> <errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error> <error>
<error-type>protocol</error-type> <error-type>protocol</error-type>
<error-tag>invalid-value</error-tag> <error-tag>invalid-value</error-tag>
<error-path xmlns:err="https://example.com/ns/example-ops"> <error-path xmlns:ops="https://example.com/ns/example-ops">
err:input/err:delay /ops:input/ops:delay
</error-path> </error-path>
<error-message>Invalid input parameter</error-message> <error-message>Invalid input parameter</error-message>
</error> </error>
</errors> </errors>
The same response is shown here in JSON encoding:
HTTP/1.1 400 Bad Request
Date: Mon, 25 Apr 2012 11:10:30 GMT
Server: example-server
Content-Type: application/yang.errors+json
{ "ietf-restconf:errors" : {
"error" : [
{
"error-type" : "protocol",
"error-tag" : "invalid-value",
"error-path" : "/example-ops:input/delay",
"error-message" : "Invalid input parameter",
}
]
}
}
3.7. Schema Resource 3.7. Schema Resource
The server can optionally support retrieval of the YANG modules it The server can optionally support retrieval of the YANG modules it
supports, using the "ietf-yang-library" module, defined in supports. If retrieval is supported, then the "schema" leaf MUST be
present in the associated "module" list entry, defined in
[I-D.ietf-netconf-yang-library]. [I-D.ietf-netconf-yang-library].
To retrieve a YANG module, a client first needs to get the URL for To retrieve a YANG module, a client first needs to get the URL for
retrieving the schema. retrieving the schema, which is stored in the "schema" leaf. Note
that there is no required structure for this URL. The URL value
shown below is just an example.
The client might send the following GET request message: The client might send the following GET request message:
GET /restconf/data/ietf-yang-library:modules/module= GET /restconf/data/ietf-yang-library:modules/module=
example-jukebox,2014-07-03/schema HTTP/1.1 example-jukebox,2015-04-04/schema HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+json Accept: application/yang.data+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 25 Apr 2012 11:10:30 GMT Date: Thu, 11 Feb 2016 11:10:30 GMT
Server: example-server Server: example-server
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"ietf-yang-library:schema": "ietf-yang-library:schema":
"https://example.com/mymodules/example-jukebox/2015-06-04" "https://example.com/mymodules/example-jukebox/2015-04-04"
} }
Next the client needs to retrieve the actual YANG schema. Next the client needs to retrieve the actual YANG schema.
The client might send the following GET request message: The client might send the following GET request message:
GET https://example.com/mymodules/example-jukebox/2015-06-04 GET https://example.com/mymodules/example-jukebox/2015-04-04
HTTP/1.1 HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang Accept: application/yang
The server might respond: The server might respond:
HTTP/1.1 200 OK
Date: Thu, 11 Feb 2016 11:10:31 GMT
Server: example-server
Content-Type: application/yang
module example-jukebox { module example-jukebox {
// contents of YANG module deleted for this example... // contents of YANG module deleted for this example...
} }
3.8. Event Stream Resource 3.8. Event Stream Resource
An "event stream" resource represents a source for system generated An "event stream" resource represents a source for system generated
event notifications. Each stream is created and modified by the event notifications. Each stream is created and modified by the
skipping to change at page 28, line 5 skipping to change at page 34, line 30
The following table shows how the RESTCONF operations relate to The following table shows how the RESTCONF operations relate to
NETCONF protocol operations: NETCONF protocol operations:
+----------+--------------------------------------------+ +----------+--------------------------------------------+
| RESTCONF | NETCONF | | RESTCONF | NETCONF |
+----------+--------------------------------------------+ +----------+--------------------------------------------+
| OPTIONS | none | | OPTIONS | none |
| HEAD | none | | HEAD | none |
| GET | <get-config>, <get> | | GET | <get-config>, <get> |
| POST | <edit-config> (operation="create") | | POST | <edit-config> (operation="create") |
| POST | invoke any operation |
| PUT | <edit-config> (operation="create/replace") | | PUT | <edit-config> (operation="create/replace") |
| PATCH | <edit-config> (operation="merge") | | PATCH | <edit-config> (operation="merge") |
| DELETE | <edit-config> (operation="delete") | | DELETE | <edit-config> (operation="delete") |
+----------+--------------------------------------------+ +----------+--------------------------------------------+
Table 1: CRUD Methods in RESTCONF CRUD Methods in RESTCONF
The NETCONF "remove" operation attribute is not supported by the HTTP The NETCONF "remove" operation attribute is not supported by the HTTP
DELETE method. The resource must exist or the DELETE method will DELETE method. The resource must exist or the DELETE method will
fail. The PATCH method is equivalent to a "merge" operation when fail. The PATCH method is equivalent to a "merge" operation when
using a plain patch (see Section 4.6.1), other media-types may using a plain patch (see Section 4.6.1); other media-types may
provide more granular control. provide more granular control.
Access control mechanisms may be used to limit what operations can be Access control mechanisms MUST be used to limit what operations can
used. In particular, RESTCONF is compatible with the NETCONF Access be used. In particular, RESTCONF is compatible with the NETCONF
Control Model (NACM) [RFC6536], as there is a specific mapping Access Control Model (NACM) [RFC6536], as there is a specific mapping
between RESTCONF and NETCONF operations, defined in Table 1. The between RESTCONF and NETCONF operations, defined in Section 4. The
resource path needs to be converted internally by the server to the resource path needs to be converted internally by the server to the
corresponding YANG instance-identifier. Using this information, the corresponding YANG instance-identifier. Using this information, the
server can apply the NACM access control rules to RESTCONF messages. server can apply the NACM access control rules to RESTCONF messages.
The server MUST NOT allow any operation to any resources that the The server MUST NOT allow any operation to any resources that the
client is not authorized to access. client is not authorized to access.
Operations are applied to a single data resource instance at once.
The server MUST NOT allow any operation to be applied to multiple
instances of a YANG list or leaf-list.
Implementation of all methods (except PATCH) are defined in Implementation of all methods (except PATCH) are defined in
[RFC7231]. This section defines the RESTCONF protocol usage for each [RFC7231]. This section defines the RESTCONF protocol usage for each
HTTP method. HTTP method.
4.1. OPTIONS 4.1. OPTIONS
The OPTIONS method is sent by the client to discover which methods The OPTIONS method is sent by the client to discover which methods
are supported by the server for a specific resource (e.g., GET, POST, are supported by the server for a specific resource (e.g., GET, POST,
DELETE, etc.). DELETE, etc.). The server MUST implement this method.
The server SHOULD implement this method, however the same information
could be extracted from the YANG modules and the RESTCONF protocol
specification.
If the PATCH method is supported, then the "Accept-Patch" header MUST If the PATCH method is supported, then the "Accept-Patch" header MUST
be supported and returned in the response to the OPTIONS request, as be supported and returned in the response to the OPTIONS request, as
defined in [RFC5789]. defined in [RFC5789].
4.2. HEAD 4.2. HEAD
The HEAD method is sent by the client to retrieve just the headers The HEAD method is sent by the client to retrieve just the headers
that would be returned for the comparable GET method, without the that would be returned for the comparable GET method, without the
response message-body. It is supported for all resource types, response message-body. It is supported for all resource types,
skipping to change at page 29, line 30 skipping to change at page 36, line 7
4.3. GET 4.3. GET
The GET method is sent by the client to retrieve data and meta-data The GET method is sent by the client to retrieve data and meta-data
for a resource. It is supported for all resource types, except for a resource. It is supported for all resource types, except
operation resources. The request MUST contain a request URI that operation resources. The request MUST contain a request URI that
contains at least the entry point. contains at least the entry point.
The server MUST NOT return any data resources for which the user does The server MUST NOT return any data resources for which the user does
not have read privileges. If the user is not authorized to read the not have read privileges. If the user is not authorized to read the
target resource, an error response containing a "403 Forbidden" or target resource, an error response containing a "403 Forbidden"
"404 Not Found" status-line is returned to the client. status-line SHOULD be returned. A server MAY return a "404 Not
Found" status-line, as described in section 6.5.3 in [RFC7231].
If the user is authorized to read some but not all of the target If the user is authorized to read some but not all of the target
resource, the unauthorized content is omitted from the response resource, the unauthorized content is omitted from the response
message-body, and the authorized content is returned to the client. message-body, and the authorized content is returned to the client.
If any content is returned to the client, then the server MUST send a
valid response message-body. More than one element MUST NOT be
returned for XML encoding.
If a retrieval request for a data resource representing a YANG leaf-
list or list object identifies more than one instance, and XML
encoding is used in the response, then an error response containing a
"400 Bad Request" status-line MUST be returned by the server.
If the target resource of a retrieval request is for an operation
resource then a "405 Method Not Allowed" status-line MUST be returned
by the server.
Note that the way that access control is applied to data resources is
completely incompatible with HTTP caching. The Last-Modified and
ETag headers maintained for a data resource are not affected by
changes to the access control rules for that data resource. It is
possible for the representation of a data resource that is visible to
a particular client to be changed without detection via the Last-
Modified or ETag values.
Example: Example:
The client might request the response headers for an XML The client might request the response headers for an XML
representation of the a specific "album" resource: representation of the a specific "album" resource:
GET /restconf/data/example-jukebox:jukebox/ GET /restconf/data/example-jukebox:jukebox/
library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1 library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+xml Accept: application/yang.data+xml
skipping to change at page 30, line 9 skipping to change at page 37, line 8
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:02:40 GMT Date: Mon, 23 Apr 2012 17:02:40 GMT
Server: example-server Server: example-server
Content-Type: application/yang.data+xml Content-Type: application/yang.data+xml
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
ETag: a74eefc993a2b ETag: a74eefc993a2b
Last-Modified: Mon, 23 Apr 2012 11:02:14 GMT Last-Modified: Mon, 23 Apr 2012 11:02:14 GMT
<album xmlns="http://example.com/ns/example-jukebox"> <album xmlns="http://example.com/ns/example-jukebox"
<name>Wasting Light</name> xmlns:jbox="http://example.com/ns/example-jukebox">
<genre xmlns:g="http://example.com/ns/example-jukebox"> <name>Wasting Light</name>
g:alternative <genre>jbox:alternative</genre>
</genre> <year>2011</year>
<year>2011</2011>
</album> </album>
4.4. POST 4.4. POST
The POST method is sent by the client to create a data resource or The POST method is sent by the client to create a data resource or
invoke an operation resource. The server uses the target resource invoke an operation resource. The server uses the target resource
media type to determine how to process the request. media type to determine how to process the request.
+-----------+------------------------------------------------+ +-----------+------------------------------------------------+
| Type | Description | | Type | Description |
skipping to change at page 30, line 39 skipping to change at page 37, line 37
+-----------+------------------------------------------------+ +-----------+------------------------------------------------+
Resource Types that Support POST Resource Types that Support POST
4.4.1. Create Resource Mode 4.4.1. Create Resource Mode
If the target resource type is a datastore or data resource, then the If the target resource type is a datastore or data resource, then the
POST is treated as a request to create a top-level resource or child POST is treated as a request to create a top-level resource or child
resource, respectively. The message-body is expected to contain the resource, respectively. The message-body is expected to contain the
content of a child resource to create within the parent (target content of a child resource to create within the parent (target
resource). The data-model for the child tree is the subtree is resource). The message-body MUST NOT contain more than one instance
defined by YANG for the child resource. of the expected data resource. The data-model for the child tree is
the subtree as defined by YANG for the child resource.
The "insert" and "point" query parameters are supported by the POST The "insert" and "point" query parameters are supported by the POST
method for datastore and data resource types, as specified in the method for datastore and data resources. If the server implements
YANG definition in Section 8. any YANG module that contains a configuration data node that is
"ordered-by" user, then the "insert" and "point" query parameters
MUST be supported. If not, then these parameters are not applicable.
If the POST method succeeds, a "201 Created" status-line is returned If the POST method succeeds, a "201 Created" status-line is returned
and there is no response message-body. A "Location" header and there is no response message-body. A "Location" header
identifying the child resource that was created MUST be present in identifying the child resource that was created MUST be present in
the response in this case. the response in this case.
If the data resource already exists, then the POST request MUST fail
and a "409 Conflict" status-line MUST be returned.
If the user is not authorized to create the target resource, an error If the user is not authorized to create the target resource, an error
response containing a "403 Forbidden" or "404 Not Found" status-line response containing a "403 Forbidden" status-line SHOULD be returned.
is returned to the client. All other error responses are handled A server MAY return a "404 Not Found" status-line, as described in
section 6.5.3 in [RFC7231]. All other error responses are handled
according to the procedures defined in Section 7. according to the procedures defined in Section 7.
Example: Example:
To create a new "jukebox" resource, the client might send: To create a new "jukebox" resource, the client might send:
POST /restconf/data HTTP/1.1 POST /restconf/data HTTP/1.1
Host: example.com Host: example.com
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ "example-jukebox:jukebox" : [null] } { "example-jukebox:jukebox" : {} }
If the resource is created, the server might respond as follows. If the resource is created, the server might respond as follows.
Note that the "Location" header line is wrapped for display purposes Note that the "Location" header line is wrapped for display purposes
only: only:
HTTP/1.1 201 Created HTTP/1.1 201 Created
Date: Mon, 23 Apr 2012 17:01:00 GMT Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server Server: example-server
Location: https://example.com/restconf/data/ Location: https://example.com/restconf/data/
example-jukebox:jukebox example-jukebox:jukebox
skipping to change at page 31, line 46 skipping to change at page 38, line 50
If the target resource type is an operation resource, then the POST If the target resource type is an operation resource, then the POST
method is treated as a request to invoke that operation. The method is treated as a request to invoke that operation. The
message-body (if any) is processed as the operation input parameters. message-body (if any) is processed as the operation input parameters.
Refer to Section 3.6 for details on operation resources. Refer to Section 3.6 for details on operation resources.
If the POST request succeeds, a "200 OK" status-line is returned if If the POST request succeeds, a "200 OK" status-line is returned if
there is a response message-body, and a "204 No Content" status-line there is a response message-body, and a "204 No Content" status-line
is returned if there is no response message-body. is returned if there is no response message-body.
If the user is not authorized to invoke the target operation, an If the user is not authorized to invoke the target operation, an
error response containing a "403 Forbidden" or "404 Not Found" error response containing a "403 Forbidden" status-line is returned
status-line is returned to the client. All other error responses are to the client. All other error responses are handled according to
handled according to the procedures defined in Section 7. the procedures defined in Section 7.
Example: Example:
In this example, the client is invoking the "play" operation defined In this example, the client is invoking the "play" operation defined
in the "example-jukebox" YANG module. in the "example-jukebox" YANG module.
A client might send a "play" request as follows: A client might send a "play" request as follows:
POST /restconf/operations/example-jukebox:play HTTP/1.1 POST /restconf/operations/example-jukebox:play HTTP/1.1
Host: example.com Host: example.com
skipping to change at page 32, line 30 skipping to change at page 39, line 32
The server might respond: The server might respond:
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Date: Mon, 23 Apr 2012 17:50:00 GMT Date: Mon, 23 Apr 2012 17:50:00 GMT
Server: example-server Server: example-server
4.5. PUT 4.5. PUT
The PUT method is sent by the client to create or replace the target The PUT method is sent by the client to create or replace the target
resource. data resource. A request message-body MUST be present, representing
the new data resource, or the server MUST return "400 Bad Request"
status-line.
The only target resource media type that supports PUT is the data The only target resource media type that supports PUT is the data
resource. The message-body is expected to contain the content used resource. The message-body is expected to contain the content used
to create or replace the target resource. to create or replace the target resource.
The "insert" (Section 4.8.4) and "point" (Section 4.8.5) query The "insert" (Section 4.8.4) and "point" (Section 4.8.5) query
parameters are supported by the PUT method for data resources. parameters are supported by the PUT method for data resources.
Consistent with [RFC7231], if the PUT request creates a new resource, Consistent with [RFC7231], if the PUT request creates a new resource,
a "201 Created" status-line is returned. If an existing resource is a "201 Created" status-line is returned. If an existing resource is
modified, either "200 OK" or "204 No Content" are returned. modified, a "204 No Content" status-line is returned.
If the user is not authorized to create or replace the target If the user is not authorized to create or replace the target
resource an error response containing a "403 Forbidden" or "404 Not resource an error response containing a "403 Forbidden" status-line
Found" status-line is returned to the client. All other error SHOULD be returned. A server MAY return a "404 Not Found" status-
line, as described in section 6.5.3 in [RFC7231]. All other error
responses are handled according to the procedures defined in responses are handled according to the procedures defined in
Section 7. Section 7.
If the target resource represents a YANG leaf-list, then the PUT
method MUST not change the value of the leaf-list instance.
If the target resource represents a YANG list instance, then the PUT
method MUST NOT change any key leaf values in the message-body
representation.
If the server implements any YANG module that contains a
configuration data node that is "ordered-by" user, then the "insert"
and "point" query parameters MUST be supported. If not, then these
parameters are not applicable.
Example: Example:
An "album" child resource defined in the "example-jukebox" YANG An "album" child resource defined in the "example-jukebox" YANG
module is replaced or created if it does not already exist. module is replaced or created if it does not already exist.
To replace the "album" resource contents, the client might send as To replace the "album" resource contents, the client might send as
follows. Note that the request-line is wrapped for display purposes follows. Note that the request-line is wrapped for display purposes
only: only:
PUT /restconf/data/example-jukebox:jukebox/ PUT /restconf/data/example-jukebox:jukebox/
skipping to change at page 33, line 30 skipping to change at page 40, line 47
} }
If the resource is updated, the server might respond: If the resource is updated, the server might respond:
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Date: Mon, 23 Apr 2012 17:04:00 GMT Date: Mon, 23 Apr 2012 17:04:00 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 17:04:00 GMT Last-Modified: Mon, 23 Apr 2012 17:04:00 GMT
ETag: b27480aeda4c ETag: b27480aeda4c
The same request is shown here using XML encoding:
PUT /restconf/data/example-jukebox:jukebox/
library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
Host: example.com
Content-Type: application/yang.data+xml
<album xmlns="http://example.com/ns/example-jukebox"
xmlns:jbox="http://example.com/ns/example-jukebox">
<name>Wasting Light</name>
<genre>jbox:alternative</genre>
<year>2011</year>
</album>
4.6. PATCH 4.6. PATCH
RESTCONF uses the HTTP PATCH method defined in [RFC5789] to provide RESTCONF uses the HTTP PATCH method defined in [RFC5789] to provide
an extensible framework for resource patching mechanisms. It is an extensible framework for resource patching mechanisms. It is
optional to implement by the server. Each patch type needs a unique optional to implement by the server. Each patch mechanism needs a
media type. Zero or more PATCH media types MAY be supported by the unique media type. Zero or more patch media types MAY be supported
server. The media types supported by a server can be discovered by by the server. The media types supported by a server can be
the client by sending an OPTIONS request (see Section 4.1). discovered by the client by sending an OPTIONS request (see
Section 4.1).
This document defines one patch mechanism (Section 4.6.1). The YANG
PATCH mechanism is defined in [I-D.ietf-netconf-yang-patch]. Other
patch mechanisms may be defined by future specifications.
If the target resource instance does not exist, the server MUST NOT If the target resource instance does not exist, the server MUST NOT
create it. create it.
If the PATCH request succeeds, a "200 OK" status-line is returned if If the PATCH request succeeds, a "200 OK" status-line is returned if
there is a message-body, and "204 No Content" is returned if no there is a message-body, and "204 No Content" is returned if no
response message-body is sent. response message-body is sent.
If the user is not authorized to alter the target resource an error If the user is not authorized to alter the target resource an error
response containing a "403 Forbidden" or "404 Not Found" status-line response containing a "403 Forbidden" status-line SHOULD be returned.
is returned to the client. All other error responses are handled A server MAY return a "404 Not Found" status-line, as described in
section 6.5.3 in [RFC7231]. All other error responses are handled
according to the procedures defined in Section 7. according to the procedures defined in Section 7.
4.6.1. Plain Patch 4.6.1. Plain Patch
The plain patch mechanism merges the contents of the message body The plain patch mechanism merges the contents of the message body
with the target resource. If the target resource is a datastore with the target resource. If the target resource is a datastore
resource (see Section 3.4), the message body MUST be either resource (see Section 3.4), the message body MUST be either
application/yang.datastore+xml or application/yang.datastore+json. application/yang.datastore+xml or application/yang.datastore+json.
If then the target resource is a data resource (see Section 3.5), If then the target resource is a data resource (see Section 3.5),
then the message body MUST be either application/yang.data+xml or then the message body MUST be either application/yang.data+xml or
application/yang.data+json. application/yang.data+json.
Plain patch can used to create or update, but not delete, a child Plain patch can be used to create or update, but not delete, a child
resource within the target resource. Please see resource within the target resource. Please see
[I-D.ietf-netconf-yang-patch] for an alternate media-type supporting [I-D.ietf-netconf-yang-patch] for an alternate media-type supporting
more granular control. The YANG Patch Media Type allows multiple more granular control. The YANG Patch Media Type allows multiple
sub-operations (e.g., merge, delete) within a single PATCH operation. sub-operations (e.g., merge, delete) within a single PATCH operation.
If the target resource represents a YANG leaf-list, then the PATCH
method MUST not change the value of the leaf-list instance.
If the target resource represents a YANG list instance, then the
PATCH method MUST NOT change any key leaf values in the message-body
representation.
Example: Example:
To replace just the "year" field in the "album" resource (instead of To replace just the "year" field in the "album" resource (instead of
replacing the entire resource with the PUT method), the client might replacing the entire resource with the PUT method), the client might
send a plain patch as follows. Note that the request-line is wrapped send a plain patch as follows. Note that the request-line is wrapped
for display purposes only: for display purposes only:
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
skipping to change at page 35, line 6 skipping to change at page 43, line 6
Last-Modified: Mon, 23 Apr 2012 17:49:30 GMT Last-Modified: Mon, 23 Apr 2012 17:49:30 GMT
ETag: b2788923da4c ETag: b2788923da4c
4.7. DELETE 4.7. DELETE
The DELETE method is used to delete the target resource. If the The DELETE method is used to delete the target resource. If the
DELETE request succeeds, a "204 No Content" status-line is returned, DELETE request succeeds, a "204 No Content" status-line is returned,
and there is no response message-body. and there is no response message-body.
If the user is not authorized to delete the target resource then an If the user is not authorized to delete the target resource then an
error response containing a "403 Forbidden" or "404 Not Found" error response containing a "403 Forbidden" status-line SHOULD be
status-line is returned to the client. All other error responses are returned. A server MAY return a "404 Not Found" status-line, as
handled according to the procedures defined in Section 7. described in section 6.5.3 in [RFC7231]. All other error responses
are handled according to the procedures defined in Section 7.
If the target resource represents a YANG leaf-list or list, then the
PATCH method SHOULD NOT delete more than one such instance. The
server MAY delete more than one instance if a query parameter is used
requesting this behavior. (Definition of this query parameter is
outside the scope of this document.)
Example: Example:
To delete a resource such as the "album" resource, the client might To delete a resource such as the "album" resource, the client might
send: send:
DELETE /restconf/data/example-jukebox:jukebox/ DELETE /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
skipping to change at page 36, line 34 skipping to change at page 44, line 41
+-----------+-----------------------------------------------------+ +-----------+-----------------------------------------------------+
| Value | Description | | Value | Description |
+-----------+-----------------------------------------------------+ +-----------+-----------------------------------------------------+
| config | Return only configuration descendant data nodes | | config | Return only configuration descendant data nodes |
| nonconfig | Return only non-configuration descendant data nodes | | nonconfig | Return only non-configuration descendant data nodes |
| all | Return all descendant data nodes | | all | Return all descendant data nodes |
+-----------+-----------------------------------------------------+ +-----------+-----------------------------------------------------+
This parameter is only allowed for GET methods on datastore and data This parameter is only allowed for GET methods on datastore and data
resources. A 400 Bad Request error is returned if used for other resources. A "400 Bad Request" status-line is returned if used for
methods or resource types. other methods or resource types.
The default value is determined by the "config" statement value of
the requested data nodes. If the "config" value is "false", then the
default for the "content" parameter is "nonconfig". If "config" is
"true" then the default for the "content" parameter is "config".
If this query parameter is not present, the default value is "all".
This query parameter MUST be supported by the server. This query parameter MUST be supported by the server.
4.8.2. The "depth" Query Parameter 4.8.2. The "depth" Query Parameter
The "depth" parameter is used to specify the number of nest levels The "depth" parameter is used to specify the number of nest levels
returned in a response for a GET method. The first nest-level returned in a response for a GET method. The first nest-level
consists of the requested data node itself. If the "fields" consists of the requested data node itself. If the "fields"
parameter (Section 4.8.3) is used to select descendant data nodes, parameter (Section 4.8.3) is used to select descendant data nodes,
these nodes all have a depth value of 1. Any child nodes which are these nodes all have a depth value of 1. This has the effect of
contained within a parent node have a depth value that is 1 greater including the nodes specified by the fields, even if the "depth"
than its parent. value is less than the actual depth level of the specified fields.
Any child nodes which are contained within a parent node have a depth
value that is 1 greater than its parent.
The value of the "depth" parameter is either an integer between 1 and The value of the "depth" parameter is either an integer between 1 and
65535, or the string "unbounded". "unbounded" is the default. 65535, or the string "unbounded". "unbounded" is the default.
This parameter is only allowed for GET methods on API, datastore, and This parameter is only allowed for GET methods on API, datastore, and
data resources. A 400 Bad Request error is returned if it used for data resources. A "400 Bad Request" status-line is returned if it
other methods or resource types. used for other methods or resource types.
More than one "depth" query parameter MUST NOT appear in a request.
If more than one instance is present, then a "400 Bad Request"
status-line MUST be returned by the server.
By default, the server will include all sub-resources within a By default, the server will include all sub-resources within a
retrieved resource, which have the same resource type as the retrieved resource, which have the same resource type as the
requested resource. Only one level of sub-resources with a different requested resource. Only one level of sub-resources with a different
media type than the target resource will be returned. media type than the target resource will be returned.
If the "depth" query parameter URI is listed in the "capability" If the "depth" query parameter URI is listed in the "capability"
leaf-list in Section 9.3, then the server supports the "depth" query leaf-list in Section 9.3, then the server supports the "depth" query
parameter. parameter.
skipping to change at page 38, line 15 skipping to change at page 46, line 20
For example, assume the target resource is the "album" list. To For example, assume the target resource is the "album" list. To
retrieve only the "label" and "catalogue-number" of the "admin" retrieve only the "label" and "catalogue-number" of the "admin"
container within an album, use: container within an album, use:
"fields=admin(label;catalogue-number)". "fields=admin(label;catalogue-number)".
"/" is used in a path to retrieve a child node of a node. For "/" is used in a path to retrieve a child node of a node. For
example, to retrieve only the "label" of an album, use: "fields=admin example, to retrieve only the "label" of an album, use: "fields=admin
/label". /label".
This parameter is only allowed for GET methods on api, datastore, and This parameter is only allowed for GET methods on api, datastore, and
data resources. A 400 Bad Request error is returned if used for data resources. A "400 Bad Request" status-line is returned if used
other methods or resource types. for other methods or resource types.
More than one "fields" query parameter MUST NOT appear in a request.
If more than one instance is present, then a "400 Bad Request"
status-line MUST be returned by the server.
If the "fields" query parameter URI is listed in the "capability" If the "fields" query parameter URI is listed in the "capability"
leaf-list in Section 9.3, then the server supports the "fields" leaf-list in Section 9.3, then the server supports the "fields"
parameter. parameter.
4.8.4. The "insert" Query Parameter 4.8.4. The "insert" Query Parameter
The "insert" parameter is used to specify how a resource should be The "insert" parameter is used to specify how a resource should be
inserted within a user-ordered list. inserted within a user-ordered list.
skipping to change at page 38, line 47 skipping to change at page 47, line 7
| | specified by the value of the "point" parameter. | | | specified by the value of the "point" parameter. |
+-----------+-------------------------------------------------------+ +-----------+-------------------------------------------------------+
The default value is "last". The default value is "last".
This parameter is only supported for the POST and PUT methods. It is This parameter is only supported for the POST and PUT methods. It is
also only supported if the target resource is a data resource, and also only supported if the target resource is a data resource, and
that data represents a YANG list or leaf-list that is ordered by the that data represents a YANG list or leaf-list that is ordered by the
user. user.
More than one "insert" query parameter MUST NOT appear in a request.
If more than one instance is present, then a "400 Bad Request"
status-line MUST be returned by the server.
If the values "before" or "after" are used, then a "point" query If the values "before" or "after" are used, then a "point" query
parameter for the insertion parameter MUST also be present, or a 400 parameter for the insertion parameter MUST also be present, or a "400
Bad Request error is returned. Bad Request" status-line is returned.
The "insert" query parameter MUST be supported by the server. The "insert" query parameter MUST be supported by the server.
4.8.5. The "point" Query Parameter 4.8.5. The "point" Query Parameter
The "point" parameter is used to specify the insertion point for a The "point" parameter is used to specify the insertion point for a
data resource that is being created or moved within a user ordered data resource that is being created or moved within a user ordered
list or leaf-list. list or leaf-list.
The value of the "point" parameter is a string that identifies the The value of the "point" parameter is a string that identifies the
path to the insertion point object. The format is the same as a path to the insertion point object. The format is the same as a
target resource URI string. target resource URI string.
This parameter is only supported for the POST and PUT methods. It is This parameter is only supported for the POST and PUT methods. It is
also only supported if the target resource is a data resource, and also only supported if the target resource is a data resource, and
that data represents a YANG list or leaf-list that is ordered by the that data represents a YANG list or leaf-list that is ordered by the
user. user.
If the "insert" query parameter is not present, or has a value other If the "insert" query parameter is not present, or has a value other
than "before" or "after", then a 400 Bad Request error is returned. than "before" or "after", then a "400 Bad Request" status-line is
returned.
More than one "point" query parameter MUST NOT appear in a request.
If more than one instance is present, then a "400 Bad Request"
status-line MUST be returned by the server.
This parameter contains the instance identifier of the resource to be This parameter contains the instance identifier of the resource to be
used as the insertion point for a POST or PUT method. used as the insertion point for a POST or PUT method.
The "point" query parameter MUST be supported by the server. The "point" query parameter MUST be supported by the server.
4.8.6. The "filter" Query Parameter 4.8.6. The "filter" Query Parameter
The "filter" parameter is used to indicate which subset of all The "filter" parameter is used to indicate which subset of all
possible events are of interest. If not present, all events not possible events are of interest. If not present, all events not
precluded by other parameters will be sent. precluded by other parameters will be sent.
This parameter is only allowed for GET methods on a text/event-stream This parameter is only allowed for GET methods on a text/event-stream
data resource. A 400 Bad Request error is returned if used for other data resource. A "400 Bad Request" status-line is returned if used
methods or resource types. for other methods or resource types.
The format of this parameter is an XPath 1.0 expression, and is The format of this parameter is an XPath 1.0 expression, and is
evaluated in the following context: evaluated in the following context:
o The set of namespace declarations is the set of prefix and o The set of namespace declarations is the set of prefix and
namespace pairs for all supported YANG modules, where the prefix namespace pairs for all supported YANG modules, where the prefix
is the YANG module name, and the namespace is as defined by the is the YANG module name, and the namespace is as defined by the
"namespace" statement in the YANG module. "namespace" statement in the YANG module.
o The function library is the core function library defined in XPath o The function library is the core function library defined in XPath
1.0. 1.0.
o The set of variable bindings is empty. o The set of variable bindings is empty.
o The context node is the root node. o The context node is the root node.
More than one "filter" query parameter MUST NOT appear in a request.
If more than one instance is present, then a "400 Bad Request"
status-line MUST be returned by the server.
The filter is used as defined in [RFC5277], Section 3.6. If the The filter is used as defined in [RFC5277], Section 3.6. If the
boolean result of the expression is true when applied to the boolean result of the expression is true when applied to the
conceptual "notification" document root, then the event notification conceptual "notification" document root, then the event notification
is delivered to the client. is delivered to the client.
If the "filter" query parameter URI is listed in the "capability" If the "filter" query parameter URI is listed in the "capability"
leaf-list in Section 9.3, then the server supports the "filter" query leaf-list in Section 9.3, then the server supports the "filter" query
parameter. parameter.
4.8.7. The "start-time" Query Parameter 4.8.7. The "start-time" Query Parameter
The "start-time" parameter is used to trigger the notification replay The "start-time" parameter is used to trigger the notification replay
feature and indicate that the replay should start at the time feature and indicate that the replay should start at the time
specified. If the stream does not support replay, per the specified. If the stream does not support replay, per the
"replay-support" attribute returned by stream list entry for the "replay-support" attribute returned by stream list entry for the
stream resource, then the server MUST return the HTTP error code 400 stream resource, then the server MUST return a "400 Bad Request"
Bad Request. status-line.
The value of the "start-time" parameter is of type "date-and-time", The value of the "start-time" parameter is of type "date-and-time",
defined in the "ietf-yang" YANG module [RFC6991]. defined in the "ietf-yang" YANG module [RFC6991].
This parameter is only allowed for GET methods on a text/event-stream This parameter is only allowed for GET methods on a text/event-stream
data resource. A 400 Bad Request error is returned if used for other data resource. A "400 Bad Request" status-line is returned if used
methods or resource types. for other methods or resource types.
More than one "start-time" query parameter MUST NOT appear in a
request. If more than one instance is present, then a "400 Bad
Request" status-line MUST be returned by the server.
If this parameter is not present, then a replay subscription is not If this parameter is not present, then a replay subscription is not
being requested. It is not valid to specify start times that are being requested. It is not valid to specify start times that are
later than the current time. If the value specified is earlier than later than the current time. If the value specified is earlier than
the log can support, the replay will begin with the earliest the log can support, the replay will begin with the earliest
available notification. available notification.
If this query parameter is supported by the server, then the "replay" If this query parameter is supported by the server, then the "replay"
query parameter URI MUST be listed in the "capability" leaf-list in query parameter URI MUST be listed in the "capability" leaf-list in
Section 9.3. The "stop-time" query parameter MUST also be supported Section 9.3. The "stop-time" query parameter MUST also be supported
skipping to change at page 41, line 6 skipping to change at page 49, line 34
4.8.8. The "stop-time" Query Parameter 4.8.8. The "stop-time" Query Parameter
The "stop-time" parameter is used with the replay feature to indicate The "stop-time" parameter is used with the replay feature to indicate
the newest notifications of interest. This parameter MUST be used the newest notifications of interest. This parameter MUST be used
with and have a value later than the "start-time" parameter. with and have a value later than the "start-time" parameter.
The value of the "stop-time" parameter is of type "date-and-time", The value of the "stop-time" parameter is of type "date-and-time",
defined in the "ietf-yang" YANG module [RFC6991]. defined in the "ietf-yang" YANG module [RFC6991].
This parameter is only allowed for GET methods on a text/event-stream This parameter is only allowed for GET methods on a text/event-stream
data resource. A 400 Bad Request error is returned if used for other data resource. A "400 Bad Request" status-line is returned if used
methods or resource types. for other methods or resource types.
More than one "stop-time" query parameter MUST NOT appear in a
request. If more than one instance is present, then a "400 Bad
Request" status-line MUST be returned by the server.
If this parameter is not present, the notifications will continue If this parameter is not present, the notifications will continue
until the subscription is terminated. Values in the future are until the subscription is terminated. Values in the future are
valid. valid.
If this query parameter is supported by the server, then the "replay" If this query parameter is supported by the server, then the "replay"
query parameter URI MUST be listed in the "capability" leaf-list in query parameter URI MUST be listed in the "capability" leaf-list in
Section 9.3. The "start-time" query parameter MUST also be supported Section 9.3. The "start-time" query parameter MUST also be supported
by the server. by the server.
skipping to change at page 41, line 38 skipping to change at page 50, line 21
If the server supports this capability, then it MUST implement the If the server supports this capability, then it MUST implement the
behavior in Section 4.5.1 of [RFC6243], except applied to the behavior in Section 4.5.1 of [RFC6243], except applied to the
RESTCONF GET operation, instead of the NETCONF operations. RESTCONF GET operation, instead of the NETCONF operations.
+---------------------------+---------------------------------------+ +---------------------------+---------------------------------------+
| Value | Description | | Value | Description |
+---------------------------+---------------------------------------+ +---------------------------+---------------------------------------+
| report-all | All data nodes are reported | | report-all | All data nodes are reported |
| trim | Data nodes set to the YANG default | | trim | Data nodes set to the YANG default |
| | are not reported | | | are not reported |
| explicit | Data nodes set by the client are not | | explicit | Data nodes set to the YANG default by |
| | reported | | | the client are reported |
| report-all-tagged | All data nodes are reported and | | report-all-tagged | All data nodes are reported and |
| | defaults are tagged | | | defaults are tagged |
+---------------------------+---------------------------------------+ +---------------------------+---------------------------------------+
If the "with-defaults" parameter is set to "report-all" then the If the "with-defaults" parameter is set to "report-all" then the
server MUST adhere to the defaults reporting behavior defined in server MUST adhere to the defaults reporting behavior defined in
Section 3.1 of [RFC6243]. Section 3.1 of [RFC6243].
If the "with-defaults" parameter is set to "trim" then the server If the "with-defaults" parameter is set to "trim" then the server
MUST adhere to the defaults reporting behavior defined in Section 3.2 MUST adhere to the defaults reporting behavior defined in Section 3.2
of [RFC6243]. of [RFC6243].
If the "with-defaults" parameter is set to "explicit" then the server If the "with-defaults" parameter is set to "explicit" then the server
MUST adhere to the defaults reporting behavior defined in Section 3.3 MUST adhere to the defaults reporting behavior defined in Section 3.3
of [RFC6243]. of [RFC6243].
If the "with-defaults" parameter is set to "report-all-tagged" then If the "with-defaults" parameter is set to "report-all-tagged" then
the server MUST adhere to the defaults reporting behavior defined in the server MUST adhere to the defaults reporting behavior defined in
Section 3.4 of [RFC6243]. Section 3.4 of [RFC6243].
More than one "with-defaults" query parameter MUST NOT appear in a
request. If more than one instance is present, then a "400 Bad
Request" status-line MUST be returned by the server.
If the "with-defaults" parameter is not present then the server MUST If the "with-defaults" parameter is not present then the server MUST
adhere to the defaults reporting behavior defined in its "basic-mode" adhere to the defaults reporting behavior defined in its "basic-mode"
parameter for the "defaults" protocol capability URI, defined in parameter for the "defaults" protocol capability URI, defined in
Section 9.1.2. Section 9.1.2.
If the server includes the "with-defaults" query parameter URI in the If the server includes the "with-defaults" query parameter URI in the
"capability" leaf-list in Section 9.3, then the "with-defaults" query "capability" leaf-list in Section 9.3, then the "with-defaults" query
parameter MUST be supported. parameter MUST be supported.
5. Messages 5. Messages
skipping to change at page 42, line 48 skipping to change at page 51, line 35
<OP> /<restconf>/<path>?<query>#<fragment> <OP> /<restconf>/<path>?<query>#<fragment>
^ ^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | | | |
method entry resource query fragment method entry resource query fragment
M M O O I M M O O I
M=mandatory, O=optional, I=ignored M=mandatory, O=optional, I=ignored
<text> replaced by client with real values where:
<OP> is the HTTP method
<restconf> is the RESTCONF entry point
<path> is the Target Resource URI
<query> is the query parameter list
<fragment> is not used in RESTCONF
o method: the HTTP method identifying the RESTCONF operation o method: the HTTP method identifying the RESTCONF operation
requested by the client, to act upon the target resource specified requested by the client, to act upon the target resource specified
in the request URI. RESTCONF operation details are described in in the request URI. RESTCONF operation details are described in
Section 4. Section 4.
o entry: the root of the RESTCONF API configured on this HTTP o entry: the root of the RESTCONF API configured on this HTTP
server, discovered by getting the ".well-known/host-meta" server, discovered by getting the "/.well-known/host-meta"
resource, as described in Section 3.1. resource, as described in Section 3.1.
o resource: the path expression identifying the resource that is o resource: the path expression identifying the resource that is
being accessed by the operation. If this field is not present, being accessed by the operation. If this field is not present,
then the target resource is the API itself, represented by the then the target resource is the API itself, represented by the
media type "application/yang.api". media type "application/yang.api".
o query: the set of parameters associated with the RESTCONF message. o query: the set of parameters associated with the RESTCONF message.
These have the familiar form of "name=value" pairs. Most query These have the familiar form of "name=value" pairs. Most query
parameters are optional to implement by the server and optional to parameters are optional to implement by the server and optional to
skipping to change at page 43, line 36 skipping to change at page 52, line 27
There is a specific set of parameters defined, although the server There is a specific set of parameters defined, although the server
MAY choose to support query parameters not defined in this document. MAY choose to support query parameters not defined in this document.
The contents of the any query parameter value MUST be encoded The contents of the any query parameter value MUST be encoded
according to [RFC3986], Section 3.4. Any reserved characters MUST be according to [RFC3986], Section 3.4. Any reserved characters MUST be
percent-encoded, according to [RFC3986], section 2.1. percent-encoded, according to [RFC3986], section 2.1.
o fragment: This field is not used by the RESTCONF protocol. o fragment: This field is not used by the RESTCONF protocol.
When new resources are created by the client, a "Location" header is When new resources are created by the client, a "Location" header is
returned, which identifies the path of the newly created resource. returned, which identifies the path of the newly created resource.
The client MUST use this exact path identifier to access the resource The client uses this exact path identifier to access the resource
once it has been created. once it has been created.
The "target" of an operation is a resource. The "path" field in the The "target" of an operation is a resource. The "path" field in the
request URI represents the target resource for the operation. request URI represents the target resource for the operation.
5.2. Message Headers Refer to Appendix D for examples of RESTCONF Request URIs.
There are several HTTP header lines utilized in RESTCONF messages.
Messages are not limited to the HTTP headers listed in this section.
HTTP defines which header lines are required for particular
circumstances. Refer to each operation definition section in
Section 4 for examples on how particular headers are used.
There are some request headers that are used within RESTCONF, usually
applied to data resources. The following tables summarize the
headers most relevant in RESTCONF message requests:
+-----------------------------+-------------------------------------+
| Name | Description |
+-----------------------------+-------------------------------------+
| Accept | Response Content-Types that are |
| | acceptable |
| Content-Type | The media type of the request body |
| Host | The host address of the server |
| If-Match | Only perform the action if the |
| | entity matches ETag |
| If-Modified-Since | Only perform the action if modified |
| | since time |
| If-Unmodified-Since | Only perform the action if un- |
| | modified since time |
+-----------------------------+-------------------------------------+
RESTCONF Request Headers
The following tables summarize the headers most relevant in RESTCONF
message responses:
+-----------------------+-------------------------------------------+
| Name | Description |
+-----------------------+-------------------------------------------+
| Allow | Valid actions when 405 error returned |
| Cache-Control | The cache control parameters for the |
| | response |
| Content-Type | The media type of the response message- |
| | body |
| Date | The date and time the message was sent |
| ETag | An identifier for a specific version of a |
| | resource |
| Last-Modified | The last modified date and time of a |
| | resource |
| Location | The resource identifier for a newly |
| | created resource |
+-----------------------+-------------------------------------------+
RESTCONF Response Headers
5.3. Message Encoding 5.2. Message Encoding
RESTCONF messages are encoded in HTTP according to [RFC7230]. The RESTCONF messages are encoded in HTTP according to [RFC7230]. The
"utf-8" character set is used for all messages. RESTCONF message "utf-8" character set is used for all messages. RESTCONF message
content is sent in the HTTP message-body. content is sent in the HTTP message-body.
Content is encoded in either JSON or XML format. A server MUST Content is encoded in either JSON or XML format. A server MUST
support XML or JSON encoding. XML encoding rules for data nodes are support XML or JSON encoding. XML encoding rules for data nodes are
defined in [I-D.ietf-netmod-rfc6020bis]. The same encoding rules are defined in [I-D.ietf-netmod-rfc6020bis]. The same encoding rules are
used for all XML content. JSON encoding rules are defined in used for all XML content. JSON encoding rules are defined in
[I-D.ietf-netmod-yang-json]. JSON encoding of meta-data is defined [I-D.ietf-netmod-yang-json]. JSON encoding of meta-data is defined
in [I-D.ietf-netmod-yang-metadata]. This encoding is valid JSON, but in [I-D.ietf-netmod-yang-metadata]. This encoding is valid JSON, but
also has special encoding rules to identify module namespaces and also has special encoding rules to identify module namespaces and
provide consistent type processing of YANG data. provide consistent type processing of YANG data.
Request input content encoding format is identified with the Content- Request input content encoding format is identified with the Content-
Type header. This field MUST be present if a message-body is sent by Type header. This field MUST be present if a message-body is sent by
the client. the client.
The server MUST support the "Accept" header and "406 Not Acceptable" The server MUST support the "Accept" header and "406 Not Acceptable"
status code, as defined in [RFC7231]. Response output content status-line, as defined in [RFC7231]. Response output content
encoding format is identified with the Accept header in the request. encoding format is identified with the Accept header in the request.
If is not specified, the request input encoding format is used. If If it is not specified, the request input encoding format SHOULD be
there was no request input, then the default output encoding is XML used, or the server MAY choose any supported content encoding format.
or JSON, depending or server preference. File extensions encoded in
the request are not used to identify format encoding.
5.4. RESTCONF Meta-Data If there was no request input, then the default output encoding is
XML or JSON, depending on server preference. File extensions encoded
in the request are not used to identify format encoding.
5.3. RESTCONF Meta-Data
The RESTCONF protocol needs to retrieve the same meta-data that is The RESTCONF protocol needs to retrieve the same meta-data that is
used in the NETCONF protocol. Information about default leafs, last- used in the NETCONF protocol. Information about default leafs, last-
modified timestamps, etc. are commonly used to annotate modified timestamps, etc. are commonly used to annotate
representations of the datastore contents. This meta-data is not representations of the datastore contents. This meta-data is not
defined in the YANG schema because it applies to the datastore, and defined in the YANG schema because it applies to the datastore, and
is common across all data nodes. is common across all data nodes.
This information is encoded as attributes in XML. JSON encoding of This information is encoded as attributes in XML. JSON encoding of
meta-data is defined in [I-D.ietf-netmod-yang-metadata]. meta-data is defined in [I-D.ietf-netmod-yang-metadata].
The following examples are based on the example in Appendix D.3.9. The following examples are based on the example in Appendix D.3.9.
The "report-all-tagged" mode for the "with-defaults" query parameter The "report-all-tagged" mode for the "with-defaults" query parameter
requires that a "default" attribute be returned for default nodes. requires that a "default" attribute be returned for default nodes.
This example shows that attribute for the "mtu" leaf . This example shows that attribute for the "mtu" leaf .
5.4.1. XML MetaData Encoding Example 5.3.1. XML MetaData Encoding Example
GET /restconf/data/interfaces/interface=eth1 GET /restconf/data/interfaces/interface=eth1
?with-defaults=report-all-tagged HTTP/1.1 ?with-defaults=report-all-tagged HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+xml Accept: application/yang.data+xml
The server might respond as follows. The server might respond as follows.
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server Server: example-server
Content-Type: application/yang.data+xml Content-Type: application/yang.data+xml
skipping to change at page 46, line 23 skipping to change at page 54, line 5
Content-Type: application/yang.data+xml Content-Type: application/yang.data+xml
<interface <interface
xmlns="urn:example.com:params:xml:ns:yang:example-interface"> xmlns="urn:example.com:params:xml:ns:yang:example-interface">
<name>eth1</name> <name>eth1</name>
<mtu xmlns:wd="urn:ietf:params:xml:ns:netconf:default:1.0" <mtu xmlns:wd="urn:ietf:params:xml:ns:netconf:default:1.0"
wd:default="true">1500</mtu> wd:default="true">1500</mtu>
<status>up</status> <status>up</status>
</interface> </interface>
5.4.2. JSON MetaData Encoding Example 5.3.2. JSON MetaData Encoding Example
Note that RFC 6243 defines the "default" attribute with XSD, not Note that RFC 6243 defines the "default" attribute with XSD, not
YANG, so the YANG module name has to be assigned manually. The value YANG, so the YANG module name has to be assigned manually. The value
"ietf-netconf-with-defaults" is assigned for JSON meta-data encoding. "ietf-netconf-with-defaults" is assigned for JSON meta-data encoding.
GET /restconf/data/interfaces/interface=eth1 GET /restconf/data/interfaces/interface=eth1
?with-defaults=report-all-tagged HTTP/1.1 ?with-defaults=report-all-tagged HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+json Accept: application/yang.data+json
skipping to change at page 47, line 5 skipping to change at page 54, line 36
"name" : "eth1", "name" : "eth1",
"mtu" : 1500, "mtu" : 1500,
"@mtu": { "@mtu": {
"ietf-netconf-with-defaults:default" : true "ietf-netconf-with-defaults:default" : true
}, },
"status" : "up" "status" : "up"
} }
] ]
} }
5.5. Return Status 5.4. Return Status
Each message represents some sort of resource access. An HTTP Each message represents some sort of resource access. An HTTP
"status-line" header line is returned for each request. If a 4xx or "status-line" header line is returned for each request. If a 4xx or
5xx range status code is returned in the status-line, then the error 5xx range status code is returned in the status-line, then the error
information will be returned in the response, according to the format information will be returned in the response, according to the format
defined in Section 7.1. defined in Section 7.1.
5.6. Message Caching 5.5. Message Caching
Since the datastore contents change at unpredictable times, responses Since the datastore contents change at unpredictable times, responses
from a RESTCONF server generally SHOULD NOT be cached. from a RESTCONF server generally SHOULD NOT be cached.
The server SHOULD include a "Cache-Control" header in every response The server SHOULD include a "Cache-Control" header in every response
that specifies whether the response should be cached. A "Pragma" that specifies whether the response should be cached. A "Pragma"
header specifying "no-cache" MAY also be sent in case the header specifying "no-cache" MAY also be sent in case the
"Cache-Control" header is not supported. "Cache-Control" header is not supported.
Instead of using HTTP caching, the client SHOULD track the "ETag" and Instead of relying on HTTP caching, the client SHOULD track the
/or "Last-Modified" headers returned by the server for the datastore "ETag" and/or "Last-Modified" headers returned by the server for the
resource (or data resource if the server supports it). A retrieval datastore resource (or data resource if the server supports it). A
request for a resource can include the "If-None-Match" and/or retrieval request for a resource can include the "If-None-Match" and/
"If-Modified-Since" headers, which will cause the server to return a or "If-Modified-Since" headers, which will cause the server to return
"304 Not Modified" status-line if the resource has not changed. The a "304 Not Modified" status-line if the resource has not changed.
client MAY use the HEAD method to retrieve just the message headers, The client MAY use the HEAD method to retrieve just the message
which SHOULD include the "ETag" and "Last-Modified" headers, if this headers, which SHOULD include the "ETag" and "Last-Modified" headers,
meta-data is maintained for the target resource. if this meta-data is maintained for the target resource.
6. Notifications 6. Notifications
The RESTCONF protocol supports YANG-defined event notifications. The The RESTCONF protocol supports YANG-defined event notifications. The
solution preserves aspects of NETCONF Event Notifications [RFC5277] solution preserves aspects of NETCONF Event Notifications [RFC5277]
while utilizing the Server-Sent Events [W3C.CR-eventsource-20121211] while utilizing the Server-Sent Events [W3C.CR-eventsource-20121211]
transport strategy. transport strategy.
6.1. Server Support 6.1. Server Support
A RESTCONF server is not required to support RESTCONF notifications. A RESTCONF server MAY support RESTCONF notifications. Clients may
Clients may determine if a server supports RESTCONF notifications by determine if a server supports RESTCONF notifications by using the
using the HTTP operation OPTIONS, HEAD, or GET on the stream list. HTTP operation OPTIONS, HEAD, or GET on the stream list. The server
The server does not support RESTCONF notifications if an HTTP error does not support RESTCONF notifications if an HTTP error code is
code is returned (e.g., 404 Not Found). returned (e.g., "404 Not Found" status-line).
6.2. Event Streams 6.2. Event Streams
A RESTCONF server that supports notifications will populate a stream A RESTCONF server that supports notifications will populate a stream
resource for each notification delivery service access point. A resource for each notification delivery service access point. A
RESTCONF client can retrieve the list of supported event streams from RESTCONF client can retrieve the list of supported event streams from
a RESTCONF server using the GET operation on the stream list. a RESTCONF server using the GET operation on the stream list.
The "restconf-state/streams" container definition in the The "restconf-state/streams" container definition in the
"ietf-restconf-monitoring" module (defined in Section 9.3) is used to "ietf-restconf-monitoring" module (defined in Section 9.3) is used to
skipping to change at page 51, line 40 skipping to change at page 60, line 15
Two child nodes within the "notification" container are expected, Two child nodes within the "notification" container are expected,
representing the event time and the event payload. The "event-time" representing the event time and the event payload. The "event-time"
node is defined within the "ietf-restconf" module namespace. The node is defined within the "ietf-restconf" module namespace. The
name and namespace of the payload element are determined by the YANG name and namespace of the payload element are determined by the YANG
module containing the notification-stmt. module containing the notification-stmt.
In the following example, the YANG module "example-mod" is used: In the following example, the YANG module "example-mod" is used:
module example-mod { module example-mod {
namespace "http://example.com/event/1.0"; namespace "http://example.com/event/1.0";
prefix ex;
notification event { notification event {
leaf event-class { type string; } leaf event-class { type string; }
container reporting-entity { container reporting-entity {
leaf card { type string; } leaf card { type string; }
} }
leaf severity { type string; } leaf severity { type string; }
} }
} }
skipping to change at page 53, line 29 skipping to change at page 62, line 4
The following table summarizes the return status codes used The following table summarizes the return status codes used
specifically by RESTCONF operations: specifically by RESTCONF operations:
+----------------------------+--------------------------------------+ +----------------------------+--------------------------------------+
| Status-Line | Description | | Status-Line | Description |
+----------------------------+--------------------------------------+ +----------------------------+--------------------------------------+
| 100 Continue | POST accepted, 201 should follow | | 100 Continue | POST accepted, 201 should follow |
| 200 OK | Success with response message-body | | 200 OK | Success with response message-body |
| 201 Created | POST to create a resource success | | 201 Created | POST to create a resource success |
| 202 Accepted | POST to create a resource accepted |
| 204 No Content | Success without response message- | | 204 No Content | Success without response message- |
| | body | | | body |
| 304 Not Modified | Conditional operation not done | | 304 Not Modified | Conditional operation not done |
| 400 Bad Request | Invalid request message | | 400 Bad Request | Invalid request message |
| 401 Unauthorized | Client cannot be authenticated |
| 403 Forbidden | Access to resource denied | | 403 Forbidden | Access to resource denied |
| 404 Not Found | Resource target or resource node not | | 404 Not Found | Resource target or resource node not |
| | found | | | found |
| 405 Method Not Allowed | Method not allowed for target | | 405 Method Not Allowed | Method not allowed for target |
| | resource | | | resource |
| 409 Conflict | Resource or lock in use | | 409 Conflict | Resource or lock in use |
| 412 Precondition Failed | Conditional method is false | | 412 Precondition Failed | Conditional method is false |
| 413 Request Entity Too | too-big error | | 413 Request Entity Too | too-big error |
| Large | | | Large | |
| 414 Request-URI Too Large | too-big error | | 414 Request-URI Too Large | too-big error |
| 415 Unsupported Media Type | non RESTCONF media type | | 415 Unsupported Media Type | non RESTCONF media type |
| 500 Internal Server Error | operation-failed | | 500 Internal Server Error | operation-failed |
| 501 Not Implemented | unknown-operation | | 501 Not Implemented | unknown-operation |
| 503 Service Unavailable | Recoverable server error | | 503 Service Unavailable | Recoverable server error |
+----------------------------+--------------------------------------+ +----------------------------+--------------------------------------+
HTTP Status Codes used in RESTCONF HTTP Status Codes used in RESTCONF
Since an operation resource is defined with a YANG "action" or "rpc" Since an operation resource is defined with a YANG "rpc" statement,
statement, a mapping between the NETCONF <error-tag> value and the and an action is defined with a YANG "action" statement, a mapping
HTTP status code is needed. The specific error condition and between the NETCONF <error-tag> value and the HTTP status code is
response code to use are data-model specific and might be contained needed. The specific error condition and response code to use are
in the YANG "description" statement for the "action" or "rpc" data-model specific and might be contained in the YANG "description"
statement. statement for the "action" or "rpc" statement.
+-------------------------+-------------+ +-------------------------+-------------+
| <error&#8209;tag> | status code | | <error&#8209;tag> | status code |
+-------------------------+-------------+ +-------------------------+-------------+
| in-use | 409 | | in-use | 409 |
| invalid-value | 400 | | invalid-value | 400 |
| too-big | 413 | | too-big | 413 |
| missing-attribute | 400 | | missing-attribute | 400 |
| bad-attribute | 400 | | bad-attribute | 400 |
| unknown-attribute | 400 | | unknown-attribute | 400 |
skipping to change at page 54, line 41 skipping to change at page 63, line 15
| operation-failed | 500 | | operation-failed | 500 |
| partial-operation | 500 | | partial-operation | 500 |
| malformed-message | 400 | | malformed-message | 400 |
+-------------------------+-------------+ +-------------------------+-------------+
Mapping from error-tag to status code Mapping from error-tag to status code
7.1. Error Response Message 7.1. Error Response Message
When an error occurs for a request message on a data resource or an When an error occurs for a request message on a data resource or an
operation resource, and a "4xx" class of status codes (except for operation resource, and a "4xx" class of status codes will be
status code "403 Forbidden"), then the server SHOULD send a response returned (except for status code "403 Forbidden"), then the server
message-body containing the information described by the "errors" SHOULD send a response message-body containing the information
container definition within the YANG module Section 8. The Content- described by the "errors" container definition within the YANG module
Type of this response message MUST be application/yang.errors (see Section 8. The Content-Type of this response message MUST be
example below). application/yang.errors (see example below).
The client MAY specify the desired encoding for error messages by The client MAY specify the desired encoding for error messages by
specifying the appropriate media-type in the Accept header. If no specifying the appropriate media-type in the Accept header. If no
error media is specified, then the media type of the request message error media is specified, then the media type of the request message
is used. If there is no request message the server MUST select SHOULD be used, or the server MAY choose any supported message
"application/yang.errors+xml" or "application/yang.errors+json", encoding format. If there is no request message the server MUST
depending on server preference. All of the examples in this select "application/yang.errors+xml" or "application/
document, except for the one below, assume that XML encoding will be yang.errors+json", depending on server preference. All of the
returned if there is an error. examples in this document, except for the one below, assume that XML
encoding will be returned if there is an error.
YANG Tree Diagram for <errors> data: YANG Tree Diagram for <errors> data:
+--ro errors +--ro errors
+--ro error* +--ro error*
+--ro error-type enumeration +--ro error-type enumeration
+--ro error-tag string +--ro error-tag string
+--ro error-app-tag? string +--ro error-app-tag? string
+--ro error-path? instance-identifier +--ro error-path? instance-identifier
+--ro error-message? string +--ro error-message? string
skipping to change at page 56, line 32 skipping to change at page 65, line 7
Date: Mon, 23 Apr 2012 17:11:00 GMT Date: Mon, 23 Apr 2012 17:11:00 GMT
Server: example-server Server: example-server
Content-Type: application/yang.errors+xml Content-Type: application/yang.errors+xml
<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"> <errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error> <error>
<error-type>protocol</error-type> <error-type>protocol</error-type>
<error-tag>data-exists</error-tag> <error-tag>data-exists</error-tag>
<error-path <error-path
xmlns:rc="urn:ietf:params:xml:ns:yang:ietf-restconf" xmlns:rc="urn:ietf:params:xml:ns:yang:ietf-restconf"
xmlns:jb="https://example.com/ns/example-jukebox"> xmlns:jbox="https://example.com/ns/example-jukebox">
/rc:restconf/rc:data/jb:jukebox /rc:restconf/rc:data/jbox:jukebox
</error-path> </error-path>
<error-message> <error-message>
Data already exists, cannot create new resource Data already exists, cannot create new resource
</error-message> </error-message>
</error> </error>
</errors> </errors>
8. RESTCONF module 8. RESTCONF module
The "ietf-restconf" module defines conceptual definitions within an The "ietf-restconf" module defines conceptual definitions within an
extension and two groupings, which are not meant to be implemented as extension and two groupings, which are not meant to be implemented as
datastore contents by a server. E.g., the "restconf" container is datastore contents by a server. E.g., the "restconf" container is
not intended to be implemented as a top-level data node (under the "/ not intended to be implemented as a top-level data node (under the "/
restconf/data" entry point). restconf/data" entry point).
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-restconf@2015-10-18.yang" <CODE BEGINS> file "ietf-restconf@2016-03-16.yang"
module ietf-restconf { module ietf-restconf {
namespace "urn:ietf:params:xml:ns:yang:ietf-restconf"; namespace "urn:ietf:params:xml:ns:yang:ietf-restconf";
prefix "rc"; 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>
skipping to change at page 57, line 41 skipping to change at page 66, line 19
"This module contains conceptual YANG specifications "This module contains conceptual YANG specifications
for basic RESTCONF media type definitions used in for basic RESTCONF media type definitions used in
RESTCONF protocol messages. RESTCONF protocol messages.
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 'restconf-media-type' YANG extension statement The 'restconf-media-type' YANG extension statement
provides a normative syntax for XML and JSON message provides a normative syntax for XML and JSON message
encoding purposes. encoding purposes.
Copyright (c) 2015 IETF Trust and the persons identified as Copyright (c) 2016 IETF Trust and the persons identified as
authors of the code. All rights reserved. authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions set forth in Section 4.c of the IETF Trust's Legal Provisions
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-restconf-08.txt // Note: extracted from draft-ietf-netconf-restconf-10.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-10-18 { revision 2016-03-16 {
description description
"Initial revision."; "Initial revision.";
reference reference
"RFC XXXX: RESTCONF Protocol."; "RFC XXXX: RESTCONF Protocol.";
} }
extension restconf-media-type { extension restconf-media-type {
argument media-type-id { argument media-type-id {
yin-element true; yin-element true;
} }
skipping to change at page 62, line 16 skipping to change at page 70, line 42
E.g.; E.g.;
POST /restconf/operations/show-log-errors POST /restconf/operations/show-log-errors
leaf show-log-errors { leaf show-log-errors {
type empty; type empty;
} }
"; ";
} }
leaf yang-library-version {
type string {
pattern '\d{4}-\d{2}-\d{2}';
}
config false;
mandatory true;
description
"Identifies the revision date of the ietf-yang-library
module that is implemented by this RESTCONF server.
Indicates the year, month, and day in YYYY-MM-DD
numeric format.";
}
} }
} }
} }
<CODE ENDS> <CODE ENDS>
9. RESTCONF Monitoring 9. RESTCONF Monitoring
The "ietf-restconf-monitoring" module provides information about the The "ietf-restconf-monitoring" module provides information about the
skipping to change at page 65, line 27 skipping to change at page 74, line 16
The "ietf-restconf-monitoring" module defines monitoring information The "ietf-restconf-monitoring" module defines monitoring information
for the RESTCONF protocol. for the RESTCONF protocol.
The "ietf-yang-types" and "ietf-inet-types" modules from [RFC6991] The "ietf-yang-types" and "ietf-inet-types" modules from [RFC6991]
are used by this module for some type definitions. are used by this module for some type definitions.
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-restconf-monitoring@2015-06-19.yang" <CODE BEGINS> file "ietf-restconf-monitoring@2016-03-16.yang"
module ietf-restconf-monitoring { module ietf-restconf-monitoring {
namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring"; namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring";
prefix "rcmon"; prefix "rcmon";
import ietf-yang-types { prefix yang; } import ietf-yang-types { prefix yang; }
import ietf-inet-types { prefix inet; } import ietf-inet-types { prefix inet; }
organization organization
"IETF NETCONF (Network Configuration) Working Group"; "IETF NETCONF (Network Configuration) Working Group";
skipping to change at page 66, line 15 skipping to change at page 74, line 51
Editor: Martin Bjorklund Editor: Martin Bjorklund
<mailto:mbj@tail-f.com> <mailto:mbj@tail-f.com>
Editor: Kent Watsen Editor: Kent Watsen
<mailto:kwatsen@juniper.net>"; <mailto:kwatsen@juniper.net>";
description description
"This module contains monitoring information for the "This module contains monitoring information for the
RESTCONF protocol. RESTCONF protocol.
Copyright (c) 2015 IETF Trust and the persons identified as Copyright (c) 2016 IETF Trust and the persons identified as
authors of the code. All rights reserved. authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions set forth in Section 4.c of the IETF Trust's Legal Provisions
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-restconf-08.txt // Note: extracted from draft-ietf-netconf-restconf-10.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-19 { revision 2016-03-16 {
description description
"Initial revision."; "Initial revision.";
reference reference
"RFC XXXX: RESTCONF Protocol."; "RFC XXXX: RESTCONF Protocol.";
} }
container restconf-state { container restconf-state {
config false; config false;
description description
"Contains RESTCONF protocol monitoring information."; "Contains RESTCONF protocol monitoring information.";
skipping to change at page 69, line 32 skipping to change at page 78, line 22
10.1.1. modules/module 10.1.1. modules/module
This mandatory list contains one entry for each YANG data model This mandatory list contains one entry for each YANG data model
module supported by the server. There MUST be an instance of this module supported by the server. There MUST be an instance of this
list for every YANG module that is used by the server. list for every YANG module that is used by the server.
The contents of this list are defined in the "module" YANG list The contents of this list are defined in the "module" YANG list
statement in [I-D.ietf-netconf-yang-library]. statement in [I-D.ietf-netconf-yang-library].
The server MAY maintain a last-modified timestamp for each instance The server SHOULD maintain a last-modified timestamp for each
of this list entry, and return the "Last-Modified" header when this instance of this list entry, and return the "Last-Modified" header
data node is retrieved with the GET or HEAD methods. If not when this data node is retrieved with the GET or HEAD methods.
supported then the timestamp for the parent "modules" container MAY
be used instead.
The server MAY maintain an entity-tag for each instance of this list The server SHOULD maintain an entity-tag for each instance of this
entry, and return the "ETag" header when this data node is retrieved list entry, and return the "ETag" header when this data node is
with the GET or HEAD methods. If not supported then the timestamp retrieved with the GET or HEAD methods.
for the parent "modules" container MAY be used instead.
11. IANA Considerations 11. IANA Considerations
11.1. The "restconf" Relation Type 11.1. The "restconf" Relation Type
This specification registers the "restconf" relation type in the Link This specification registers the "restconf" relation type in the Link
Relation Type Registry defined by [RFC5988]: Relation Type Registry defined by [RFC5988]:
Relation Name: restconf Relation Name: restconf
Description: Identifies the root of RESTCONF API as configured Description: Identifies the root of RESTCONF API as configured
on this HTTP server. The "restconf" relation on this HTTP server. The "restconf" relation
defines the root of the API defined in RFCXXXX. defines the root of the API defined in RFCXXXX.
Subsequent revisions of RESTCONF will use alternate Subsequent revisions of RESTCONF will use alternate
relation values to support protocol versioning. relation values to support protocol versioning.
Reference: RFC XXXX Reference: RFCXXXX
` `
11.2. YANG Module Registry 11.2. YANG Module Registry
This document registers two URIs in the IETF XML registry [RFC3688]. This document registers two URIs 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-restconf URI: urn:ietf:params:xml:ns:yang:ietf-restconf
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.
URI: urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring URI: urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring
Registrant Contact: The NETMOD WG of the IETF. Registrant Contact: The NETMOD WG of the IETF.
skipping to change at page 70, line 35 skipping to change at page 79, line 23
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 two YANG modules in the YANG Module Names This document registers two YANG modules in the YANG Module Names
registry [RFC6020]. registry [RFC6020].
name: ietf-restconf name: ietf-restconf
namespace: urn:ietf:params:xml:ns:yang:ietf-restconf namespace: urn:ietf:params:xml:ns:yang:ietf-restconf
prefix: rc prefix: rc
// 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: RFCXXXX
name: ietf-restconf-monitoring name: ietf-restconf-monitoring
namespace: urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring namespace: urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring
prefix: rcmon prefix: rcmon
// 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: RFCXXXX
11.3. application/yang Media Sub Types 11.3. application/yang Media Sub Types
The parent MIME media type for RESTCONF resources is application/ The parent MIME media type for RESTCONF resources is application/
yang, which is defined in [RFC6020]. This document defines the yang, which is defined in [RFC6020]. This document defines the
following sub-types for this media type. following sub-types for this media type.
- api - api
- data - data
- datastore - datastore
- errors - errors
- operation - operation
- stream - stream
Type name: application Type name: application
Subtype name: yang.xxx Subtype name: yang.xxx, where "xxx" is 1 of "api",
"data", "datastore", "errors", "operation", or "stream"
Required parameters: none Required parameters: none
Optional parameters: See section 4.8 in RFC XXXX Optional parameters: See section 4.8 in RFC XXXX
Encoding considerations: 8-bit Encoding considerations: 8-bit
Security considerations: See Section 12 in RFC XXXX Security considerations: See Section 12 in RFC XXXX
Interoperability considerations: none Interoperability considerations: none
// RFC Ed.: replace XXXX with RFC number and remove this note // RFC Ed.: replace XXXX with RFC number and remove this note
Published specification: RFC XXXX Published specification: RFC XXXX
11.4. RESTCONF Capability URNs 11.4. RESTCONF Capability URNs
skipping to change at page 72, line 22 skipping to change at page 81, line 31
:replay :replay
urn:ietf:params:restconf:capability:replay:1.0 urn:ietf:params:restconf:capability:replay:1.0
:with-defaults :with-defaults
urn:ietf:params:restconf:capability:with-defaults:1.0 urn:ietf:params:restconf:capability:with-defaults:1.0
12. Security Considerations 12. Security Considerations
This section provides security considerations for the resources This section provides security considerations for the resources
defined by the RESTCONF protocol. Security considerations for HTTPS defined by the RESTCONF protocol. Security considerations for HTTPS
are defined in [RFC2818]. Security considerations for the content are defined in [RFC2818]. RESTCONF does not specify which YANG
manipulated by RESTCONF can be found in the documents defining data modules a server needs to support. Security considerations for the
models. YANG-defined content manipulated by RESTCONF can be found in the
documents defining those YANG modules.
This document does not specify an authentication scheme, but it does
require that an authenticated NETCONF username be associated with
each HTTP request. The authentication scheme MAY be implemented in
the underlying transport layer (e.g., client certificates) or within
the HTTP layer (e.g., Basic Auth, OAuth, etc.). RESTCONF does not
itself define an authentication mechanism. Authentication MUST occur
in a lower layer. Implementors SHOULD provide a comprehensive
authorization scheme with RESTCONF and ensure that the resulting
NETCONF username is made available to the RESTCONF server.
Authorization of individual user access to operations and data MAY be This document does not require use of a specific client
configured via NETCONF Access Control Model (NACM) [RFC6536], as authentication mechanism or authorization model, but it does require
specified in Section 4. that a client authentication mechanism and authorization model is
used whenever a client accesses a protected resource. Client
authentication MUST be implemented using client certificates or MUST
be implemented using an HTTP authentication scheme. Client
authorization MAY be configured using the NETCONF Access Control
Model (NACM) [RFC6536].
Configuration information is by its very nature sensitive. Its Configuration information is by its very nature sensitive. Its
transmission in the clear and without integrity checking leaves transmission in the clear and without integrity checking leaves
devices open to classic eavesdropping and false data injection devices open to classic eavesdropping and false data injection
attacks. Configuration information often contains passwords, user attacks. Configuration information often contains passwords, user
names, service descriptions, and topological information, all of names, service descriptions, and topological information, all of
which are sensitive. Because of this, this protocol SHOULD be which are sensitive. Because of this, this protocol SHOULD be
implemented carefully with adequate attention to all manner of attack implemented carefully with adequate attention to all manner of attack
one might expect to experience with other management interfaces. one might expect to experience with other management interfaces.
Different environments may well allow different rights prior to and Different environments may well allow different rights prior to and
then after authentication. When an operation is not properly then after authentication. When an operation is not properly
authorized, the RESTCONF server MUST return HTTP error status code authorized, the RESTCONF server MUST return a "401 Unauthorized"
401 Unauthorized. Note that authorization information can be status-line. Note that authorization information can be exchanged in
exchanged in the form of configuration information, which is all the the form of configuration information, which is all the more reason
more reason to ensure the security of the connection. to ensure the security of the connection.
13. Acknowledgements 13. 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: Ladislav Lhotka, Juergen contributions to this document: Ladislav Lhotka, Juergen
Schoenwaelder, Rex Fernando, Robert Wilton, and Jonathan Hansford. Schoenwaelder, Rex Fernando, Robert Wilton, and Jonathan Hansford.
The authors would like to thank the following people for their
excellent review comments and contributions to this document: Qin Wu,
Joe Clarke, Bert Wijnen, Ladislav Lhotka, Rodney Cummings, Frank
Xialiang, Tom Petch, Robert Sparks, Balint Uveges, Randy Presuhn, and
Sue Hares.
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).
14. References 14. References
14.1. Normative References 14.1. Normative References
[I-D.ietf-netconf-yang-library] [I-D.ietf-netconf-yang-library]
Bierman, A., Bjorklund, M., and K. Watsen, "YANG Module Bierman, A., Bjorklund, M., and K. Watsen, "YANG Module
Library", draft-ietf-netconf-yang-library-01 (work in Library", draft-ietf-netconf-yang-library-01 (work in
progress), July 2015. progress), July 2015.
[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",
draft-ietf-netmod-rfc6020bis-07 (work in progress), draft-ietf-netmod-rfc6020bis-11 (work in progress),
September 2015. February 2016.
[I-D.ietf-netmod-yang-json] [I-D.ietf-netmod-yang-json]
Lhotka, L., "JSON Encoding of Data Modeled with YANG", Lhotka, L., "JSON Encoding of Data Modeled with YANG",
draft-ietf-netmod-yang-json-06 (work in progress), October draft-ietf-netmod-yang-json-06 (work in progress), October
2015. 2015.
[I-D.ietf-netmod-yang-metadata] [I-D.ietf-netmod-yang-metadata]
Lhotka, L., "Defining and Using Metadata with YANG", Lhotka, L., "Defining and Using Metadata with YANG",
draft-ietf-netmod-yang-metadata-02 (work in progress), draft-ietf-netmod-yang-metadata-02 (work in progress),
September 2015. September 2015.
skipping to change at page 75, line 11 skipping to change at page 84, line 25
[RFC6536] Bierman, A. and M. Bjorklund, "Network Configuration [RFC6536] Bierman, A. and M. Bjorklund, "Network Configuration
Protocol (NETCONF) Access Control Model", RFC 6536, March Protocol (NETCONF) Access Control Model", RFC 6536, March
2012. 2012.
[RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., [RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M.,
and D. Orchard, "URI Template", RFC 6570, March 2012. and D. Orchard, "URI Template", RFC 6570, March 2012.
[RFC6991] Schoenwaelder, J., "Common YANG Data Types", RFC 6991, [RFC6991] Schoenwaelder, J., "Common YANG Data Types", RFC 6991,
July 2013. July 2013.
[RFC7158] Bray, T., Ed., "The JSON Data Interchange Format", RFC [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
7158, March 2013. Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March
2014, <http://www.rfc-editor.org/info/rfc7159>.
[RFC7230] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol [RFC7230] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol
(HTTP/1.1): Message Syntax and Routing", RFC 7230, June (HTTP/1.1): Message Syntax and Routing", RFC 7230, June
2014. 2014.
[RFC7231] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol [RFC7231] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol
(HTTP/1.1): Semantics and Content", RFC 7231, June 2014. (HTTP/1.1): Semantics and Content", RFC 7231, June 2014.
[RFC7232] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol [RFC7232] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol
(HTTP/1.1): Conditional Requests", RFC 7232, June 2014. (HTTP/1.1): Conditional Requests", RFC 7232, June 2014.
skipping to change at page 75, line 41 skipping to change at page 85, line 8
NETCONF Protocol over Transport Layer Security (TLS) with NETCONF Protocol over Transport Layer Security (TLS) with
Mutual X.509 Authentication", RFC 7589, DOI 10.17487/ Mutual X.509 Authentication", RFC 7589, DOI 10.17487/
RFC7589, June 2015, RFC7589, June 2015,
<http://www.rfc-editor.org/info/rfc7589>. <http://www.rfc-editor.org/info/rfc7589>.
[W3C.CR-eventsource-20121211] [W3C.CR-eventsource-20121211]
Hickson, I., "Server-Sent Events", World Wide Web Hickson, I., "Server-Sent Events", World Wide Web
Consortium CR CR-eventsource-20121211, December 2012, Consortium CR CR-eventsource-20121211, December 2012,
<http://www.w3.org/TR/2012/CR-eventsource-20121211>. <http://www.w3.org/TR/2012/CR-eventsource-20121211>.
[W3C.REC-html5-20141028]
Hickson, I., Berjon, R., Faulkner, S., Leithead, T.,
Navara, E., O'Connor, E., and S. Pfeiffer, "HTML5", World
Wide Web Consortium Recommendation REC-html5-20141028,
October 2014,
<http://www.w3.org/TR/2014/REC-html5-20141028>.
[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>.
[XPath] Clark, J. and S. DeRose, "XML Path Language (XPath) [XPath] Clark, J. and S. DeRose, "XML Path Language (XPath)
Version 1.0", World Wide Web Consortium Recommendation Version 1.0", World Wide Web Consortium Recommendation
REC-xpath-19991116, November 1999, REC-xpath-19991116, November 1999,
skipping to change at page 76, line 23 skipping to change at page 85, line 45
Fielding, R., "Architectural Styles and the Design of Fielding, R., "Architectural Styles and the Design of
Network-based Software Architectures", 2000. Network-based Software Architectures", 2000.
Appendix A. Change Log Appendix A. Change Log
-- RFC Ed.: remove this section before publication. -- RFC Ed.: remove this section before publication.
The RESTCONF issue tracker can be found here: https://github.com/ The RESTCONF issue tracker can be found here: https://github.com/
netconf-wg/restconf/issues netconf-wg/restconf/issues
A.1. v08 - v09 A.1. v09 - v10
o address review comments: github issue #36
o removed intro text about no knowledge of NETCONF needed
o clarified candidate and confirmed-commit behavior in sec. 1.3
o clarified that a RESTCONF server MUST support TLS
o clarified choice of 403 or 404 error
o fixed forward references to URI template (w/reference at first
use)
o added reference to HTML5
o made error terminology more consistent
o clarified that only 1 list or leaf-list instance can be returned
in an XML response message-body
o clarified that more than 1 instance must not be created by a POST
method
o clarified that PUT cannot be used to change a leaf-list value or
any list key values
o clarified that PATCH cannot be used to change a leaf-list value or
any list key values
o clarified that DELETE should not be used to delete more than one
instance of a leaf-list or list
o update JSON RFC reference
o specified that leaf-list instances are data resources
o specified how a leaf-list instance identifier is constructed
o fixed get-schema example
o clarified that if no Accept header the server SHOULD return the
type specified in RESTCONF, but MAY return any media-type,
according to HTTP rules
o clarified that server SHOULD maintain timestamp and etag for data
resources
o clarified default for content query parameter
o moved terminology section earlier in doc to avoid forward usage
o clarified intro text wrt/ interactions with NETCONF and access to
specific datastores
o clarified server implementation requirements for YANG defaults
o clarified that Errors is not a resource, just a media type
o clarified that HTTP without TLS MUST NOT be used
o add RESTCONF Extensibility section to make it clear how RESTCONF
will be extended in the future
o add text warning that NACM does not work with HTTP caching
o remove sec. 5.2 Message Headers
o remove 202 Accepted from list of used status-lines -- not allowed
o made implementation of OPTIONS MUST instead of SHOULD
o clarified that successful PUT for altering data returns 204
o fixed "point" parameter example
o added example of alternate value for root resource discovery
o added YANG action examples
o fixed some JSON examples
o changed default value for content query parameter to "all"
o changed empty container JSON encoding from "[null]" to "{}"
o added mandatory /restconf/yang-library-version leaf to advertise
revision-date of the YANG library implemented by the server
o clarified URI encoding rules for leaf-list
o clarified sec. 2.2 wrt/ certificates and TLS
o added update procedure for entity tag and timestamp
A.2. v08 - v09
o fix introduction text regarding implementation requirements for o fix introduction text regarding implementation requirements for
the ietf-yang-library the ietf-yang-library
o clarified HTTP authentication requirements o clarified HTTP authentication requirements
o fix host-meta example o fix host-meta example
o changed list key encoding to clarify that quoted strings are not o changed list key encoding to clarify that quoted strings are not
allowed. Percent-encoded values are used if quotes would be allowed. Percent-encoded values are used if quotes would be
required. A missing key is treated as a zero-length string required. A missing key is treated as a zero-length string
o Fixed example of percent-encoded string to match YANG model o Fixed example of percent-encoded string to match YANG model
o Changed streams examples to align with naming already used o Changed streams examples to align with naming already used
A.2. v07 - v08 A.3. v07 - v08
o add support for YANG 1.1 action statement o add support for YANG 1.1 action statement
o changed mandatory encoding from XML to XML or JSON o changed mandatory encoding from XML to XML or JSON
o fix syntax in fields parameter definition o fix syntax in fields parameter definition
o add meta-data encoding examples for XML and JSON o add meta-data encoding examples for XML and JSON
o remove RFC 2396 references and update with 3986 o remove RFC 2396 references and update with 3986
skipping to change at page 77, line 4 skipping to change at page 88, line 23
o add support for YANG 1.1 action statement o add support for YANG 1.1 action statement
o changed mandatory encoding from XML to XML or JSON o changed mandatory encoding from XML to XML or JSON
o fix syntax in fields parameter definition o fix syntax in fields parameter definition
o add meta-data encoding examples for XML and JSON o add meta-data encoding examples for XML and JSON
o remove RFC 2396 references and update with 3986 o remove RFC 2396 references and update with 3986
o change encoding of a key so quoted string are not used, since they o change encoding of a key so quoted string are not used, since they
are already percent-encoded. A zero-length string is not encoded are already percent-encoded. A zero-length string is not encoded
(/list=foo,,baz) (/list=foo,,baz)
o Add example of percent-encoded key value o Add example of percent-encoded key value
A.3. v06 - v07 A.4. v06 - v07
o fixed all issues identified in email from Jernej Tuljak in netconf o fixed all issues identified in email from Jernej Tuljak in netconf
email 2015-06-22 email 2015-06-22
o fixed error example bug where error-urlpath was still used. o fixed error example bug where error-urlpath was still used.
Changed to error-path. Changed to error-path.
o added mention of YANG Patch and informative reference o added mention of YANG Patch and informative reference
o added support for YANG 1.1, specifically support for anydata and o added support for YANG 1.1, specifically support for anydata and
actions actions
o removed the special field value "*", since it is no longer needed o removed the special field value "*", since it is no longer needed
A.4. v05 - v06 A.5. v05 - v06
o fixed RESTCONF issue #23 (ietf-restconf-monitoring bug) o fixed RESTCONF issue #23 (ietf-restconf-monitoring bug)
A.5. v04 - v05 A.6. v04 - v05
o changed term 'notification event' to 'event notification' o changed term 'notification event' to 'event notification'
o removed intro text about framework and meta-model o removed intro text about framework and meta-model
o removed early mention of API resources o removed early mention of API resources
o removed term unified datastore and cleaned up text about NETCONF o removed term unified datastore and cleaned up text about NETCONF
datastores datastores
o removed text about not immediate persistence of edits o removed text about not immediate persistence of edits
o removed RESTCONF-specific data-resource-identifier typedef and its o removed RESTCONF-specific data-resource-identifier typedef and its
skipping to change at page 78, line 17 skipping to change at page 89, line 37
o renamed stream/encoding/events to stream/access/location o renamed stream/encoding/events to stream/access/location
o changed XPath from informative to normative reference o changed XPath from informative to normative reference
o changed rest-dissertation from normative to informative reference o changed rest-dissertation from normative to informative reference
o changed example-jukebox playlist 'id' from a data-resource- o changed example-jukebox playlist 'id' from a data-resource-
identifier to a leafref pointing at the song name identifier to a leafref pointing at the song name
A.6. v03 - v04 A.7. v03 - v04
o renamed 'select' to 'fields' (#1) o renamed 'select' to 'fields' (#1)
o moved collection resource and page capability to draft-ietf- o moved collection resource and page capability to draft-ietf-
netconf-restconf-collection-00 (#3) netconf-restconf-collection-00 (#3)
o added mandatory "defaults" protocol capability URI (#4) o added mandatory "defaults" protocol capability URI (#4)
o added optional "with-defaults" query parameter URI (#4) o added optional "with-defaults" query parameter URI (#4)
skipping to change at page 79, line 5 skipping to change at page 90, line 24
o changed lock-denied error example o changed lock-denied error example
o added with-defaults query parameter example o added with-defaults query parameter example
o added term "RESTCONF Capability" o added term "RESTCONF Capability"
o changed NETCONF Capability URI registry usage to new RESTCONF o changed NETCONF Capability URI registry usage to new RESTCONF
Capability URI Registry usage Capability URI Registry usage
A.7. v02 - v03 A.8. v02 - v03
o added collection resource o added collection resource
o added "page" query parameter capability o added "page" query parameter capability
o added "limit" and "offset" query parameters, which are available o added "limit" and "offset" query parameters, which are available
if the "page" capability is supported if the "page" capability is supported
o added "stream list" term o added "stream list" term
skipping to change at page 79, line 27 skipping to change at page 90, line 46
o added "encoding" list within the "stream" list to allow different o added "encoding" list within the "stream" list to allow different
<events> URLs for XML and JSON encoding. <events> URLs for XML and JSON encoding.
o made XML MUST implement and JSON MAY implement for servers o made XML MUST implement and JSON MAY implement for servers
o re-add JSON notification examples (previously removed) o re-add JSON notification examples (previously removed)
o updated JSON references o updated JSON references
A.8. v01 - v02 A.9. v01 - v02
o moved query parameter definitions from the YANG module back to the o moved query parameter definitions from the YANG module back to the
plain text sections plain text sections
o made all query parameters optional to implement o made all query parameters optional to implement
o defined query parameter capability URI o defined query parameter capability URI
o moved 'streams' to new YANG module (ietf-restconf-monitoring) o moved 'streams' to new YANG module (ietf-restconf-monitoring)
o added 'capabilities' container to new YANG module (ietf-restconf- o added 'capabilities' container to new YANG module (ietf-restconf-
monitoring) monitoring)
o moved 'modules' container to new YANG module (ietf-yang-library) o moved 'modules' container to new YANG module (ietf-yang-library)
o added new leaf 'module-set-id' (ietf-yang-library) o added new leaf 'module-set-id' (ietf-yang-library)
skipping to change at page 80, line 16 skipping to change at page 91, line 35
information is no longer in this resource information is no longer in this resource
o closed issue #1 'select parameter' since no objections to the o closed issue #1 'select parameter' since no objections to the
proposed syntax proposed syntax
o closed "encoding of list keys" issue since no objection to new o closed "encoding of list keys" issue since no objection to new
encoding of list keys in a target resource URI. encoding of list keys in a target resource URI.
o moved open issues list to the issue tracker on github o moved open issues list to the issue tracker on github
A.9. v00 - v01 A.10. v00 - v01
o fixed content=nonconfig example (non-config was incorrect) o fixed content=nonconfig example (non-config was incorrect)
o closed open issue 'message-id'. There is no need for a message-id o closed open issue 'message-id'. There is no need for a message-id
field, and RFC 2392 does not apply. field, and RFC 2392 does not apply.
o closed open issue 'server support verification'. The headers used o closed open issue 'server support verification'. The headers used
by RESTCONF are widely supported. by RESTCONF are widely supported.
o removed encoding rules from section on RESTCONF Meta-Data. This o removed encoding rules from section on RESTCONF Meta-Data. This
skipping to change at page 81, line 4 skipping to change at page 92, line 26
o closed open issue '_self links for HATEOAS support'. It was o closed open issue '_self links for HATEOAS support'. It was
decided that they are redundant because they can be derived from decided that they are redundant because they can be derived from
the YANG module for the specific data. the YANG module for the specific data.
o added explanatory text for the 'select' parameter. o added explanatory text for the 'select' parameter.
o added RESTCONF Path Resolution section for discovering the root of o added RESTCONF Path Resolution section for discovering the root of
the RESTCONF API using the /.well-known/host-meta. the RESTCONF API using the /.well-known/host-meta.
o added an "error" media type to for structured error messages o added an "error" media type to for structured error messages
o added Secure Transport section requiring TLS o added Secure Transport section requiring TLS
o added Security Considerations section o added Security Considerations section
o removed all references to "REST-like" o removed all references to "REST-like"
A.10. bierman:restconf-04 to ietf:restconf-00 A.11. bierman:restconf-04 to ietf:restconf-00
o updated open issues section o updated open issues section
Appendix B. Open Issues Appendix B. Open Issues
-- RFC Ed.: remove this section before publication. -- RFC Ed.: remove this section before publication.
The RESTCONF issues are tracked on github.com: The RESTCONF issues are tracked on github.com:
https://github.com/netconf-wg/restconf/issues [1] https://github.com/netconf-wg/restconf/issues
Appendix C. Example YANG Module Appendix C. 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. media jukebox interface.
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
skipping to change at page 88, line 12 skipping to change at page 99, line 25
The server might respond as follows: The server might respond as follows:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server Server: example-server
Content-Type: application/yang.api+json Content-Type: application/yang.api+json
{ {
"ietf-restconf:restconf": { "ietf-restconf:restconf": {
"data" : [ null ], "data" : {},
"operations" : [ null ] "operations" : {}
} }
} }
To request that the response content to be encoded in XML, the To request that the response content to be encoded in XML, the
"Accept" header can be used, as in this example request: "Accept" header can be used, as in this example request:
GET /restconf HTTP/1.1 GET /restconf HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.api+xml Accept: application/yang.api+xml
skipping to change at page 88, line 37 skipping to change at page 99, line 50
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Content-Type: application/yang.api+xml Content-Type: application/yang.api+xml
<restconf xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"> <restconf xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<data/> <data/>
<operations/> <operations/>
<yang-library-version>2016-02-01</yang-library-version>
</restconf> </restconf>
D.1.2. Retrieve The Server Module Information D.1.2. Retrieve The Server Module Information
In this example the client is retrieving the modules information from In this example the client is retrieving the modules information from
the server in JSON format: the server in JSON format:
GET /restconf/data/ietf-yang-library:modules HTTP/1.1 GET /restconf/data/ietf-yang-library:modules HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+json Accept: application/yang.data+json
The server might respond as follows. The server might respond as follows (some strings wrapped for display
purposes):
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"ietf-yang-library:modules": { "ietf-yang-library:modules": {
"module": [ "module": [
{ {
"name" : "foo", "name" : "foo",
"revision" : "2012-01-02", "revision" : "2012-01-02",
"schema" : "https://example.com/modules/foo/2012-01-02", "schema" : "https://example.com/modules/foo/2012-01-02",
"namespace" : "http://example.com/ns/foo", "namespace" : "http://example.com/ns/foo",
"feature" : [ "feature1", "feature2" ], "feature" : [ "feature1", "feature2" ],
"conformance" : "implement" "conformance-type" : "implement"
},
{
"name" : "ietf-yang-library",
"revision" : "2016-02-01",
"schema" : "https://example.com/modules/ietf-yang-
library/2016-02-01",
"namespace" :
"urn:ietf:params:xml:ns:yang:ietf-yang-library",
"conformance-type" : "implement"
}, },
{ {
"name" : "foo-types", "name" : "foo-types",
"revision" : "2012-01-05", "revision" : "2012-01-05",
"schema" : "schema" :
"https://example.com/modules/foo-types/2012-01-05", "https://example.com/modules/foo-types/2012-01-05",
"schema" : [null],
"namespace" : "http://example.com/ns/foo-types", "namespace" : "http://example.com/ns/foo-types",
"conformance" : "import" "conformance-type" : "import"
}, },
{ {
"name" : "bar", "name" : "bar",
"revision" : "2012-11-05", "revision" : "2012-11-05",
"schema" : "https://example.com/modules/bar/2012-11-05", "schema" : "https://example.com/modules/bar/2012-11-05",
"namespace" : "http://example.com/ns/bar", "namespace" : "http://example.com/ns/bar",
"feature" : [ "bar-ext" ], "feature" : [ "bar-ext" ],
"conformance" : "implement", "conformance-type" : "implement",
"submodule" : [ "submodule" : [
{ {
"name" : "bar-submod1", "name" : "bar-submod1",
"revision" : "2012-11-05", "revision" : "2012-11-05",
"schema" : "schema" :
"https://example.com/modules/bar-submod1/2012-11-05" "https://example.com/modules/bar-submod1/2012-11-05"
}, },
{ {
"name" : "bar-submod2", "name" : "bar-submod2",
"revision" : "2012-11-05", "revision" : "2012-11-05",
skipping to change at page 90, line 4 skipping to change at page 101, line 27
}, },
{ {
"name" : "bar-submod2", "name" : "bar-submod2",
"revision" : "2012-11-05", "revision" : "2012-11-05",
"schema" : "schema" :
"https://example.com/modules/bar-submod2/2012-11-05" "https://example.com/modules/bar-submod2/2012-11-05"
} }
] ]
} }
] ]
} }
} }
D.1.3. Retrieve The Server Capability Information D.1.3. Retrieve The Server Capability Information
In this example the client is retrieving the capability information In this example the client is retrieving the capability information
from the server in JSON format, and the server supports all the from the server in XML format, and the server supports all the
RESTCONF query parameters, plus one vendor parameter: RESTCONF query parameters, plus one vendor parameter:
GET /restconf/data/ietf-restconf-monitoring:restconf-state/ GET /restconf/data/ietf-restconf-monitoring:restconf-state/
capabilities HTTP/1.1 capabilities HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+xml Accept: application/yang.data+xml
The server might respond as follows. The extra whitespace in The server might respond as follows. The extra whitespace in
'capability' elements for display purposes only. 'capability' elements for display purposes only.
skipping to change at page 91, line 35 skipping to change at page 103, line 17
Server: example-server Server: example-server
Location: https://example.com/restconf/data/ Location: https://example.com/restconf/data/
example-jukebox:jukebox/library/artist=Foo%20Fighters example-jukebox:jukebox/library/artist=Foo%20Fighters
Last-Modified: Mon, 23 Apr 2012 17:02:00 GMT Last-Modified: Mon, 23 Apr 2012 17:02:00 GMT
ETag: b3830f23a4c ETag: b3830f23a4c
To create a new "album" resource for this artist within the "jukebox" To create a new "album" resource for this artist within the "jukebox"
resource, the client might send the following request. Note that the resource, the client might send the following request. Note that the
request URI header line is wrapped for display purposes only: request URI header line is wrapped for display purposes only:
POST /restconf/data/example-jukebox:jukebox/ POST /restconf/data/example-jukebox:jukebox/
library/artist=Foo%20Fighters HTTP/1.1 library/artist=Foo%20Fighters HTTP/1.1
Host: example.com Host: example.com
Content-Type: application/yang.data+json Content-Type: application/yang.data+xml
{ <album xmlns="http://example.com/ns/example-jukebox">
"example-jukebox:album" : { <name>Wasting Light</name>
"name" : "Wasting Light", <year>2011</year>
"genre" : "example-jukebox:alternative", </album>
"year" : 2012 # note this is the wrong date
}
}
If the resource is created, the server might respond as follows. If the resource is created, the server might respond as follows.
Note that the "Location" header line is wrapped for display purposes Note that the "Location" header line is wrapped for display purposes
only: only:
HTTP/1.1 201 Created HTTP/1.1 201 Created
Date: Mon, 23 Apr 2012 17:03:00 GMT Date: Mon, 23 Apr 2012 17:03:00 GMT
Server: example-server Server: example-server
Location: https://example.com/restconf/data/ Location: https://example.com/restconf/data/
example-jukebox:jukebox/library/artist=Foo%20Fighters/ example-jukebox:jukebox/library/artist=Foo%20Fighters/
album=Wasting%20Light album=Wasting%20Light
Last-Modified: Mon, 23 Apr 2012 17:03:00 GMT Last-Modified: Mon, 23 Apr 2012 17:03:00 GMT
ETag: b8389233a4c ETag: b8389233a4c
D.2.2. Detect Resource Entity Tag Change D.2.2. Detect Resource Entity Tag Change
In this example, the server just supports the mandatory datastore In this example, the server just supports the mandatory datastore
last-changed timestamp. The client has previously retrieved the last-changed timestamp. The client has previously retrieved the
"Last-Modified" header and has some value cached to provide in the "Last-Modified" header and has some value cached to provide in the
following request to patch an "album" list entry with key value following request to patch an "album" list entry with key value
"Wasting Light". Only the "year" field is being updated. "Wasting Light". Only the "genre" field is being updated.
PATCH /restconf/data/example-jukebox:jukebox/ PATCH /restconf/data/example-jukebox:jukebox/
library/artist=Foo%20Fighters/album=Wasting%20Light/year library/artist=Foo%20Fighters/album=Wasting%20Light/genre
HTTP/1.1 HTTP/1.1
Host: example.com Host: example.com
If-Unmodified-Since: Mon, 23 Apr 2012 17:01:00 GMT If-Unmodified-Since: Mon, 23 Apr 2012 17:01:00 GMT
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ "example-jukebox:year" : "2011" } { "example-jukebox:genre" : "example-jukebox:alternative" }
In this example the datastore resource has changed since the time In this example the datastore resource has changed since the time
specified in the "If-Unmodified-Since" header. The server might specified in the "If-Unmodified-Since" header. The server might
respond: respond:
HTTP/1.1 412 Precondition Failed HTTP/1.1 412 Precondition Failed
Date: Mon, 23 Apr 2012 19:01:00 GMT Date: Mon, 23 Apr 2012 19:01:00 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 17:45:00 GMT Last-Modified: Mon, 23 Apr 2012 17:45:00 GMT
ETag: b34aed893a4c ETag: b34aed893a4c
skipping to change at page 98, line 26 skipping to change at page 110, line 4
Accept: application/yang.data+json Accept: application/yang.data+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:11:30 GMT Date: Mon, 23 Apr 2012 17:11:30 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"example-jukebox:jukebox" : [null] "example-jukebox:jukebox" : {}
} }
Example 3: depth=3 Example 3: depth=3
To limit the depth level to the target resource plus 2 child resource To limit the depth level to the target resource plus 2 child resource
layers the value "3" is used. layers the value "3" is used.
GET /restconf/data/example-jukebox:jukebox?depth=3 HTTP/1.1 GET /restconf/data/example-jukebox:jukebox?depth=3 HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+json Accept: application/yang.data+json
skipping to change at page 98, line 52 skipping to change at page 110, line 29
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:11:30 GMT Date: Mon, 23 Apr 2012 17:11:30 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"example-jukebox:jukebox" : { "example-jukebox:jukebox" : {
"library" : { "library" : {
"artist" : [ null ] "artist" : {}
}, },
"playlist" : [ "playlist" : [
{ {
"name" : "Foo-One", "name" : "Foo-One",
"description" : "example playlist 1", "description" : "example playlist 1",
"song" : [ null ] "song" : {}
} }
], ],
"player" : { "player" : {
"gap" : 0.5 "gap" : 0.5
} }
} }
} }
D.3.3. "fields" Parameter D.3.3. "fields" Parameter
skipping to change at page 100, line 5 skipping to change at page 111, line 32
{ {
"name" : "ietf-inet-types", "name" : "ietf-inet-types",
"revision" : "2013-07-15" "revision" : "2013-07-15"
}, },
{ {
"name" : "ietf-restconf-monitoring", "name" : "ietf-restconf-monitoring",
"revision" : "2015-06-19" "revision" : "2015-06-19"
}, },
{ {
"name" : "ietf-yang-library", "name" : "ietf-yang-library",
"revision" : "2015-07-03" "revision" : "2016-02-01"
}, },
{ {
"name" : "ietf-yang-types", "name" : "ietf-yang-types",
"revision" : "2013-07-15" "revision" : "2013-07-15"
} }
] ]
} }
} }
skipping to change at page 101, line 10 skipping to change at page 112, line 35
In this example, the client is inserting a new "song" resource within In this example, the client is inserting a new "song" resource within
an "album" resource after another song. The request URI is split for an "album" resource after another song. The request URI is split for
display purposes only. display purposes only.
Request from client: Request from client:
POST /restconf/data/example-jukebox:jukebox/ POST /restconf/data/example-jukebox:jukebox/
library/artist=Foo%20Fighters/album=Wasting%20Light? library/artist=Foo%20Fighters/album=Wasting%20Light?
insert=after&point=%2Fexample-jukebox%3Ajukebox%2F insert=after&point=%2Fexample-jukebox%3Ajukebox%2F
library%2Fartist%2FFoo%20Fighters%2Falbum%2F library%2Fartist%3DFoo%20Fighters%2Falbum%3D
Wasting%20Light%2Fsong%2FBridge%20Burning HTTP/1.1 Wasting%20Light%2Fsong%3DBridge%20Burning HTTP/1.1
Host: example.com Host: example.com
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"example-jukebox:song" : { "example-jukebox:song" : {
"name" : "Rope", "name" : "Rope",
"location" : "/media/foo/a7/rope.mp3", "location" : "/media/foo/a7/rope.mp3",
"format" : "MP3", "format" : "MP3",
"length" : 259 "length" : 259
} }
 End of changes. 227 change blocks. 
709 lines changed or deleted 1209 lines changed or added

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