draft-ietf-netconf-restconf-07.txt   draft-ietf-netconf-restconf-08.txt 
Network Working Group A. Bierman Network Working Group A. Bierman
Internet-Draft YumaWorks Internet-Draft YumaWorks
Intended status: Standards Track M. Bjorklund Intended status: Standards Track M. Bjorklund
Expires: January 7, 2016 Tail-f Systems Expires: April 20, 2016 Tail-f Systems
K. Watsen K. Watsen
Juniper Networks Juniper Networks
July 6, 2015 October 18, 2015
RESTCONF Protocol RESTCONF Protocol
draft-ietf-netconf-restconf-07 draft-ietf-netconf-restconf-08
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 January 7, 2016. This Internet-Draft will expire on April 20, 2016.
Copyright Notice Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the Copyright (c) 2015 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1. Simple Subset of NETCONF Functionality . . . . . . . . . 5 1.1. Simple Subset of NETCONF Functionality . . . . . . . . . 5
1.2. Data Model Driven API . . . . . . . . . . . . . . . . . . 6 1.2. Data Model Driven API . . . . . . . . . . . . . . . . . . 6
1.3. Coexistence with NETCONF . . . . . . . . . . . . . . . . 7 1.3. Coexistence with NETCONF . . . . . . . . . . . . . . . . 7
1.4. Terminology . . . . . . . . . . . . . . . . . . . . . . . 8 1.4. Terminology . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.1. NETCONF . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.1. NETCONF . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.2. HTTP . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.2. HTTP . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.3. YANG . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4.3. YANG . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4.4. Terms . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.4. Terms . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4.5. URI Template . . . . . . . . . . . . . . . . . . . . 11 1.4.5. URI Template . . . . . . . . . . . . . . . . . . . . 11
1.4.6. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 11 1.4.6. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 11
2. Transport Protocol Requirements . . . . . . . . . . . . . . . 12 2. Transport Protocol Requirements . . . . . . . . . . . . . . . 12
2.1. Integrity and Confidentiality . . . . . . . . . . . . . . 12 2.1. Integrity and Confidentiality . . . . . . . . . . . . . . 12
2.2. HTTPS with X.509v3 Certificates . . . . . . . . . . . . . 12 2.2. HTTPS with X.509v3 Certificates . . . . . . . . . . . . . 12
2.3. Certificate Validation . . . . . . . . . . . . . . . . . 12 2.3. Certificate Validation . . . . . . . . . . . . . . . . . 12
2.4. Authenticated Server Identity . . . . . . . . . . . . . . 12 2.4. Authenticated Server Identity . . . . . . . . . . . . . . 13
2.5. Authenticated Client Identity . . . . . . . . . . . . . . 12 2.5. Authenticated Client Identity . . . . . . . . . . . . . . 13
3. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.1. Root Resource Discovery . . . . . . . . . . . . . . . . . 14 3.1. Root Resource Discovery . . . . . . . . . . . . . . . . . 14
3.2. RESTCONF Resource Types . . . . . . . . . . . . . . . . . 15 3.2. RESTCONF Resource Types . . . . . . . . . . . . . . . . . 15
3.3. API Resource . . . . . . . . . . . . . . . . . . . . . . 15 3.3. API Resource . . . . . . . . . . . . . . . . . . . . . . 16
3.3.1. {+restconf}/data . . . . . . . . . . . . . . . . . . 16 3.3.1. {+restconf}/data . . . . . . . . . . . . . . . . . . 16
3.3.2. {+restconf}/operations . . . . . . . . . . . . . . . 17 3.3.2. {+restconf}/operations . . . . . . . . . . . . . . . 17
3.4. Datastore Resource . . . . . . . . . . . . . . . . . . . 17 3.4. Datastore Resource . . . . . . . . . . . . . . . . . . . 17
3.4.1. Edit Collision Detection . . . . . . . . . . . . . . 18 3.4.1. Edit Collision Detection . . . . . . . . . . . . . . 18
3.5. Data Resource . . . . . . . . . . . . . . . . . . . . . . 18 3.5. Data Resource . . . . . . . . . . . . . . . . . . . . . . 18
3.5.1. Encoding Data Resource Identifiers in the Request URI 19 3.5.1. Encoding Data Resource Identifiers in the Request URI 19
3.5.2. Defaults Handling . . . . . . . . . . . . . . . . . . 22 3.5.2. Defaults Handling . . . . . . . . . . . . . . . . . . 22
3.6. Operation Resource . . . . . . . . . . . . . . . . . . . 22 3.6. Operation Resource . . . . . . . . . . . . . . . . . . . 22
3.6.1. Encoding Operation Input Parameters . . . . . . . . . 23 3.6.1. Encoding Operation Input Parameters . . . . . . . . . 23
3.6.2. Encoding Operation Output Parameters . . . . . . . . 24 3.6.2. Encoding Operation Output Parameters . . . . . . . . 24
3.6.3. Encoding Operation Errors . . . . . . . . . . . . . . 25 3.6.3. Encoding Operation Errors . . . . . . . . . . . . . . 25
3.7. Schema Resource . . . . . . . . . . . . . . . . . . . . . 25 3.7. Schema Resource . . . . . . . . . . . . . . . . . . . . . 26
3.8. Event Stream Resource . . . . . . . . . . . . . . . . . . 26 3.8. Event Stream Resource . . . . . . . . . . . . . . . . . . 27
3.9. Errors Media Type . . . . . . . . . . . . . . . . . . . . 27 3.9. Errors Media Type . . . . . . . . . . . . . . . . . . . . 27
4. Operations . . . . . . . . . . . . . . . . . . . . . . . . . 27 4. Operations . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.1. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.1. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.3. GET . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.3. GET . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.4. POST . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.4. POST . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.4.1. Create Resource Mode . . . . . . . . . . . . . . . . 30 4.4.1. Create Resource Mode . . . . . . . . . . . . . . . . 30
4.4.2. Invoke Operation Mode . . . . . . . . . . . . . . . . 31 4.4.2. Invoke Operation Mode . . . . . . . . . . . . . . . . 31
4.5. PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.5. PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.6. PATCH . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.6. PATCH . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.6.1. Plain Patch . . . . . . . . . . . . . . . . . . . . . 33 4.6.1. Plain Patch . . . . . . . . . . . . . . . . . . . . . 33
4.7. DELETE . . . . . . . . . . . . . . . . . . . . . . . . . 34 4.7. DELETE . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.8. Query Parameters . . . . . . . . . . . . . . . . . . . . 34 4.8. Query Parameters . . . . . . . . . . . . . . . . . . . . 35
4.8.1. The "content" Query Parameter . . . . . . . . . . . . 35 4.8.1. The "content" Query Parameter . . . . . . . . . . . . 36
4.8.2. The "depth" Query Parameter . . . . . . . . . . . . . 36 4.8.2. The "depth" Query Parameter . . . . . . . . . . . . . 36
4.8.3. The "fields" Query Parameter . . . . . . . . . . . . 36 4.8.3. The "fields" Query Parameter . . . . . . . . . . . . 37
4.8.4. The "insert" Query Parameter . . . . . . . . . . . . 37 4.8.4. The "insert" Query Parameter . . . . . . . . . . . . 38
4.8.5. The "point" Query Parameter . . . . . . . . . . . . . 38 4.8.5. The "point" Query Parameter . . . . . . . . . . . . . 38
4.8.6. The "filter" Query Parameter . . . . . . . . . . . . 38 4.8.6. The "filter" Query Parameter . . . . . . . . . . . . 39
4.8.7. The "start-time" Query Parameter . . . . . . . . . . 39 4.8.7. The "start-time" Query Parameter . . . . . . . . . . 39
4.8.8. The "stop-time" Query Parameter . . . . . . . . . . . 40 4.8.8. The "stop-time" Query Parameter . . . . . . . . . . . 40
4.8.9. The "with-defaults" Query Parameter . . . . . . . . . 40 4.8.9. The "with-defaults" Query Parameter . . . . . . . . . 41
5. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 41 5. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.1. Request URI Structure . . . . . . . . . . . . . . . . . . 41 5.1. Request URI Structure . . . . . . . . . . . . . . . . . . 42
5.2. Message Headers . . . . . . . . . . . . . . . . . . . . . 43 5.2. Message Headers . . . . . . . . . . . . . . . . . . . . . 43
5.3. Message Encoding . . . . . . . . . . . . . . . . . . . . 44 5.3. Message Encoding . . . . . . . . . . . . . . . . . . . . 44
5.4. RESTCONF Meta-Data . . . . . . . . . . . . . . . . . . . 44 5.4. RESTCONF Meta-Data . . . . . . . . . . . . . . . . . . . 44
5.5. Return Status . . . . . . . . . . . . . . . . . . . . . . 44 5.4.1. XML MetaData Encoding Example . . . . . . . . . . . . 45
5.6. Message Caching . . . . . . . . . . . . . . . . . . . . . 45 5.4.2. JSON MetaData Encoding Example . . . . . . . . . . . 45
6. Notifications . . . . . . . . . . . . . . . . . . . . . . . . 45 5.5. Return Status . . . . . . . . . . . . . . . . . . . . . . 46
6.1. Server Support . . . . . . . . . . . . . . . . . . . . . 45 5.6. Message Caching . . . . . . . . . . . . . . . . . . . . . 46
6.2. Event Streams . . . . . . . . . . . . . . . . . . . . . . 45 6. Notifications . . . . . . . . . . . . . . . . . . . . . . . . 47
6.1. Server Support . . . . . . . . . . . . . . . . . . . . . 47
6.2. Event Streams . . . . . . . . . . . . . . . . . . . . . . 47
6.3. Subscribing to Receive Notifications . . . . . . . . . . 48 6.3. Subscribing to Receive Notifications . . . . . . . . . . 48
6.3.1. NETCONF Event Stream . . . . . . . . . . . . . . . . 49 6.3.1. NETCONF Event Stream . . . . . . . . . . . . . . . . 50
6.4. Receiving Event Notifications . . . . . . . . . . . . . . 49 6.4. Receiving Event Notifications . . . . . . . . . . . . . . 50
7. Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 51 7. Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 52
7.1. Error Response Message . . . . . . . . . . . . . . . . . 53 7.1. Error Response Message . . . . . . . . . . . . . . . . . 54
8. RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 55 8. RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 56
9. RESTCONF Monitoring . . . . . . . . . . . . . . . . . . . . . 61 9. RESTCONF Monitoring . . . . . . . . . . . . . . . . . . . . . 62
9.1. restconf-state/capabilities . . . . . . . . . . . . . . . 61 9.1. restconf-state/capabilities . . . . . . . . . . . . . . . 62
9.1.1. Query Parameter URIs . . . . . . . . . . . . . . . . 62 9.1.1. Query Parameter URIs . . . . . . . . . . . . . . . . 63
9.1.2. The "defaults" Protocol Capability URI . . . . . . . 62 9.1.2. The "defaults" Protocol Capability URI . . . . . . . 63
9.2. restconf-state/streams . . . . . . . . . . . . . . . . . 63 9.2. restconf-state/streams . . . . . . . . . . . . . . . . . 64
9.3. RESTCONF Monitoring Module . . . . . . . . . . . . . . . 63 9.3. RESTCONF Monitoring Module . . . . . . . . . . . . . . . 64
10. YANG Module Library . . . . . . . . . . . . . . . . . . . . . 67 10. YANG Module Library . . . . . . . . . . . . . . . . . . . . . 68
10.1. modules . . . . . . . . . . . . . . . . . . . . . . . . 67 10.1. modules . . . . . . . . . . . . . . . . . . . . . . . . 68
10.1.1. modules/module . . . . . . . . . . . . . . . . . . . 68 10.1.1. modules/module . . . . . . . . . . . . . . . . . . . 69
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 68 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 69
11.1. The "restconf" Relation Type . . . . . . . . . . . . . . 68 11.1. The "restconf" Relation Type . . . . . . . . . . . . . . 69
11.2. YANG Module Registry . . . . . . . . . . . . . . . . . . 68 11.2. YANG Module Registry . . . . . . . . . . . . . . . . . . 69
11.3. application/yang Media Sub Types . . . . . . . . . . . . 69 11.3. application/yang Media Sub Types . . . . . . . . . . . . 70
11.4. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 70 11.4. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 71
12. Security Considerations . . . . . . . . . . . . . . . . . . . 71 12. Security Considerations . . . . . . . . . . . . . . . . . . . 71
13. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 72 13. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 72
14. References . . . . . . . . . . . . . . . . . . . . . . . . . 72 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 73
14.1. Normative References . . . . . . . . . . . . . . . . . . 72 14.1. Normative References . . . . . . . . . . . . . . . . . . 73
14.2. Informative References . . . . . . . . . . . . . . . . . 75 14.2. Informative References . . . . . . . . . . . . . . . . . 76
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 76
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 75 A.1. 07 - 08 . . . . . . . . . . . . . . . . . . . . . . . . . 76
A.1. 06 - 07 . . . . . . . . . . . . . . . . . . . . . . . . . 75 A.2. 06 - 07 . . . . . . . . . . . . . . . . . . . . . . . . . 76
A.2. 05 - 06 . . . . . . . . . . . . . . . . . . . . . . . . . 76 A.3. 05 - 06 . . . . . . . . . . . . . . . . . . . . . . . . . 77
A.3. 04 - 05 . . . . . . . . . . . . . . . . . . . . . . . . . 76 A.4. 04 - 05 . . . . . . . . . . . . . . . . . . . . . . . . . 77
A.4. 03 - 04 . . . . . . . . . . . . . . . . . . . . . . . . . 76 A.5. 03 - 04 . . . . . . . . . . . . . . . . . . . . . . . . . 78
A.5. 02 - 03 . . . . . . . . . . . . . . . . . . . . . . . . . 77 A.6. 02 - 03 . . . . . . . . . . . . . . . . . . . . . . . . . 78
A.6. 01 - 02 . . . . . . . . . . . . . . . . . . . . . . . . . 78 A.7. 01 - 02 . . . . . . . . . . . . . . . . . . . . . . . . . 79
A.7. 00 - 01 . . . . . . . . . . . . . . . . . . . . . . . . . 78 A.8. 00 - 01 . . . . . . . . . . . . . . . . . . . . . . . . . 80
A.8. bierman:restconf-04 to ietf:restconf-00 . . . . . . . . . 79 A.9. bierman:restconf-04 to ietf:restconf-00 . . . . . . . . . 80
Appendix B. Open Issues . . . . . . . . . . . . . . . . . . . . 79 Appendix B. Open Issues . . . . . . . . . . . . . . . . . . . . 81
Appendix C. Example YANG Module . . . . . . . . . . . . . . . . 80 Appendix C. Example YANG Module . . . . . . . . . . . . . . . . 81
C.1. example-jukebox YANG Module . . . . . . . . . . . . . . . 80 C.1. example-jukebox YANG Module . . . . . . . . . . . . . . . 82
Appendix D. RESTCONF Message Examples . . . . . . . . . . . . . 86 Appendix D. RESTCONF Message Examples . . . . . . . . . . . . . 87
D.1. Resource Retrieval Examples . . . . . . . . . . . . . . . 86 D.1. Resource Retrieval Examples . . . . . . . . . . . . . . . 87
D.1.1. Retrieve the Top-level API Resource . . . . . . . . . 86 D.1.1. Retrieve the Top-level API Resource . . . . . . . . . 87
D.1.2. Retrieve The Server Module Information . . . . . . . 87 D.1.2. Retrieve The Server Module Information . . . . . . . 88
D.1.3. Retrieve The Server Capability Information . . . . . 88 D.1.3. Retrieve The Server Capability Information . . . . . 89
D.2. Edit Resource Examples . . . . . . . . . . . . . . . . . 89 D.2. Edit Resource Examples . . . . . . . . . . . . . . . . . 90
D.2.1. Create New Data Resources . . . . . . . . . . . . . . 89 D.2.1. Create New Data Resources . . . . . . . . . . . . . . 90
D.2.2. Detect Resource Entity Tag Change . . . . . . . . . . 90 D.2.2. Detect Resource Entity Tag Change . . . . . . . . . . 91
D.2.3. Edit a Datastore Resource . . . . . . . . . . . . . . 91 D.2.3. Edit a Datastore Resource . . . . . . . . . . . . . . 92
D.3. Query Parameter Examples . . . . . . . . . . . . . . . . 92 D.3. Query Parameter Examples . . . . . . . . . . . . . . . . 93
D.3.1. "content" Parameter . . . . . . . . . . . . . . . . . 92 D.3.1. "content" Parameter . . . . . . . . . . . . . . . . . 93
D.3.2. "depth" Parameter . . . . . . . . . . . . . . . . . . 95 D.3.2. "depth" Parameter . . . . . . . . . . . . . . . . . . 96
D.3.3. "fields" Parameter . . . . . . . . . . . . . . . . . 98 D.3.3. "fields" Parameter . . . . . . . . . . . . . . . . . 99
D.3.4. "insert" Parameter . . . . . . . . . . . . . . . . . 99 D.3.4. "insert" Parameter . . . . . . . . . . . . . . . . . 100
D.3.5. "point" Parameter . . . . . . . . . . . . . . . . . . 100 D.3.5. "point" Parameter . . . . . . . . . . . . . . . . . . 100
D.3.6. "filter" Parameter . . . . . . . . . . . . . . . . . 101 D.3.6. "filter" Parameter . . . . . . . . . . . . . . . . . 101
D.3.7. "start-time" Parameter . . . . . . . . . . . . . . . 101 D.3.7. "start-time" Parameter . . . . . . . . . . . . . . . 102
D.3.8. "stop-time" Parameter . . . . . . . . . . . . . . . . 101 D.3.8. "stop-time" Parameter . . . . . . . . . . . . . . . . 102
D.3.9. "with-defaults" Parameter . . . . . . . . . . . . . . 102 D.3.9. "with-defaults" Parameter . . . . . . . . . . . . . . 102
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 103 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 103
1. Introduction 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 describes an HTTP [RFC7230] based protocol called
RESTCONF, for accessing data defined in YANG [RFC6020], using RESTCONF, for accessing data defined in YANG version 1 [RFC6020] or
datastores defined in NETCONF [RFC6241]. YANG version 1.1 [I-D.ietf-netmod-rfc6020bis], using datastores
defined in NETCONF [RFC6241].
The NETCONF protocol defines configuration datastores and a set of The NETCONF protocol defines configuration datastores and a set of
Create, Retrieve, Update, Delete (CRUD) operations that can be used Create, Retrieve, Update, Delete (CRUD) operations that can be used
to access these datastores. The YANG language defines the syntax and to access these datastores. The YANG language defines the syntax and
semantics of datastore content, operational data, protocol semantics of datastore content, operational data, protocol
operations, and event notifications. RESTCONF uses HTTP operations operations, and event notifications. RESTCONF uses HTTP operations
to provide CRUD operations on a NETCONF datastore containing YANG- to provide CRUD operations on a NETCONF datastore containing YANG-
defined data. Since NETCONF protocol operations are not relevant, defined data. Since NETCONF protocol operations are not relevant,
the user should not need any prior knowledge of NETCONF in order to the user should not need any prior knowledge of NETCONF in order to
use RESTCONF. use RESTCONF.
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 [RFC7158].
Data-model specific protocol operations defined with the YANG "rpc" Data-model specific protocol operations defined with the YANG "rpc"
statement can be invoked with the POST method. Data-model specific or "action" statements can be invoked with the POST method. Data-
event notifications defined with the YANG "notification" statement model specific event notifications defined with the YANG
can be accessed. "notification" statement can be accessed.
1.1. Simple Subset of NETCONF Functionality 1.1. Simple Subset of NETCONF Functionality
An HTTP-based management protocol does not need to mirror the An HTTP-based management protocol does not need to mirror the
functionality of the NETCONF protocol, but it needs to be compatible functionality of the NETCONF protocol, but it needs to be compatible
with NETCONF. A simplified transaction model is needed that allows with NETCONF. A simplified transaction model is needed that allows
basic CRUD operations on a hierarchy of conceptual resources. This basic CRUD operations on a hierarchy of conceptual resources. This
represents a limited subset of the transaction capabilities of the represents a limited subset of the transaction capabilities of the
NETCONF protocol. NETCONF protocol.
skipping to change at page 6, line 5 skipping to change at page 6, line 16
deployment for as many use cases as possible. Additional deployment for as many use cases as possible. Additional
functionality can be defined in external documents, outside the scope functionality can be defined in external documents, outside the scope
of this document. of this document.
RESTCONF is not intended to replace NETCONF, but rather provide an RESTCONF is not intended to replace NETCONF, but rather provide an
additional simplified interface that follows REST principles and is additional simplified interface that follows REST principles and is
compatible with a resource-oriented device abstraction. compatible with a resource-oriented device abstraction.
The following figure shows the system components: The following figure shows the system components:
+-----------+ +-----------------+ +-----------+ +-----------------+
| Web app | <-------> | | | Web app | <-------> | |
+-----------+ HTTP | network device | +-----------+ HTTP | network device |
| | | |
+-----------+ | +-----------+ | +-----------+ | +-----------+ |
| NMS app | <-------> | | datastore | | | NMS app | <-------> | | datastore | |
+-----------+ NETCONF | +-----------+ | +-----------+ NETCONF | +-----------+ |
+-----------------+ +-----------------+
1.2. Data Model Driven API 1.2. Data Model Driven API
RESTCONF combines the simplicity of the HTTP protocol with the RESTCONF combines the simplicity of the HTTP protocol with the
predictability and automation potential of a schema-driven API. predictability and automation potential of a schema-driven API.
Using YANG, a client can predict all resource endpoints, much like Using YANG, a client can predict all resource endpoints, much like
using URI Templates [RFC6570], but in a more holistic manner. This using URI Templates [RFC6570], but in a more holistic manner. This
strategy obviates the need for responses provided by the server to strategy obviates the need for responses provided by the server to
contain HATEOAS links, originally described in Roy Fielding's contain HATEOAS links, originally described in Roy Fielding's
doctoral dissertation [rest-dissertation]. doctoral dissertation [rest-dissertation].
skipping to change at page 9, line 29 skipping to change at page 9, line 38
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.4.3. YANG
The following terms are defined in [RFC6020]: The following terms are defined in [I-D.ietf-netmod-rfc6020bis]:
o action
o container o container
o data node o data node
o key leaf o key leaf
o leaf o leaf
o leaf-list o leaf-list
skipping to change at page 9, line 40 skipping to change at page 10, line 4
o container o container
o data node o data node
o key leaf o key leaf
o leaf o leaf
o leaf-list o leaf-list
o list o list
o presence container (or P-container)
o RPC operation (now called protocol operation)
o 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 RPC operation (now called protocol operation)
1.4.4. Terms 1.4.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 and anyxml nodes can be data resources. leafs, list entries, anydata and anyxml nodes can be data
resources.
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
skipping to change at page 11, line 33 skipping to change at page 11, line 46
"{+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.4.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.4.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, "!"
skipping to change at page 13, line 16 skipping to change at page 13, line 31
number of authentication schemes but, in order to ensure number of authentication schemes but, in order to ensure
interoperability, the RESTCONF server MUST advertise at least one of interoperability, the RESTCONF server MUST advertise at least one of
the following authentication schemes: the following authentication schemes:
o Basic [draft-ietf-httpauth-basicauth-update-03] o Basic [draft-ietf-httpauth-basicauth-update-03]
o Digest [draft-ietf-httpauth-digest-09] o Digest [draft-ietf-httpauth-digest-09]
o ClientCertificate [draft-thomson-httpbis-cant-01] o ClientCertificate [draft-thomson-httpbis-cant-01]
These authentication schemes are selected for to their similarity to These authentication schemes are selected for their similarity to the
the authentication schemes supported by NETCONF. In particular, the authentication schemes supported by NETCONF. In particular, the
Basic and Digest authentication schemes both directly provide an Basic and Digest authentication schemes both directly provide an
identity and verification of a shared secret, much like NETCONF over identity and verification of a shared secret, much like NETCONF over
SSH, when using the SSH "password" authentication method [RFC4252]. SSH, when using the SSH "password" authentication method [RFC4252].
Similarly, the ClientCertificate authentication scheme is much like Similarly, the ClientCertificate authentication scheme is much like
NETCONF over TLS's use of X.509 client-certificates. When using the NETCONF over TLS's use of X.509 client-certificates. When using the
ClientCertificate authentication scheme, the RESTCONF server MUST ClientCertificate authentication scheme, the RESTCONF server MUST
derive the identity of the RESTCONF client using the algorithm derive the identity of the RESTCONF client using the algorithm
defined in Section 7 of [draft-ietf-netconf-rfc5539bis-10]. defined in Section 7 of [draft-ietf-netconf-rfc5539bis-10].
The RESTCONF client identity determined from any HTTP authentication The RESTCONF client identity determined from any HTTP authentication
skipping to change at page 14, line 36 skipping to change at page 15, line 5
GET /.well-known/host-meta users HTTP/1.1 GET /.well-known/host-meta users 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>
Once discovering the RESTCONF API root, the client MUST prepend it to Once discovering the RESTCONF API root, the client MUST prepend it to
any subsequent request to a RESTCONF resource. For instance, using any subsequent request to a RESTCONF resource. For instance, using
the "/restconf" path discovered above, the client can now determine the "/restconf" path discovered above, the client can now determine
the operations supported by the the server. In this example a custom the operations supported by the the server. In this example a custom
"play" operation is supported: "play" operation is supported:
Request Request
------- -------
GET /restconf/operations HTTP/1.1 GET /restconf/operations HTTP/1.1
skipping to change at page 15, line 21 skipping to change at page 15, line 31
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" : { "play" : [ null ] } } { "operations" : { "example-jukebox:play" : [ null ] } }
3.2. RESTCONF Resource Types 3.2. RESTCONF Resource 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 |
+-----------+---------------------------------+ +-----------+---------------------------------+
skipping to change at page 16, line 7 skipping to change at page 16, line 17
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
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:
skipping to change at page 16, line 42 skipping to change at page 17, line 5
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.
Example: Example:
This example request by the client would retrieve only the non- This example request by the client would retrieve only the non-
configuration data nodes that exist within the "library" resource, configuration data nodes that exist within the "library" resource,
using the "content" query parameter (see Section 4.8.1). using the "content" query parameter (see Section 4.8.1).
GET /restconf/data/example-jukebox:jukebox/library GET /restconf/data/example-jukebox:jukebox/library
?content=nonconfig HTTP/1.1 ?content=nonconfig HTTP/1.1
Host: example.com Host: example.com
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 operations defined in the YANG modules Any data-model specific protocol operations defined in the YANG
advertised by the server MAY be available as child nodes of this modules advertised by the server MAY be available as child nodes of
resource. this resource.
Operation resources are defined in Section 3.6. Operation resources are defined in Section 3.6.
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 only be written directly with the
PATCH method. Each RESTCONF edit of a datastore resource is saved to PATCH method. Each RESTCONF edit of a datastore resource is saved to
non-volatile storage in an implementation-specific matter by the non-volatile storage by the server.
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
skipping to change at page 18, line 36 skipping to change at page 18, line 38
resources within the datastore affect the timestamp. 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 The server MUST maintain an entity tag for the top-level {+restconf}/
{+restconf}/data resource and SHOULD maintain entity tags for data resource and SHOULD maintain entity tags for descendant
descendant resources. For all resources, the server MUST return the resources. For all resources, the server MUST return the "ETag"
"ETag" header when the resource is retrieved with the GET or HEAD header when the resource is retrieved with the GET or HEAD methods.
methods. If the server does not maintain an entity tag for a If the server does not maintain an entity tag for a resource, it MUST
resource, it MUST return the entity tag of the resource's ancestor, a return the entity tag of the resource's ancestor, a process that may
process that may recurse up to the top-level {+restconf}/data recurse up to the top-level {+restconf}/data resource. Only changes
resource. Only changes to configuration data resources within the to configuration data resources within the datastore affect the
datastore affect the entity tag. entity tag.
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 and anyxml nodes are data resources. leafs, 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 MAY 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
skipping to change at page 19, line 52 skipping to change at page 20, line 6
A predictable location for a data resource is important, since A predictable location for a data resource is important, since
applications will code to the YANG data model module, which uses applications will code to the YANG data model module, which uses
static naming and defines an absolute path location for all data static naming and defines an absolute path location for all data
nodes. nodes.
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. 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
name followed by a colon character (":") is prepended to the node
name in the resource identifier. See Section 3.5.1.1 for details.
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 "=" followed by
the single key leaf value. 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 value of each leaf
identified in the "key" statement is encoded in the order identified in the "key" statement is encoded in the order
specified in the YANG "key" statement, with a comma separating specified in the YANG "key" statement, with a comma separating
them. them.
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 encoded with escape sequences, according to [RFC2396], MUST be percent-encoded, according to [RFC3986], section 2.1.
Section 2.4.
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 Quoted strings are supported in the key leaf values. Quoted o Quoted strings are not allowed in the key leaf values. A missing
strings MUST be used to express empty strings. (example: key value is interpreted a zero-length string. (example:
list=foo,'',baz). 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.
Examples: Examples:
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; }
} }
} }
} }
For the above YANG definition, URI with key leaf values will be For the above YANG definition, URI with key leaf values will be
encoded as follows (line wrapped for display purposes only): encoded as follows (line wrapped for display purposes only):
/restconf/data/example-top:top/list1=key1val,key2val,key3val3/ /restconf/data/example-top:top/list1=key1val,key2val,key3val3/
list2=key4val,key5val/X list2=key4val,key5val/X
The following example shows how reserved characters are percent-
encoded within a key value. The value of 'key1' contains a comma,
single-quote, double-quote, colon, space, and forward slash. (,'": /
). Note that the angle brackets ('<', '>'), and double-quote ('"')
are not reserved characters and do not need to be percent-encoded.
Example URL:
/restconf/data/example-top:top/list2=key1/X
/restconf/data/example-top:top/list2=%2C%27"%3A%20%2F/X
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" ABNF syntax is used to construct RESTCONF path
identifiers: identifiers:
api-path = "/" | api-path = "/" |
("/" api-identifier ("/" api-identifier
0*("/" (api-identifier | list-instance ))) 0*("/" (api-identifier | list-instance )))
skipping to change at page 22, line 27 skipping to change at page 22, line 33
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
the YANG "rpc" statement. It is invoked using a POST method on the one of the YANG "action" or "rpc" statements. It is invoked using a
operation resource. POST method on the operation resource.
POST {+restconf}/operations/<operation> An RPC operation is invoked as:
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" operation, then invoking For example, if "module-A" defined a "reset" rpc operation, then
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
If the "rpc" statement has an "input" section, then a message-body An action is invoked as:
MAY be sent by the client in the request, otherwise the request
message MUST NOT include a message-body.
If the operation is successfully invoked, and if the "rpc" statement POST {+restconf}/data/<data-resource-identifier>/<operation>
has an "output" section, then a message-body MAY be sent by the where <data-resource-identifier> contains the path to the data node
server in the response, otherwise the response message MUST NOT where the action is defined, and <operation> is the name of the
include a message-body in the response message, and MUST send a "204 action.
No Content" status-line instead.
For example, if "module-A" defined a "reset-all" action in the
container "interfaces", then invoking this action would be requested
as follows:
POST /restconf/data/module-A:interfaces/reset-all HTTP/1.1
Server example.com
If the "action" or "rpc" statement has an "input" section, then a
message-body MAY be sent by the client in the request, otherwise the
request message MUST NOT include a message-body.
If the operation is successfully invoked, and if the "action" or
"rpc" statement has an "output" section, then a message-body MAY be
sent by the server in the response, otherwise the response message
MUST NOT include a message-body in the response message, and MUST
send a "204 No Content" status-line instead.
If the operation is not successfully invoked, then a message-body If the operation is not successfully invoked, then a message-body
SHOULD be sent by the server, containing an "errors" resource, as SHOULD be sent by the server, containing an "errors" resource, as
defined in Section 3.9. defined in Section 3.9.
3.6.1. Encoding Operation Input Parameters 3.6.1. Encoding Operation Input Parameters
If the "rpc" statement has an "input" section, then the "input" node If the "action" or "rpc" statement has an "input" section, then the
is provided in the message-body, corresponding to the YANG data "input" node is provided in the message-body, corresponding to the
definition statements within the "input" section. YANG data definition statements within the "input" section.
Example: Example:
The following YANG definition is used for the examples in this The following YANG definition is used for the examples in this
section. 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";
skipping to change at page 23, line 50 skipping to change at page 24, line 22
type uint32; type uint32;
} }
leaf message { type string; } leaf message { type string; }
leaf language { type string; } leaf language { type string; }
} }
} }
} }
The client might send the following POST request message: 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">
<delay>600</delay> <input xmlns="https://example.com/ns/example-ops">
<message>Going down for system maintenance</message> <delay>600</delay>
<language>en-US</language> <message>Going down for system maintenance</message>
</input> <language>en-US</language>
</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 3.6.2. Encoding Operation Output Parameters
If the "rpc" statement has an "output" section, then the "output" If the "action" or "rpc" statement has an "output" section, then the
node is provided in the message-body, corresponding to the YANG data "output" node is provided in the message-body, corresponding to the
definition statements within the "output" section. YANG data definition statements within the "output" section.
Example: 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. the examples in this section.
The client might send the following POST request message: The client might send the following POST request message:
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" : {
skipping to change at page 25, line 14 skipping to change at page 25, line 33
3.6.3. Encoding Operation Errors 3.6.3. Encoding Operation Errors
If any errors occur while attempting to invoke the operation, then an If any errors occur while attempting to invoke the operation, then an
"errors" data structure is returned with the appropriate error "errors" data structure is returned with the appropriate error
status. status.
Using the "reset" operation example above, the client might send the Using the "reset" operation example above, the client might send the
following POST request message: 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:err="https://example.com/ns/example-ops">
err:input/err:delay err:input/err:delay
</error-path> </error-path>
<error-message>Invalid input parameter</error-message> <error-message>Invalid input parameter</error-message>
</error> </error>
</errors> </errors>
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, using the "ietf-yang-library" module, 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.
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,2014-07-03/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: Mon, 25 Apr 2012 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-06-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-06-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:
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
skipping to change at page 29, line 14 skipping to change at page 29, line 35
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.
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 "library" resource: representation of the "library" resource:
GET /restconf/data/example-jukebox:jukebox/ GET /restconf/data/example-jukebox:jukebox/
library/artist=Foo%20Fighters/album HTTP/1.1 library/artist=Foo%20Fighters/album HTTP/1.1
Host: example.com Host: example.com
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: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> <name>Wasting Light</name>
<genre xmlns:g="http://example.com/ns/example-jukebox"> <genre xmlns:g="http://example.com/ns/example-jukebox">
g:alternative g:alternative
</genre> </genre>
<year>2011</2011> <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 42 skipping to change at page 31, line 15
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" : [null] }
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
Last-Modified: Mon, 23 Apr 2012 17:01:00 GMT Last-Modified: Mon, 23 Apr 2012 17:01:00 GMT
ETag: b3a3e673be2 ETag: b3a3e673be2
Refer to Appendix D.2.1 for more resource creation examples. Refer to Appendix D.2.1 for more resource creation examples.
4.4.2. Invoke Operation Mode 4.4.2. Invoke Operation Mode
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.
skipping to change at page 31, line 41 skipping to change at page 32, line 12
{ {
"example-jukebox:input" : { "example-jukebox:input" : {
"playlist" : "Foo-One", "playlist" : "Foo-One",
"song-number" : 2 "song-number" : 2
} }
} }
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. resource.
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.
skipping to change at page 32, line 28 skipping to change at page 32, line 48
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/
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
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"example-jukebox:album" : { "example-jukebox:album" : {
"name" : "Wasting Light", "name" : "Wasting Light",
"genre" : "example-jukebox:alternative", "genre" : "example-jukebox:alternative",
"year" : 2011 "year" : 2011
} }
} }
If the resource is updated, the server might respond: If the resource is updated, the server might respond:
skipping to change at page 32, line 42 skipping to change at page 33, line 14
{ {
"example-jukebox:album" : { "example-jukebox:album" : {
"name" : "Wasting Light", "name" : "Wasting Light",
"genre" : "example-jukebox:alternative", "genre" : "example-jukebox:alternative",
"year" : 2011 "year" : 2011
} }
} }
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
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 type needs a unique
media type. Zero or more PATCH media types MAY be supported by the media type. Zero or more PATCH media types MAY be supported by the
server. The media types supported by a server can be discovered by server. The media types supported by a server can be discovered by
the client by sending an OPTIONS request (see Section 4.1). the client by sending an OPTIONS request (see Section 4.1).
skipping to change at page 33, line 43 skipping to change at page 34, line 18
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.
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
If-Match: b8389233a4c If-Match: b8389233a4c
Content-Type: application/yang.data+xml Content-Type: application/yang.data+xml
<album xmlns="http://example.com/ns/example-jukebox"> <album xmlns="http://example.com/ns/example-jukebox">
<year>2011</year> <year>2011</year>
</album> </album>
If the field is updated, the server might respond: If the field is updated, the server might respond:
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Date: Mon, 23 Apr 2012 17:49:30 GMT Date: Mon, 23 Apr 2012 17:49:30 GMT
Server: example-server Server: example-server
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" or "404 Not Found"
status-line is returned to the client. All other error responses are status-line is returned to the client. All other error responses are
handled according to the procedures defined in Section 7. handled according to the procedures defined in Section 7.
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
If the resource is deleted, the server might respond: If the resource is deleted, the server might respond:
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Date: Mon, 23 Apr 2012 17:49:40 GMT Date: Mon, 23 Apr 2012 17:49:40 GMT
Server: example-server Server: example-server
4.8. Query Parameters 4.8. Query Parameters
Each RESTCONF operation allows zero or more query parameters to be Each RESTCONF operation allows zero or more query parameters to be
present in the request URI. The specific parameters that are allowed present in the request URI. The specific parameters that are allowed
depends on the resource type, and sometimes the specific target depends on the resource type, and sometimes the specific target
resource used, in the request. resource used, in the request.
+---------------+---------+-----------------------------------------+ +-------------------+-------------+---------------------------------+
| Name | Methods | Description | | Name | Methods | Description |
+---------------+---------+-----------------------------------------+ +-------------------+-------------+---------------------------------+
| content | GET | Select config and/or non-config data | | content | GET | Select config and/or non-config |
| | | resources | | | | data resources |
| depth | GET | Request limited sub-tree depth in the | | depth | GET | Request limited sub-tree depth |
| | | reply content | | | | in the reply content |
| fields | GET | Request a subset of the target resource | | fields | GET | Request a subset of the target |
| | | contents | | | | resource contents |
| filter | GET | Boolean notification filter for event | | filter | GET | Boolean notification filter for |
| | | stream resources | | | | event stream resources |
| insert | POST, | Insertion mode for user-ordered data | | insert | POST, PUT | Insertion mode for user-ordered |
| | PUT | resources | | | | data resources |
| point | POST, | Insertion point for user-ordered data | | point | POST, PUT | Insertion point for user- |
| | PUT | resources | | | | ordered data resources |
| start-time | GET | Replay buffer start time for event | | start-time | GET | Replay buffer start time for |
| | | stream resources | | | | event stream resources |
| stop-time | GET | Replay buffer stop time for event | | stop-time | GET | Replay buffer stop time for |
| | | stream resources | | | | event stream resources |
| with-defaults | GET | Control retrieval of default values | | with-defaults | GET | Control retrieval of default |
+---------------+---------+-----------------------------------------+ | | | values |
+-------------------+-------------+---------------------------------+
RESTCONF Query Parameters RESTCONF Query Parameters
Query parameters can be given in any order. Each parameter can Query parameters can be given in any order. Each parameter can
appear at most once in a request URI. A default value may apply if appear at most once in a request URI. A default value may apply if
the parameter is missing. the parameter is missing.
Refer to Appendix D.3 for examples of query parameter usage. Refer to Appendix D.3 for examples of query parameter usage.
If vendors define additional query parameters, they SHOULD use a If vendors define additional query parameters, they SHOULD use a
skipping to change at page 36, line 20 skipping to change at page 36, line 39
the requested data nodes. If the "config" value is "false", then the the requested data nodes. If the "config" value is "false", then the
default for the "content" parameter is "nonconfig". If "config" is default for the "content" parameter is "nonconfig". If "config" is
"true" then the default for the "content" parameter is "config". "true" then the default for the "content" parameter is "config".
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. Any child nodes which consists of the requested data node itself. If the "fields"
are contained within a parent node have a depth value that is 1 parameter (Section 4.8.3) is used to select descendant data nodes,
greater than its parent. these nodes all have a depth value of 1. 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 error is returned if it used for
other methods or resource types. other methods or resource types.
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
skipping to change at page 36, line 49 skipping to change at page 37, line 23
4.8.3. The "fields" Query Parameter 4.8.3. The "fields" Query Parameter
The "fields" query parameter is used to optionally identify data The "fields" query parameter is used to optionally identify data
nodes within the target resource to be retrieved in a GET method. nodes within the target resource to be retrieved in a GET method.
The client can use this parameter to retrieve a subset of all nodes The client can use this parameter to retrieve a subset of all nodes
in a resource. in a resource.
A value of the "fields" query parameter matches the following rule: A value of the "fields" query parameter matches the following rule:
fields-expr = path '(' fields-expr / '*' ')' / fields-expr = path '(' fields-expr ')' /
path ';' fields-expr / path ';' fields-expr /
path path
path = api-identifier [ '/' path ] path = api-identifier [ '/' path ]
"api-identifier" is defined in Section 3.5.1.1. "api-identifier" is defined in Section 3.5.1.1.
";" is used to select multiple nodes. For example, to retrieve only ";" is used to select multiple nodes. For example, to retrieve only
the "genre" and "year" of an album, use: "fields=genre;year". the "genre" and "year" of an album, use: "fields=genre;year".
Parentheses are used to specify sub-selectors of a node. For Parentheses are used to specify sub-selectors of a node.
example, to retrieve only the "label" and "catalogue-number" of an
album, use: "fields=admin(label;catalogue-number)". For example, assume the target resource is the 'album' list. To
retrieve only the "label" and "catalogue-number" of the "admin"
container within an album, use:
"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: example, to retrieve only the "label" of an album, use: "fields=admin
"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 error is returned if used for
other methods or resource types. other methods or resource types.
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.
The allowed values are: The allowed values are:
+--------+----------------------------------------------------------+ +-----------+-------------------------------------------------------+
| Value | Description | | Value | Description |
+--------+----------------------------------------------------------+ +-----------+-------------------------------------------------------+
| first | Insert the new data as the new first entry. | | first | Insert the new data as the new first entry. |
| last | Insert the new data as the new last entry. | | last | Insert the new data as the new last entry. |
| before | Insert the new data before the insertion point, as | | before | Insert the new data before the insertion point, as |
| | specified by the value of the "point" parameter. | | | specified by the value of the "point" parameter. |
| after | Insert the new data after the insertion point, as | | after | Insert the new data after the insertion point, as |
| | 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.
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
skipping to change at page 40, line 41 skipping to change at page 41, line 15
4.8.9. The "with-defaults" Query Parameter 4.8.9. The "with-defaults" Query Parameter
The "with-defaults" parameter is used to specify how information The "with-defaults" parameter is used to specify how information
about default data nodes should be returned in response to GET about default data nodes should be returned in response to GET
requests on data resources. requests on data resources.
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 are not | | trim | Data nodes set to the YANG default |
| | reported | | | are not reported |
| explicit | Data nodes set by the client are not reported | | explicit | Data nodes set by the client are not |
| report-all-tagged | All data nodes are reported and defaults are | | | reported |
| | tagged | | report-all-tagged | All data nodes are reported and |
+-------------------+-----------------------------------------------+ | | 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
skipping to change at page 41, line 45 skipping to change at page 42, line 21
which allows multiple datastore edits within a single message. which allows multiple datastore edits within a single message.
5.1. Request URI Structure 5.1. Request URI Structure
Resources are represented with URIs following the structure for Resources are represented with URIs following the structure for
generic URIs in [RFC3986]. generic URIs in [RFC3986].
A RESTCONF operation is derived from the HTTP method and the request A RESTCONF operation is derived from the HTTP method and the request
URI, using the following conceptual fields: URI, using the following conceptual fields:
<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 <text> replaced by client with real values
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.
skipping to change at page 42, line 38 skipping to change at page 43, line 8
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
use by the client. Each optional query parameter is identified by use by the client. Each optional query parameter is identified by
a URI. The server MUST list the optional query parameter URIs it a URI. The server MUST list the optional query parameter URIs it
supports in the "capabilities" list defined in Section 9.3. supports in the "capabilities" list defined in Section 9.3.
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 [RFC2396], Section 3.4. Any reserved characters MUST be according to [RFC3986], Section 3.4. Any reserved characters MUST be
encoded with escape sequences, according to [RFC2396], Section 2.4. 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 MUST use 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.
skipping to change at page 43, line 18 skipping to change at page 43, line 34
Messages are not limited to the HTTP headers listed in this section. Messages are not limited to the HTTP headers listed in this section.
HTTP defines which header lines are required for particular HTTP defines which header lines are required for particular
circumstances. Refer to each operation definition section in circumstances. Refer to each operation definition section in
Section 4 for examples on how particular headers are used. Section 4 for examples on how particular headers are used.
There are some request headers that are used within RESTCONF, usually There are some request headers that are used within RESTCONF, usually
applied to data resources. The following tables summarize the applied to data resources. The following tables summarize the
headers most relevant in RESTCONF message requests: headers most relevant in RESTCONF message requests:
+---------------------+---------------------------------------------+ +-----------------------------+-------------------------------------+
| Name | Description | | Name | Description |
+---------------------+---------------------------------------------+ +-----------------------------+-------------------------------------+
| Accept | Response Content-Types that are acceptable | | Accept | Response Content-Types that are |
| Content-Type | The media type of the request body | | | acceptable |
| Host | The host address of the server | | Content-Type | The media type of the request body |
| If-Match | Only perform the action if the entity | | Host | The host address of the server |
| | matches ETag | | If-Match | Only perform the action if the |
| If-Modified-Since | Only perform the action if modified since | | | entity matches ETag |
| | time | | If-Modified-Since | Only perform the action if modified |
| If-Unmodified-Since | Only perform the action if un-modified | | | since time |
| | since time | | If-Unmodified-Since | Only perform the action if un- |
+---------------------+---------------------------------------------+ | | modified since time |
+-----------------------------+-------------------------------------+
RESTCONF Request Headers RESTCONF Request Headers
The following tables summarize the headers most relevant in RESTCONF The following tables summarize the headers most relevant in RESTCONF
message responses: message responses:
+---------------+---------------------------------------------------+ +-----------------------+-------------------------------------------+
| Name | Description | | Name | Description |
+---------------+---------------------------------------------------+ +-----------------------+-------------------------------------------+
| Allow | Valid actions when 405 error returned | | Allow | Valid actions when 405 error returned |
| Cache-Control | The cache control parameters for the response | | Cache-Control | The cache control parameters for the |
| Content-Type | The media type of the response message-body | | | response |
| Date | The date and time the message was sent | | Content-Type | The media type of the response message- |
| ETag | An identifier for a specific version of a | | | body |
| | resource | | Date | The date and time the message was sent |
| Last-Modified | The last modified date and time of a resource | | ETag | An identifier for a specific version of a |
| Location | The resource identifier for a newly created | | | resource |
| | resource | | Last-Modified | The last modified date and time of a |
+---------------+---------------------------------------------------+ | | resource |
| Location | The resource identifier for a newly |
| | created resource |
+-----------------------+-------------------------------------------+
RESTCONF Response Headers RESTCONF Response Headers
5.3. Message Encoding 5.3. 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 encoding and MAY support JSON encoding. XML encoding support XML or JSON encoding. XML encoding rules for data nodes are
rules for data nodes are defined in [RFC6020]. The same encoding defined in [I-D.ietf-netmod-rfc6020bis]. The same encoding rules are
rules are used for all XML content. JSON encoding rules are defined used for all XML content. JSON encoding rules are defined in
in [I-D.ietf-netmod-yang-json]. This encoding is valid JSON, but [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
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.
Response output content encoding format is identified with the Accept The server MUST support the "Accept" header and "406 Not Acceptable"
header in the request, or if is not specified, the request input status code, as defined in [RFC7231]. Response output content
encoding format is used. If there was no request input, then the encoding format is identified with the Accept header in the request.
default output encoding is XML. File extensions encoded in the If is not specified, the request input encoding format is used. If
request are not used to identify format encoding. there was no request input, then the default output encoding is XML
or JSON, depending or server preference. File extensions encoded in
the request are not used to identify format encoding.
5.4. RESTCONF Meta-Data 5.4. 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].
skipping to change at page 44, line 41 skipping to change at page 45, line 14
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 "report-all-tagged" mode for the "with-defaults" query parameter
requires that a "default" attribute be returned for default nodes.
This example shows that attribute for the "mtu" leaf .
5.4.1. XML MetaData Encoding Example
GET /restconf/data/interfaces/interface=eth1
?with-defaults=report-all-tagged HTTP/1.1
Host: example.com
Accept: application/yang.data+xml
The server might respond as follows.
HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server
Content-Type: application/yang.data+xml
<interface
xmlns="urn:example.com:params:xml:ns:yang:example-interface">
<name>eth1</name>
<mtu xmlns:wd="urn:ietf:params:xml:ns:netconf:default:1.0"
wd:default="true">1500</mtu>
<status>up</status>
</interface>
5.4.2. JSON MetaData Encoding Example
Note that RFC 6243 defines the "default" attribute with XSD, not
YANG, so the YANG module name has to be assigned manually. The value
"ietf-netconf-with-defaults" is assigned for JSON meta-data encoding.
GET /restconf/data/interfaces/interface=eth1
?with-defaults=report-all-tagged HTTP/1.1
Host: example.com
Accept: application/yang.data+json
The server might respond as follows.
HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server
Content-Type: application/yang.data+json
{
"example:interface": [
{
"name" : "eth1",
"mtu" : 1500,
"@mtu": {
"ietf-netconf-with-defaults:default" : true
},
"status" : "up"
}
]
}
5.5. Return Status 5.5. 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.6. 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" Instead of using HTTP caching, the client SHOULD track the "ETag" and
and/or "Last-Modified" headers returned by the server for the /or "Last-Modified" headers returned by the server for the datastore
datastore resource (or data resource if the server supports it). A resource (or data resource if the server supports it). A retrieval
retrieval request for a resource can include the "If-None-Match" and/ request for a resource can include the "If-None-Match" and/or
or "If-Modified-Since" headers, which will cause the server to return "If-Modified-Since" headers, which will cause the server to return a
a "304 Not Modified" status-line if the resource has not changed. "304 Not Modified" status-line if the resource has not changed. The
The client MAY use the HEAD method to retrieve just the message client MAY use the HEAD method to retrieve just the message headers,
headers, which SHOULD include the "ETag" and "Last-Modified" headers, which SHOULD include the "ETag" and "Last-Modified" headers, if this
if this meta-data is maintained for the target resource. 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
skipping to change at page 46, line 7 skipping to change at page 47, line 36
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
specify the structure and syntax of the conceptual child resources specify the structure and syntax of the conceptual child resources
within the "streams" resource. within the "streams" resource.
For example: For example:
The client might send the following request: The client might send the following request:
GET /restconf/data/ietf-restconf-monitoring:restconf-state/ GET /restconf/data/ietf-restconf-monitoring:restconf-state/
streams HTTP/1.1 streams HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+xml Accept: application/yang.data+xml
The server might send the following response: The server might send the following response:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/yang.api+xml Content-Type: application/yang.api+xml
<streams
xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring"> <streams
<stream> xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring">
<name>NETCONF</name> <stream>
<description>default NETCONF event stream <name>NETCONF</name>
</description> <description>default NETCONF event stream
<replay-support>true</replay-support> </description>
<replay-log-creation-time> <replay-support>true</replay-support>
2007-07-08T00:00:00Z <replay-log-creation-time>
</replay-log-creation-time> 2007-07-08T00:00:00Z
<access> </replay-log-creation-time>
<encoding>xml</encoding> <access>
<location>https://example.com/streams/NETCONF <encoding>xml</encoding>
</location> <location>https://example.com/streams/NETCONF
</access> </location>
<access> </access>
<encoding>json</encoding> <access>
<location>https://example.com/streams/NETCONF-JSON <encoding>json</encoding>
</location> <location>https://example.com/streams/NETCONF-JSON
</access> </location>
</stream> </access>
<stream> </stream>
<name>SNMP</name> <stream>
<description>SNMP notifications</description> <name>SNMP</name>
<replay-support>false</replay-support> <description>SNMP notifications</description>
<access> <replay-support>false</replay-support>
<encoding>xml</encoding> <access>
<location>https://example.com/streams/SNMP</location> <encoding>xml</encoding>
</access> <location>https://example.com/streams/SNMP</location>
</stream> </access>
<stream> </stream>
<name>syslog-critical</name> <stream>
<description>Critical and higher severity <name>syslog-critical</name>
</description> <description>Critical and higher severity
<replay-support>true</replay-support> </description>
<replay-log-creation-time> <replay-support>true</replay-support>
2007-07-01T00:00:00Z <replay-log-creation-time>
</replay-log-creation-time> 2007-07-01T00:00:00Z
<access> </replay-log-creation-time>
<encoding>xml</encoding> <access>
<location> <encoding>xml</encoding>
https://example.com/streams/syslog-critical <location>
</location> https://example.com/streams/syslog-critical
</access> </location>
</stream> </access>
</streams> </stream>
</streams>
6.3. Subscribing to Receive Notifications 6.3. Subscribing to Receive Notifications
RESTCONF clients can determine the URL for the subscription resource RESTCONF clients can determine the URL for the subscription resource
(to receive notifications) by sending an HTTP GET request for the (to receive notifications) by sending an HTTP GET request for the
"location" leaf with the stream list entry. The value returned by "location" leaf with the stream list entry. The value returned by
the server can be used for the actual notification subscription. the server can be used for the actual notification subscription.
The client will send an HTTP GET request for the URL returned by the The client will send an HTTP GET request for the URL returned by the
server with the "Accept" type "text/event-stream". server with the "Accept" type "text/event-stream".
skipping to change at page 48, line 25 skipping to change at page 49, line 18
The server will treat the connection as an event stream, using the The server will treat the connection as an event stream, using the
Server Sent Events [W3C.CR-eventsource-20121211] transport strategy. Server Sent Events [W3C.CR-eventsource-20121211] transport strategy.
The server MAY support query parameters for a GET method on this The server MAY support query parameters for a GET method on this
resource. These parameters are specific to each notification stream. resource. These parameters are specific to each notification stream.
For example: For example:
The client might send the following request: The client might send the following request:
GET /restconf/data/ietf-restconf-monitoring:restconf-state/ GET /restconf/data/ietf-restconf-monitoring:restconf-state/
streams/stream=NETCONF/access=xml/location HTTP/1.1 streams/stream=NETCONF/access=xml/location HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+xml Accept: application/yang.data+xml
The server might send the following response: The server might send the following response:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/yang.api+xml Content-Type: application/yang.api+xml
<location <location
xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring"> xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring">
https://example.com/streams/NETCONF https://example.com/streams/NETCONF
</location> </location>
The RESTCONF client can then use this URL value to start monitoring The RESTCONF client can then use this URL value to start monitoring
the event stream: the event stream:
GET /streams/NETCONF HTTP/1.1 GET /streams/NETCONF HTTP/1.1
Host: example.com Host: example.com
Accept: text/event-stream Accept: text/event-stream
Cache-Control: no-cache Cache-Control: no-cache
Connection: keep-alive Connection: keep-alive
A RESTCONF client MAY request the server compress the events using A RESTCONF client MAY request the server compress the events using
the HTTP header field "Accept-Encoding". For instance: the HTTP header field "Accept-Encoding". For instance:
GET /streams/NETCONF HTTP/1.1 GET /streams/NETCONF HTTP/1.1
Host: example.com Host: example.com
Accept: text/event-stream Accept: text/event-stream
Cache-Control: no-cache Cache-Control: no-cache
Connection: keep-alive Connection: keep-alive
Accept-Encoding: gzip, deflate Accept-Encoding: gzip, deflate
6.3.1. NETCONF Event Stream 6.3.1. NETCONF Event Stream
The server SHOULD support the "NETCONF" notification stream defined The server SHOULD support the "NETCONF" notification stream defined
in [RFC5277]. For this stream, RESTCONF notification subscription in [RFC5277]. For this stream, RESTCONF notification subscription
requests MAY specify parameters indicating the events it wishes to requests MAY specify parameters indicating the events it wishes to
receive. These query parameters are optional to implement, and only receive. These query parameters are optional to implement, and only
available if the server supports them. available if the server supports them.
+------------+---------+-------------------------+ +------------+---------+-------------------------+
skipping to change at page 49, line 47 skipping to change at page 50, line 40
RESTCONF notifications are encoded according to the definition of the RESTCONF notifications are encoded according to the definition of the
event stream. The NETCONF stream defined in [RFC5277] is encoded in event stream. The NETCONF stream defined in [RFC5277] is encoded in
XML format. XML format.
The structure of the event data is based on the "notification" The structure of the event data is based on the "notification"
element definition in Section 4 of [RFC5277]. It MUST conform to the element definition in Section 4 of [RFC5277]. It MUST conform to the
schema for the "notification" element in Section 4 of [RFC5277], schema for the "notification" element in Section 4 of [RFC5277],
except the XML namespace for this element is defined as: except the XML namespace for this element is defined as:
urn:ietf:params:xml:ns:yang:ietf-restconf urn:ietf:params:xml:ns:yang:ietf-restconf
For JSON encoding purposes, the module name for the "notification" For JSON encoding purposes, the module name for the "notification"
element is "ietf-restconf". element is "ietf-restconf".
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.
skipping to change at page 50, line 27 skipping to change at page 51, line 19
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; }
} }
} }
An example SSE event notification encoded using XML: An example SSE event notification encoded using XML:
data: <notification data: <notification
data: xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"> data: xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
data: <event-time>2013-12-21T00:01:00Z</event-time> data: <event-time>2013-12-21T00:01:00Z</event-time>
data: <event xmlns="http://example.com/event/1.0"> data: <event xmlns="http://example.com/event/1.0">
data: <event-class>fault</event-class> data: <event-class>fault</event-class>
data: <reporting-entity> data: <reporting-entity>
data: <card>Ethernet0</card> data: <card>Ethernet0</card>
data: </reporting-entity> data: </reporting-entity>
data: <severity>major</severity> data: <severity>major</severity>
data: </event> data: </event>
data: </notification> data: </notification>
An example SSE event notification encoded using JSON: An example SSE event notification encoded using JSON:
data: { data: {
data: "ietf-restconf:notification": { data: "ietf-restconf:notification": {
data: "event-time": "2013-12-21T00:01:00Z", data: "event-time": "2013-12-21T00:01:00Z",
data: "example-mod:event": { data: "example-mod:event": {
data: "event-class": "fault", data: "event-class": "fault",
data: "reporting-entity": { "card": "Ethernet0" }, data: "reporting-entity": { "card": "Ethernet0" },
data: "severity": "major" data: "severity": "major"
data: } data: }
data: } data: }
data: } data: }
Alternatively, since neither XML nor JSON are whitespace sensitive, Alternatively, since neither XML nor JSON are whitespace sensitive,
the above messages can be encoded onto a single line. For example: the above messages can be encoded onto a single line. For example:
For example: ('\' line wrapping added for formatting only) For example: ('\' line wrapping added for formatting only)
XML: XML:
data: <notification xmlns="urn:ietf:params:xml:ns:yang:ietf-rest\ data: <notification xmlns="urn:ietf:params:xml:ns:yang:ietf-rest\
conf"><event-time>2013-12-21T00:01:00Z</event-time><event xmlns="\ conf"><event-time>2013-12-21T00:01:00Z</event-time><event xmlns="\
skipping to change at page 52, line 5 skipping to change at page 52, line 37
HTTP status-lines are used to report success or failure for RESTCONF HTTP status-lines are used to report success or failure for RESTCONF
operations. The <rpc-error> element returned in NETCONF error operations. The <rpc-error> element returned in NETCONF error
responses contains some useful information. This error information responses contains some useful information. This error information
is adapted for use in RESTCONF, and error information is returned for is adapted for use in RESTCONF, and error information is returned for
"4xx" class of status codes. "4xx" class of status codes.
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 | | 202 Accepted | POST to create a resource accepted |
| 204 No Content | Success without response message-body | | 204 No Content | Success without response message- |
| 304 Not Modified | Conditional operation not done | | | body |
| 400 Bad Request | Invalid request message | | 304 Not Modified | Conditional operation not done |
| 403 Forbidden | Access to resource denied | | 400 Bad Request | Invalid request message |
| 404 Not Found | Resource target or resource node not | | 403 Forbidden | Access to resource denied |
| | found | | 404 Not Found | Resource target or resource node not |
| 405 Method Not Allowed | Method not allowed for target | | | found |
| | resource | | 405 Method Not Allowed | Method not allowed for target |
| 409 Conflict | Resource or lock in use | | | resource |
| 412 Precondition Failed | Conditional method is false | | 409 Conflict | Resource or lock in use |
| 413 Request Entity Too | too-big error | | 412 Precondition Failed | Conditional method is false |
| Large | | | 413 Request Entity Too | too-big error |
| 414 Request-URI Too Large | too-big error | | Large | |
| 415 Unsupported Media | non RESTCONF media type | | 414 Request-URI Too Large | too-big error |
| 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 "rpc" statement, a Since an operation resource is defined with a YANG "action" or "rpc"
mapping between the NETCONF <error-tag> value and the HTTP status statement, a mapping between the NETCONF <error-tag> value and the
code is needed. The specific error condition and response code to HTTP status code is needed. The specific error condition and
use are data-model specific and might be contained in the YANG response code to use are data-model specific and might be contained
"description" statement for the "rpc" statement. in the YANG "description" statement for the "action" or "rpc"
statement.
+-------------------------+-------------+ +-------------------------+-------------+
| <error-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 |
| bad-element | 400 | | bad-element | 400 |
| unknown-element | 400 | | unknown-element | 400 |
| unknown-namespace | 400 | | unknown-namespace | 400 |
skipping to change at page 53, line 43 skipping to change at page 54, line 17
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 (except for
status code "403 Forbidden"), then the server SHOULD send a response status code "403 Forbidden"), then the server SHOULD send a response
message-body containing the information described by the "errors" message-body containing the information described by the "errors"
container definition within the YANG module Section 8. The Content- container definition within the YANG module Section 8. The Content-
Type of this response message MUST be application/yang.errors (see Type of this response message MUST be application/yang.errors (see
example below). 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, the server MUST assume that "application/ error media is specified, then the media type of the request message
yang.errors+xml" was specified. All of the examples in this is used. If there is no request message the server MUST select
document, except for the one below, assume the default XML encoding "application/yang.errors+xml" or "application/yang.errors+json",
will be returned if there is an error. depending on server preference. All of the 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
+--ro error-info +--ro error-info
The semantics and syntax for RESTCONF error messages are defined in The semantics and syntax for RESTCONF error messages are defined in
the "application/yang.errors" restconf-media-type extension in the "application/yang.errors" restconf-media-type extension in
Section 8. Section 8.
Examples: Examples:
The following example shows an error returned for an "lock-denied" The following example shows an error returned for an "lock-denied"
error that can occur if a NETCONF client has locked a datastore. The error that can occur if a NETCONF client has locked a datastore. The
RESTCONF client is attempting to delete a data resource. Note that RESTCONF client is attempting to delete a data resource. Note that
an Accept header is used to specify the desired encoding for the an Accept header is used to specify the desired encoding for the
error message. This example's use of the Accept header is especially error message. This example's use of the Accept header is especially
notable since the DELETE method typically doesn't return a message- notable since the DELETE method typically doesn't return a message-
body and hence Accept headers are typically not passed. body and hence Accept headers are typically not passed.
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
Accept: application/yang.errors+json Accept: application/yang.errors+json
The server might respond: The server might respond:
HTTP/1.1 409 Conflict HTTP/1.1 409 Conflict
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+json Content-Type: application/yang.errors+json
{ {
"ietf-restconf:errors": { "ietf-restconf:errors": {
"error": { "error": [
"error-type": "protocol", {
"error-tag": "lock-denied", "error-type": "protocol",
"error-message": "Lock failed, lock already held" "error-tag": "lock-denied",
} "error-message": "Lock failed, lock already held"
}
]
} }
} }
The following example shows an error returned for a "data-exists" The following example shows an error returned for a "data-exists"
error on a data resource. The "jukebox" resource already exists so error on a data resource. The "jukebox" resource already exists so
it cannot be created. it cannot be created.
The client might send: The client might send:
POST /restconf/data/example-jukebox:jukebox HTTP/1.1 POST /restconf/data/example-jukebox:jukebox HTTP/1.1
Host: example.com Host: example.com
The server might respond (some lines wrapped for display purposes): The server might respond (some lines wrapped for display purposes):
HTTP/1.1 409 Conflict HTTP/1.1 409 Conflict
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:jb="https://example.com/ns/example-jukebox"> /rc:restconf/rc:data/jb:jukebox
/rc:restconf/rc:data/jb: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-06-04.yang" <CODE BEGINS> file "ietf-restconf@2015-10-18.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/>
skipping to change at page 56, line 50 skipping to change at page 57, line 39
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-06.txt // Note: extracted from draft-ietf-netconf-restconf-08.txt
// RFC Ed.: update the date below with the date of RFC publication // RFC Ed.: update the date below with the date of RFC publication
// and remove this note. // and remove this note.
revision 2015-06-04 { revision 2015-10-18 {
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;
} }
// RFC Ed.: replace draft-ietf-netmod-yang-json with RFC number // RFC Ed.: replace draft-ietf-netmod-yang-json with RFC number
// in the description below, and remove this note. // in the description below, and remove this note.
description description
"This extension is used to specify a YANG data structure which "This extension is used to specify a YANG data structure which
represents a conceptual RESTCONF media type. represents a conceptual RESTCONF media type.
Data definition statements within this extension specify Data definition statements within this extension specify
the generic syntax for the specific media type. the generic syntax for the specific media type.
YANG is mapped to specific encoding formats outside the YANG is mapped to specific encoding formats outside the
skipping to change at page 60, line 10 skipping to change at page 60, line 46
} }
leaf error-message { leaf error-message {
type string; type string;
description description
"A message describing the error."; "A message describing the error.";
} }
anyxml error-info { anyxml error-info {
description description
"Arbitrary XML that represents a container "This anyxml value MUST represent a container with
of additional information for the error report."; zero or more data nodes representing additional
error information.";
} }
} }
} }
} }
grouping restconf { grouping restconf {
description description
"Conceptual container representing the "Conceptual container representing the
application/yang.api resource type."; application/yang.api resource type.";
container restconf { container restconf {
description description
"Conceptual container representing the "Conceptual container representing the
skipping to change at page 61, line 19 skipping to change at page 62, line 9
} }
} }
<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
RESTCONF protocol capabilities and event notification streams RESTCONF protocol capabilities and event notification streams
available from the server. A RESTCONF server MUST implement the available from the server. A RESTCONF server MUST implement the "/
"/restconf-state/capabilities" container in this module. restconf-state/capabilities" container in this module.
YANG Tree Diagram for "ietf-restconf-monitoring" module: YANG Tree Diagram for "ietf-restconf-monitoring" module:
+--ro restconf-state +--ro restconf-state
+--ro capabilities +--ro capabilities
| +--ro capability* inet:uri | +--ro capability* inet:uri
+--ro streams +--ro streams
+--ro stream* [name] +--ro stream* [name]
+--ro name string +--ro name string
+--ro description? string +--ro description? string
+--ro replay-support? boolean +--ro replay-support? boolean
+--ro replay-log-creation-time? yang:date-and-time +--ro replay-log-creation-time? yang:date-and-time
+--ro access* [type] +--ro access* [encoding]
+--ro encoding string +--ro encoding string
+--ro location inet:uri +--ro location inet:uri
9.1. restconf-state/capabilities 9.1. restconf-state/capabilities
This mandatory container holds the RESTCONF protocol capability URIs This mandatory container holds the RESTCONF protocol capability URIs
supported by the server. supported by the server.
The server MUST maintain a last-modified timestamp for this The server MUST maintain a last-modified timestamp for this
container, and return the "Last-Modified" header when this data node container, and return the "Last-Modified" header when this data node
is retrieved with the GET or HEAD methods. is retrieved with the GET or HEAD methods.
skipping to change at page 62, line 19 skipping to change at page 63, line 14
9.1.1. Query Parameter URIs 9.1.1. Query Parameter URIs
A new set of RESTCONF Capability URIs are defined to identify the A new set of RESTCONF Capability URIs are defined to identify the
specific query parameters (defined in Section 4.8) supported by the specific query parameters (defined in Section 4.8) supported by the
server. server.
The server MUST include a "capability" leaf-list entry for each The server MUST include a "capability" leaf-list entry for each
optional query parameter that it supports. optional query parameter that it supports.
+------------+--------+---------------------------------------------+ +-------------+-------+---------------------------------------------+
| Name | Sectio | URI | | Name | Secti | URI |
| | n | | | | on | |
+------------+--------+---------------------------------------------+ +-------------+-------+---------------------------------------------+
| depth | 4.8.2 | urn:ietf:params:restconf:capability:depth:1 | | depth | 4.8.2 | urn:ietf:params:restconf:capability:depth:1 |
| | | .0 | | | | .0 |
| fields | 4.8.3 | urn:ietf:params:restconf:capability:fields: | | fields | 4.8.3 | urn:ietf:params:restconf:capability:fields: |
| | | 1.0 | | | | 1.0 |
| filter | 4.8.6 | urn:ietf:params:restconf:capability:filter: | | filter | 4.8.6 | urn:ietf:params:restconf:capability:filter: |
| | | 1.0 | | | | 1.0 |
| replay | 4.8.7 | urn:ietf:params:restconf:capability:replay: | | replay | 4.8.7 | urn:ietf:params:restconf:capability:replay: |
| | 4.8.8 | 1.0 | | | 4.8.8 | 1.0 |
| with- | 4.8.9 | urn:ietf:params:restconf:capability:with- | | with- | 4.8.9 | urn:ietf:params:restconf:capability:with- |
| defaults | | defaults:1.0 | | defaults | | defaults:1.0 |
+------------+--------+---------------------------------------------+ +-------------+-------+---------------------------------------------+
RESTCONF Query Parameter URIs RESTCONF Query Parameter URIs
9.1.2. The "defaults" Protocol Capability URI 9.1.2. The "defaults" Protocol Capability URI
This URI identifies the defaults handling mode that is used by the This URI identifies the defaults handling mode that is used by the
server for processing default leafs in requests for data resources. server for processing default leafs in requests for data resources.
A parameter named "basic-mode" is required for this capability URI. A parameter named "basic-mode" is required for this capability URI.
The "basic-mode" definitions are specified in the "With-Defaults The "basic-mode" definitions are specified in the "With-Defaults
Capability for NETCONF" [RFC6243]. Capability for NETCONF" [RFC6243].
skipping to change at page 63, line 8 skipping to change at page 63, line 51
| Name | URI | | Name | URI |
+----------+--------------------------------------------------+ +----------+--------------------------------------------------+
| defaults | urn:ietf:params:restconf:capability:defaults:1.0 | | defaults | urn:ietf:params:restconf:capability:defaults:1.0 |
+----------+--------------------------------------------------+ +----------+--------------------------------------------------+
RESTCONF defaults capability URI RESTCONF defaults capability URI
This protocol capability URI MUST be supported by the server, and This protocol capability URI MUST be supported by the server, and
MUST be listed in the "capability" leaf-list in Section 9.3. MUST be listed in the "capability" leaf-list in Section 9.3.
+------------+------------------------------------------------------+ +------------------+------------------------------------------------+
| Value | Description | | Value | Description |
+------------+------------------------------------------------------+ +------------------+------------------------------------------------+
| report-all | No data nodes are considered default | | report-all | No data nodes are considered default |
| trim | Values set to the YANG default-stmt value are | | trim | Values set to the YANG default-stmt value are |
| | default | | | default |
| explicit | Values set by the client are never considered | | explicit | Values set by the client are never considered |
| | default | | | default |
+------------+------------------------------------------------------+ +------------------+------------------------------------------------+
If the "basic-mode" is set to "report-all" then the server MUST If the "basic-mode" is set to "report-all" then the server MUST
adhere to the defaults handling behavior defined in Section 2.1 of adhere to the defaults handling behavior defined in Section 2.1 of
[RFC6243]. [RFC6243].
If the "basic-mode" is set to "trim" then the server MUST adhere to If the "basic-mode" is set to "trim" then the server MUST adhere to
the defaults handling behavior defined in Section 2.2 of [RFC6243]. the defaults handling behavior defined in Section 2.2 of [RFC6243].
If the "basic-mode" is set to "explicit" then the server MUST adhere If the "basic-mode" is set to "explicit" then the server MUST adhere
to the defaults handling behavior defined in Section 2.3 of to the defaults handling behavior defined in Section 2.3 of
[RFC6243]. [RFC6243].
Example: (split for display purposes only) Example: (split for display purposes only)
urn:ietf:params:restconf:capability:defaults:1.0? urn:ietf:params:restconf:capability:defaults:1.0?
basic-mode=explicit basic-mode=explicit
9.2. restconf-state/streams 9.2. restconf-state/streams
This optional container provides access to the event notification This optional container provides access to the event notification
streams supported by the server. The server MAY omit this container streams supported by the server. The server MAY omit this container
if no event notification streams are supported. if no event notification streams are supported.
The server will populate this container with a stream list entry for The server will populate this container with a stream list entry for
each stream type it supports. Each stream contains a leaf called each stream type it supports. Each stream contains a leaf called
"events" which contains a URI that represents an event stream "events" which contains a URI that represents an event stream
skipping to change at page 65, line 14 skipping to change at page 66, line 9
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-06.txt // Note: extracted from draft-ietf-netconf-restconf-08.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 2015-06-19 {
description description
"Initial revision."; "Initial revision.";
reference reference
"RFC XXXX: RESTCONF Protocol."; "RFC XXXX: RESTCONF Protocol.";
} }
skipping to change at page 70, line 31 skipping to change at page 71, line 7
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
[Note to RFC Editor: [Note to RFC Editor:
The RESTCONF Protocol Capability Registry does not yet exist; The RESTCONF Protocol Capability Registry does not yet exist;
Need to ask IANA to create it; remove this note for publication Need to ask IANA to create it; remove this note for publication
] ]
This document defines a registry for RESTCONF capability identifiers. This document defines a registry for RESTCONF capability identifiers.
The name of the registry is "RESTCONF Capability URNs". The registry The name of the registry is "RESTCONF Capability URNs". The registry
shall record for each entry: shall record for each entry:
o the name of the RESTCONF capability. By convention, this name is o the name of the RESTCONF capability. By convention, this name is
prefixed with the colon ':' character. prefixed with the colon ':' character.
o the URN for the RESTCONF capability. o the URN for the RESTCONF capability.
skipping to change at page 72, line 22 skipping to change at page 72, line 41
401 Unauthorized. Note that authorization information can be 401 Unauthorized. Note that authorization information can be
exchanged in the form of configuration information, which is all the exchanged in the form of configuration information, which is all the
more reason to ensure the security of the connection. more reason 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.
Contributions to this material by Andy Bierman are based upon work
supported by the The Space & Terrestrial Communications Directorate
(S&TCD) under Contract No. W15P7T-13-C-A616. Any opinions, findings
and conclusions or recommendations expressed in this material are
those of the author(s) and do not necessarily reflect the views of
The Space & Terrestrial Communications Directorate (S&TCD).
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]
Bjorklund, M., "The YANG 1.1 Data Modeling Language",
draft-ietf-netmod-rfc6020bis-07 (work in progress),
September 2015.
[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-04 (work in progress), June 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-01 (work in progress), draft-ietf-netmod-yang-metadata-02 (work in progress),
June 2015. September 2015.
[RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part Two: Media Types", RFC 2046, Extensions (MIME) Part Two: Media Types", RFC 2046,
November 1996. November 1996.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC2396] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifiers (URI): Generic Syntax", RFC 2396,
August 1998.
[RFC2818] Rescorla, E., "The IETF XML Registry", RFC 2818, May 2000. [RFC2818] Rescorla, E., "The IETF XML Registry", RFC 2818, May 2000.
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
January 2004. January 2004.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, RFC Resource Identifier (URI): Generic Syntax", STD 66, RFC
3986, January 2005. 3986, January 2005.
[RFC4252] Ylonen, T. and C. Lonvick, "The Secure Shell (SSH) [RFC4252] Ylonen, T. and C. Lonvick, "The Secure Shell (SSH)
skipping to change at page 75, line 30 skipping to change at page 76, line 12
[draft-thomson-httpbis-cant-01] [draft-thomson-httpbis-cant-01]
Thomson, M., "Client Authentication over New TLS Thomson, M., "Client Authentication over New TLS
Connection", draft-thomson-httpbis-cant-01 (work in Connection", draft-thomson-httpbis-cant-01 (work in
progress), Jul 2014. progress), Jul 2014.
14.2. Informative References 14.2. Informative References
[I-D.ietf-netconf-yang-patch] [I-D.ietf-netconf-yang-patch]
Bierman, A., Bjorklund, M., and K. Watsen, "YANG Patch Bierman, A., Bjorklund, M., and K. Watsen, "YANG Patch
Media Type", draft-ietf-netconf-yang-patch-05 (work in Media Type", draft-ietf-netconf-yang-patch-06 (work in
progress), July 2015. progress), October 2015.
[rest-dissertation] [rest-dissertation]
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. 06 - 07 A.1. 07 - 08
o add support for YANG 1.1 action statement
o changed mandatory encoding from XML to XML or JSON
o fix syntax in fields parameter definition
o add meta-data encoding examples for XML and JSON
o remove RFC 2396 references and update with 3986
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
(/list=foo,,baz)
o Add example of percent-encoded key value
A.2. 06 - 07
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
A.2. 05 - 06 o added support for YANG 1.1, specifically support for anydata and
actions
o removed the special field value "*", since it is no longer needed
A.3. 05 - 06
o fixed RESTCONF issue #23 (ietf-restconf-monitoring bug) o fixed RESTCONF issue #23 (ietf-restconf-monitoring bug)
A.3. 04 - 05 A.4. 04 - 05
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
skipping to change at page 76, line 46 skipping to change at page 78, line 5
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.4. 03 - 04 A.5. 03 - 04
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 77, line 33 skipping to change at page 78, line 40
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.5. 02 - 03 A.6. 02 - 03
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 77, line 45 skipping to change at page 79, line 4
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
o fixed bugs in some examples o fixed bugs in some examples
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.6. 01 - 02 A.7. 01 - 02
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)
skipping to change at page 78, line 44 skipping to change at page 80, line 5
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.7. 00 - 01 A.8. 00 - 01
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 79, line 42 skipping to change at page 80, line 49
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.8. bierman:restconf-04 to ietf:restconf-00 A.9. 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 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
| | | +--rw catalogue-number? string | | | +--rw catalogue-number? string
| | +--rw song* [name] | | +--rw song* [name]
| | +--rw name string | | +--rw name string
| | +--rw location string | | +--rw location string
| | +--rw format? string | | +--rw format? string
| | +--rw length? uint32 | | +--rw length? uint32
| +--ro artist-count? uint32 | +--ro artist-count? uint32
| +--ro album-count? uint32 | +--ro album-count? uint32
| +--ro song-count? uint32 | +--ro song-count? uint32
+--rw playlist* [name] +--rw playlist* [name]
| +--rw name string | +--rw name string
| +--rw description? string | +--rw description? string
| +--rw song* [index] | +--rw song* [index]
| +--rw index uint32 | +--rw index uint32
| +--rw id leafref | +--rw id leafref
+--rw player +--rw player
+--rw gap? decimal64 +--rw gap? decimal64
rpcs: rpcs:
+---x play +---x play
+--ro input +--ro input
+--ro playlist string +--ro playlist string
+--ro song-number uint32 +--ro song-number uint32
C.1. example-jukebox YANG Module C.1. example-jukebox YANG Module
module example-jukebox { module example-jukebox {
namespace "http://example.com/ns/example-jukebox"; namespace "http://example.com/ns/example-jukebox";
prefix "jbox"; prefix "jbox";
organization "Example, Inc."; organization "Example, Inc.";
contact "support at example.com"; contact "support at example.com";
description "Example Jukebox Data Model Module"; description "Example Jukebox Data Model Module";
revision "2015-04-04" { revision "2015-04-04" {
description "Initial version."; description "Initial version.";
reference "example.com document 1-4673"; reference "example.com document 1-4673";
} }
identity genre { identity genre {
description "Base for all genre types"; description "Base for all genre types";
skipping to change at page 86, line 20 skipping to change at page 87, line 28
This section shows some typical RESTCONF message exchanges. This section shows some typical RESTCONF message exchanges.
D.1. Resource Retrieval Examples D.1. Resource Retrieval Examples
D.1.1. Retrieve the Top-level API Resource D.1.1. Retrieve the Top-level API Resource
The client may start by retrieving the top-level API resource, using The client may start by retrieving the top-level API resource, using
the entry point URI "{+restconf}". the entry point URI "{+restconf}".
GET /restconf HTTP/1.1 GET /restconf HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.api+json Accept: application/yang.api+json
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" : [ null ],
"operations" : { "operations" : [ null ]
"play" : [ null ]
}
} }
} }
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
The server will return the same response either way, which might be The server will return the same response either way, which might be
as follows : 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
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/>
<play xmlns="https://example.com/ns/example-jukebox"/> </restconf>
</operations>
</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.
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/mymodules/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" : "implement"
},
{
"name" : "foo-types",
"revision" : "2012-01-05",
"schema" :
"https://example.com/mymodules/foo-types/2012-01-05", },
"schema" : [null], {
"namespace" : "http://example.com/ns/foo-types", "name" : "foo-types",
"conformance" : "import" "revision" : "2012-01-05",
}, "schema" :
{ "https://example.com/modules/foo-types/2012-01-05",
"name" : "bar", "schema" : [null],
"revision" : "2012-11-05", "namespace" : "http://example.com/ns/foo-types",
"schema" : "https://example.com/mymodules/bar/2012-11-05", "conformance" : "import"
"namespace" : "http://example.com/ns/bar", },
"feature" : [ "bar-ext" ], {
"conformance" : "implement", "name" : "bar",
"submodule" : [ "revision" : "2012-11-05",
{ "schema" : "https://example.com/modules/bar/2012-11-05",
"name" : "bar-submod1", "namespace" : "http://example.com/ns/bar",
"revision" : "2012-11-05", "feature" : [ "bar-ext" ],
"schema" : "conformance" : "implement",
"https://example.com/mymodules/bar-submod1/2012-11-05" "submodule" : [
}, {
{ "name" : "bar-submod1",
"name" : "bar-submod2", "revision" : "2012-11-05",
"revision" : "2012-11-05", "schema" :
"schema" : "https://example.com/modules/bar-submod1/2012-11-05"
"https://example.com/mymodules/bar-submod2/2012-11-05" },
} {
] "name" : "bar-submod2",
} "revision" : "2012-11-05",
] "schema" :
} "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 JSON 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.
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:02:00 GMT Date: Mon, 23 Apr 2012 17:02: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+xml Content-Type: application/yang.data+xml
<capabilities xmlns=""> <capabilities xmlns="">
<capability> <capability>
urn:ietf:params:restconf:capability:depth:1.0 urn:ietf:params:restconf:capability:depth:1.0
</capability> </capability>
<capability> <capability>
urn:ietf:params:restconf:capability:fields:1.0 urn:ietf:params:restconf:capability:fields:1.0
</capability> </capability>
<capability> <capability>
urn:ietf:params:restconf:capability:filter:1.0 urn:ietf:params:restconf:capability:filter:1.0
</capability> </capability>
<capability> <capability>
urn:ietf:params:restconf:capability:start-time:1.0 urn:ietf:params:restconf:capability:start-time:1.0
</capability> </capability>
<capability> <capability>
urn:ietf:params:restconf:capability:stop-time:1.0 urn:ietf:params:restconf:capability:stop-time:1.0
</capability> </capability>
<capability> <capability>
http://example.com/capabilities/myparam http://example.com/capabilities/myparam
</capability> </capability>
</capabilities> </capabilities>
D.2. Edit Resource Examples D.2. Edit Resource Examples
D.2.1. Create New Data Resources D.2.1. Create New Data Resources
To create a new "artist" resource within the "library" resource, the To create a new "artist" resource within the "library" resource, the
client might send the following request. client might send the following request.
POST /restconf/data/example-jukebox:jukebox/library HTTP/1.1 POST /restconf/data/example-jukebox:jukebox/library HTTP/1.1
Host: example.com Host: example.com
skipping to change at page 90, line 9 skipping to change at page 91, line 9
{ {
"example-jukebox:artist" : { "example-jukebox:artist" : {
"name" : "Foo Fighters" "name" : "Foo Fighters"
} }
} }
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:02:00 GMT Date: Mon, 23 Apr 2012 17:02: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
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+json
{ {
"example-jukebox:album" : { "example-jukebox:album" : {
"name" : "Wasting Light", "name" : "Wasting Light",
"genre" : "example-jukebox:alternative", "genre" : "example-jukebox:alternative",
"year" : 2012 # note this is the wrong date "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 "year" 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/year
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:year" : "2011" }
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
D.2.3. Edit a Datastore Resource D.2.3. Edit a Datastore Resource
In this example, the client modifies two different data nodes by In this example, the client modifies two different data nodes by
sending a PATCH to the datastore resource: sending a PATCH to the datastore resource:
PATCH /restconf/data HTTP/1.1 PATCH /restconf/data HTTP/1.1
Host: example.com Host: example.com
Content-Type: application/yang.datastore+xml Content-Type: application/yang.datastore+xml
<data xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<jukebox xmlns=""http://example.com/ns/example-jukebox"> <data xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<library> <jukebox xmlns="http://example.com/ns/example-jukebox">
<artist> <library>
<name>Foo Fighters</name> <artist>
<album> <name>Foo Fighters</name>
<name>Wasting Light</name> <album>
<year>2011</year> <name>Wasting Light</name>
</album> <year>2011</year>
</artist> </album>
<artist> </artist>
<name>Nick Cave</name> <artist>
<album> <name>Nick Cave</name>
<name>Tender Prey</name> <album>
<year>1988</year> <name>Tender Prey</name>
</album> <year>1988</year>
</artist> </album>
</library> </artist>
</jukebox> </library>
</data> </jukebox>
</data>
D.3. Query Parameter Examples D.3. Query Parameter Examples
D.3.1. "content" Parameter D.3.1. "content" Parameter
The "content" parameter is used to select the type of data child The "content" parameter is used to select the type of data child
resources (configuration and/or not configuration) that are returned resources (configuration and/or not configuration) that are returned
by the server for a GET method request. by the server for a GET method request.
In this example, a simple YANG list that has configuration and non- In this example, a simple YANG list that has configuration and non-
configuration child resources. configuration child resources.
container events container events
list event { list event {
key name; key name;
leaf name { type string; } leaf name { type string; }
leaf description { type string; } leaf description { type string; }
leaf event-count { leaf event-count {
type uint32; type uint32;
config false; config false;
}
} }
} }
}
Example 1: content=all Example 1: content=all
To retrieve all the child resources, the "content" parameter is set To retrieve all the child resources, the "content" parameter is set
to "all". The client might send: to "all". The client might send:
GET /restconf/data/example-events:events?content=all GET /restconf/data/example-events:events?content=all
HTTP/1.1 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, 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-events:events" : { "example-events:events" : {
"event" : [ "event" : [
{ {
"name" : "interface-up", "name" : "interface-up",
"description" : "Interface up notification count", "description" : "Interface up notification count",
"event-count" : 42 "event-count" : 42
}, },
{ {
"name" : "interface-down", "name" : "interface-down",
skipping to change at page 93, line 43 skipping to change at page 94, line 28
} }
} }
Example 2: content=config Example 2: content=config
To retrieve only the configuration child resources, the "content" To retrieve only the configuration child resources, the "content"
parameter is set to "config" or omitted since this is the default parameter is set to "config" or omitted since this is the default
value. Note that the "ETag" and "Last-Modified" headers are only value. Note that the "ETag" and "Last-Modified" headers are only
returned if the content parameter value is "config". returned if the content parameter value is "config".
GET /restconf/data/example-events:events?content=config GET /restconf/data/example-events:events?content=config
HTTP/1.1 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, 23 Apr 2012 17:11:30 GMT Date: Mon, 23 Apr 2012 17:11:30 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT
ETag: eeeada438af ETag: eeeada438af
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
skipping to change at page 94, line 36 skipping to change at page 95, line 18
} }
} }
Example 3: content=nonconfig Example 3: content=nonconfig
To retrieve only the non-configuration child resources, the "content" To retrieve only the non-configuration child resources, the "content"
parameter is set to "nonconfig". Note that configuration ancestors parameter is set to "nonconfig". Note that configuration ancestors
(if any) and list key leafs (if any) are also returned. The client (if any) and list key leafs (if any) are also returned. The client
might send: might send:
GET /restconf/data/example-events:events?content=nonconfig GET /restconf/data/example-events:events?content=nonconfig
HTTP/1.1 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, 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
skipping to change at page 95, line 47 skipping to change at page 96, line 25
This example shows how different values of the "depth" parameter This example shows how different values of the "depth" parameter
would affect the reply content for retrieval of the top-level would affect the reply content for retrieval of the top-level
"jukebox" data resource. "jukebox" data resource.
Example 1: depth=unbounded Example 1: depth=unbounded
To retrieve all the child resources, the "depth" parameter is not To retrieve all the child resources, the "depth" parameter is not
present or set to the default value "unbounded". Note that some present or set to the default value "unbounded". Note that some
strings are wrapped for display purposes only. strings are wrapped for display purposes only.
GET /restconf/data/example-jukebox:jukebox?depth=unbounded GET /restconf/data/example-jukebox:jukebox?depth=unbounded
HTTP/1.1 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, 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
skipping to change at page 97, line 23 skipping to change at page 98, line 4
] ]
} }
], ],
"player" : { "player" : {
"gap" : 0.5 "gap" : 0.5
} }
} }
} }
Example 2: depth=1 Example 2: depth=1
To determine if 1 or more resource instances exist for a given target To determine if 1 or more resource instances exist for a given target
resource, the value "1" is used. resource, the value "1" is used.
GET /restconf/data/example-jukebox:jukebox?depth=1 HTTP/1.1 GET /restconf/data/example-jukebox:jukebox?depth=1 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, 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" : [null]
} }
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
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
skipping to change at page 98, line 38 skipping to change at page 99, line 19
} }
} }
} }
D.3.3. "fields" Parameter D.3.3. "fields" Parameter
In this example the client is retrieving the API resource, but In this example the client is retrieving the API resource, but
retrieving only the "name" and "revision" nodes from each module, in retrieving only the "name" and "revision" nodes from each module, in
JSON format: JSON format:
GET /restconf/data?fields=modules/module(name;revision) HTTP/1.1 GET /restconf/data?fields=ietf-yang-library:modules/
Host: example.com module(name;revision) HTTP/1.1
Accept: application/yang.data+json Host: example.com
Accept: application/yang.data+json
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+json Content-Type: application/yang.data+json
{ {
"ietf-yang-library:modules": { "ietf-yang-library:modules": {
skipping to change at page 100, line 6 skipping to change at page 100, line 19
} }
D.3.4. "insert" Parameter D.3.4. "insert" Parameter
In this example, a new first entry in the "Foo-One" playlist is being In this example, a new first entry in the "Foo-One" playlist is being
created. created.
Request from client: Request from client:
POST /restconf/data/example-jukebox:jukebox/ POST /restconf/data/example-jukebox:jukebox/
playlist=Foo-One?insert=first HTTP/1.1 playlist=Foo-One?insert=first 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" : {
"index" : 1, "index" : 1,
"id" : "/example-jukebox:jukebox/library/ "id" : "/example-jukebox:jukebox/library/
artist=Foo%20Fighters/album=Wasting%20Light/song=Rope" artist=Foo%20Fighters/album=Wasting%20Light/song=Rope"
} }
} }
Response from server: Response from server:
HTTP/1.1 201 Created HTTP/1.1 201 Created
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Mon, 23 Apr 2012 13:01:20 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT
Location: https://example.com/restconf/data/ Location: https://example.com/restconf/data/
example-jukebox:jukebox/playlist=Foo-One/song=1 example-jukebox:jukebox/playlist=Foo-One/song=1
ETag: eeeada438af ETag: eeeada438af
D.3.5. "point" Parameter D.3.5. "point" Parameter
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%2FFoo%20Fighters%2Falbum%2F
Wasting%20Light%2Fsong%2FBridge%20Burning HTTP/1.1 Wasting%20Light%2Fsong%2FBridge%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
} }
} }
Response from server: Response from server:
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
1. Date: Mon, 23 Apr 2012 13:01:20 GMT Server: example-server Last- 1. Date: Mon, 23 Apr 2012 13:01:20 GMT Server: example-server Last-
Modified: Mon, 23 Apr 2012 13:01:20 GMT ETag: abcada438af Modified: Mon, 23 Apr 2012 13:01:20 GMT ETag: abcada438af
D.3.6. "filter" Parameter D.3.6. "filter" Parameter
The following URIs show some examples of notification filter The following URIs show some examples of notification filter
specifications (lines wrapped for display purposes only): specifications (lines wrapped for display purposes only):
// filter = /event/event-class='fault' // filter = /event/event-class='fault'
skipping to change at page 101, line 43 skipping to change at page 102, line 7
// Note: the module name is used as prefix. // Note: the module name is used as prefix.
// filter = (/example-mod:event1/name='joe' and // filter = (/example-mod:event1/name='joe' and
// /example-mod:event1/status='online') // /example-mod:event1/status='online')
GET /mystreams/NETCONF? GET /mystreams/NETCONF?
filter=(%2Fexample-mod%3Aevent1%2Fname%3D'joe'%20and filter=(%2Fexample-mod%3Aevent1%2Fname%3D'joe'%20and
%20%2Fexample-mod%3Aevent1%2Fstatus%3D'online') %20%2Fexample-mod%3Aevent1%2Fstatus%3D'online')
D.3.7. "start-time" Parameter D.3.7. "start-time" Parameter
// start-time = 2014-10-25T10:02:00Z // start-time = 2014-10-25T10:02:00Z
GET /mystreams/NETCONF?start-time=2014-10-25T10%3A02%3A00Z GET /mystreams/NETCONF?start-time=2014-10-25T10%3A02%3A00Z
D.3.8. "stop-time" Parameter D.3.8. "stop-time" Parameter
// stop-time = 2014-10-25T12:31:00Z // stop-time = 2014-10-25T12:31:00Z
GET /mystreams/NETCONF?stop-time=2014-10-25T12%3A31%3A00Z GET /mystreams/NETCONF?stop-time=2014-10-25T12%3A31%3A00Z
D.3.9. "with-defaults" Parameter D.3.9. "with-defaults" Parameter
The following YANG module is assumed for this example.
module example-interface {
prefix "exif";
namespace "urn:example.com:params:xml:ns:yang:example-interface";
container interfaces {
list interface {
key name;
leaf name { type string; }
leaf mtu { type uint32; }
leaf status {
config false;
type enumeration {
enum up;
enum down;
enum testing;
}
}
}
}
}
Assume the same data model as defined in Appendix A.1 of [RFC6243]. Assume the same data model as defined in Appendix A.1 of [RFC6243].
Assume the same data set as defined in Appendix A.2 of [RFC6243]. If Assume the same data set as defined in Appendix A.2 of [RFC6243]. If
the server defaults-uri basic-mode is "trim", the the following the server defaults-uri basic-mode is "trim", the the following
request for interface "eth1" might be as follows: request for interface "eth1" might be as follows:
Without query parameter: Without query parameter:
GET /restconf/data/interfaces/interface=eth1 HTTP/1.1 GET /restconf/data/example:interfaces/interface=eth1 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.
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+json Content-Type: application/yang.data+json
{ {
"example:interface": [ "example:interface": [
skipping to change at page 102, line 39 skipping to change at page 103, line 24
"status" : "up" "status" : "up"
} }
] ]
} }
Note that the "mtu" leaf is missing because it is set to the default Note that the "mtu" leaf is missing because it is set to the default
"1500", and the server defaults handling basic-mode is "trim". "1500", and the server defaults handling basic-mode is "trim".
With query parameter: With query parameter:
GET /restconf/data/interfaces/interface=eth1 GET /restconf/data/example:interfaces/interface=eth1
?with-defaults=report-all HTTP/1.1 ?with-defaults=report-all 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.
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+json Content-Type: application/yang.data+json
{ {
"example:interface": [ "example:interface": [
 End of changes. 187 change blocks. 
872 lines changed or deleted 1034 lines changed or added

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