draft-ietf-netconf-restconf-04.txt   draft-ietf-netconf-restconf-05.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: August 3, 2015 Tail-f Systems Expires: December 6, 2015 Tail-f Systems
K. Watsen K. Watsen
Juniper Networks Juniper Networks
January 30, 2015 June 4, 2015
RESTCONF Protocol RESTCONF Protocol
draft-ietf-netconf-restconf-04 draft-ietf-netconf-restconf-05
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 August 3, 2015. This Internet-Draft will expire on December 6, 2015.
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
skipping to change at page 2, line 12 skipping to change at page 2, line 12
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1. Simple Subset of NETCONF Functionality . . . . . . . . . 5 1.1. Simple Subset of NETCONF Functionality . . . . . . . . . 5
1.2. Data Model Driven API . . . . . . . . . . . . . . . . . . 6 1.2. Data Model Driven API . . . . . . . . . . . . . . . . . . 6
1.3. Terminology . . . . . . . . . . . . . . . . . . . . . . . 7 1.3. Coexistence with NETCONF . . . . . . . . . . . . . . . . 7
1.3.1. NETCONF . . . . . . . . . . . . . . . . . . . . . . . 7 1.4. Terminology . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.2. HTTP . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.1. NETCONF . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.3. YANG . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4.2. HTTP . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.4. Terms . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4.3. YANG . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.5. URI Template . . . . . . . . . . . . . . . . . . . . 11 1.4.4. Terms . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.6. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 11 1.4.5. URI Template . . . . . . . . . . . . . . . . . . . . 11
2. Transport Protocol Requirements . . . . . . . . . . . . . . . 11 1.4.6. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 11
2.1. Integrity and Confidentiality . . . . . . . . . . . . . . 11 2. Transport Protocol Requirements . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . 12
2.5. Authenticated Client Identity . . . . . . . . . . . . . . 12 2.5. Authenticated Client Identity . . . . . . . . . . . . . . 12
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 . . . . . . . . . . . . . . . . . . . . . . 15
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 . . . . . . . . . . . . . . . . . . . . . . 19 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.7. Schema Resource . . . . . . . . . . . . . . . . . . . . . 24 3.6.3. Encoding Operation Errors . . . . . . . . . . . . . . 25
3.8. Event Stream Resource . . . . . . . . . . . . . . . . . . 25 3.7. Schema Resource . . . . . . . . . . . . . . . . . . . . . 25
3.9. Errors Media Type . . . . . . . . . . . . . . . . . . . . 26 3.8. Event Stream Resource . . . . . . . . . . . . . . . . . . 26
4. Operations . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.9. Errors Media Type . . . . . . . . . . . . . . . . . . . . 27
4.1. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 27 4. Operations . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.1. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.3. GET . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.4. POST . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.3. GET . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.4.1. Create Resource Mode . . . . . . . . . . . . . . . . 29 4.4. POST . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.4.2. Invoke Operation Mode . . . . . . . . . . . . . . . . 30 4.4.1. Create Resource Mode . . . . . . . . . . . . . . . . 30
4.4.2. Invoke Operation Mode . . . . . . . . . . . . . . . . 31
4.5. PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.5. PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.6. PATCH . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.6. PATCH . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.6.1. Plain Patch . . . . . . . . . . . . . . . . . . . . . 32 4.6.1. Plain Patch . . . . . . . . . . . . . . . . . . . . . 33
4.7. DELETE . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.7. DELETE . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.8. Query Parameters . . . . . . . . . . . . . . . . . . . . 34 4.8. Query Parameters . . . . . . . . . . . . . . . . . . . . 34
4.8.1. Query Parameter URIs . . . . . . . . . . . . . . . . 35 4.8.1. The "content" Query Parameter . . . . . . . . . . . . 35
4.8.2. The "defaults" Protocol Capability URI . . . . . . . 35 4.8.2. The "depth" Query Parameter . . . . . . . . . . . . . 36
4.8.3. The "content" Query Parameter . . . . . . . . . . . . 36 4.8.3. The "fields" Query Parameter . . . . . . . . . . . . 36
4.8.4. The "depth" Query Parameter . . . . . . . . . . . . . 36 4.8.4. The "insert" Query Parameter . . . . . . . . . . . . 37
4.8.5. The "fields" Query Parameter . . . . . . . . . . . . 37 4.8.5. The "point" Query Parameter . . . . . . . . . . . . . 38
4.8.6. The "insert" Query Parameter . . . . . . . . . . . . 38 4.8.6. The "filter" Query Parameter . . . . . . . . . . . . 38
4.8.7. The "point" Query Parameter . . . . . . . . . . . . . 38 4.8.7. The "start-time" Query Parameter . . . . . . . . . . 39
4.8.8. The "filter" Query Parameter . . . . . . . . . . . . 39 4.8.8. The "stop-time" Query Parameter . . . . . . . . . . . 40
4.8.9. The "start-time" Query Parameter . . . . . . . . . . 40 4.8.9. The "with-defaults" Query Parameter . . . . . . . . . 40
4.8.10. The "stop-time" Query Parameter . . . . . . . . . . . 40 5. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.8.11. The "with-defaults" Query Parameter . . . . . . . . . 41 5.1. Request URI Structure . . . . . . . . . . . . . . . . . . 41
5. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 42
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 . . . . . . . . . . . . . . . . . . . 45 5.4. RESTCONF Meta-Data . . . . . . . . . . . . . . . . . . . 44
5.5. Return Status . . . . . . . . . . . . . . . . . . . . . . 45 5.5. Return Status . . . . . . . . . . . . . . . . . . . . . . 44
5.6. Message Caching . . . . . . . . . . . . . . . . . . . . . 45 5.6. Message Caching . . . . . . . . . . . . . . . . . . . . . 45
6. Notifications . . . . . . . . . . . . . . . . . . . . . . . . 46 6. Notifications . . . . . . . . . . . . . . . . . . . . . . . . 45
6.1. Server Support . . . . . . . . . . . . . . . . . . . . . 46 6.1. Server Support . . . . . . . . . . . . . . . . . . . . . 45
6.2. Event Streams . . . . . . . . . . . . . . . . . . . . . . 46 6.2. Event Streams . . . . . . . . . . . . . . . . . . . . . . 45
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 . . . . . . . . . . . . . . . . 49
6.4. Receiving Event Notifications . . . . . . . . . . . . . . 49 6.4. Receiving Event Notifications . . . . . . . . . . . . . . 49
7. Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 51 7. Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 51
7.1. Error Response Message . . . . . . . . . . . . . . . . . 52 7.1. Error Response Message . . . . . . . . . . . . . . . . . 53
8. RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 55 8. RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 55
9. RESTCONF Monitoring . . . . . . . . . . . . . . . . . . . . . 61 9. RESTCONF Monitoring . . . . . . . . . . . . . . . . . . . . . 61
9.1. restconf-state/capabilities . . . . . . . . . . . . . . . 62 9.1. restconf-state/capabilities . . . . . . . . . . . . . . . 61
9.2. restconf-state/streams . . . . . . . . . . . . . . . . . 62 9.1.1. Query Parameter URIs . . . . . . . . . . . . . . . . 62
9.3. RESTCONF Monitoring Module . . . . . . . . . . . . . . . 62 9.1.2. The "defaults" Protocol Capability URI . . . . . . . 62
10. YANG Module Library . . . . . . . . . . . . . . . . . . . . . 66 9.2. restconf-state/streams . . . . . . . . . . . . . . . . . 63
10.1. modules . . . . . . . . . . . . . . . . . . . . . . . . 66 9.3. RESTCONF Monitoring Module . . . . . . . . . . . . . . . 63
10.1.1. modules/module . . . . . . . . . . . . . . . . . . . 67 10. YANG Module Library . . . . . . . . . . . . . . . . . . . . . 67
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 67 10.1. modules . . . . . . . . . . . . . . . . . . . . . . . . 67
11.1. The "restconf" Relation Type . . . . . . . . . . . . . . 67 10.1.1. modules/module . . . . . . . . . . . . . . . . . . . 68
11.2. YANG Module Registry . . . . . . . . . . . . . . . . . . 67 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 68
11.3. application/yang Media Sub Types . . . . . . . . . . . . 68 11.1. The "restconf" Relation Type . . . . . . . . . . . . . . 68
11.4. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 69 11.2. YANG Module Registry . . . . . . . . . . . . . . . . . . 68
12. Security Considerations . . . . . . . . . . . . . . . . . . . 70 11.3. application/yang Media Sub Types . . . . . . . . . . . . 69
13. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 71 11.4. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 70
14. References . . . . . . . . . . . . . . . . . . . . . . . . . 71 12. Security Considerations . . . . . . . . . . . . . . . . . . . 71
14.1. Normative References . . . . . . . . . . . . . . . . . . 71 13. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 72
14.2. Informative References . . . . . . . . . . . . . . . . . 74 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 72
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 74 14.1. Normative References . . . . . . . . . . . . . . . . . . 72
A.1. 03 - 04 . . . . . . . . . . . . . . . . . . . . . . . . . 74 14.2. Informative References . . . . . . . . . . . . . . . . . 75
A.2. 02 - 03 . . . . . . . . . . . . . . . . . . . . . . . . . 75
A.3. 01 - 02 . . . . . . . . . . . . . . . . . . . . . . . . . 76 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 75
A.4. 00 - 01 . . . . . . . . . . . . . . . . . . . . . . . . . 76 A.1. 04 - 05 . . . . . . . . . . . . . . . . . . . . . . . . . 75
A.5. bierman:restconf-04 to ietf:restconf-00 . . . . . . . . . 77 A.2. 03 - 04 . . . . . . . . . . . . . . . . . . . . . . . . . 76
Appendix B. Open Issues . . . . . . . . . . . . . . . . . . . . 77 A.3. 02 - 03 . . . . . . . . . . . . . . . . . . . . . . . . . 77
Appendix C. Example YANG Module . . . . . . . . . . . . . . . . 78 A.4. 01 - 02 . . . . . . . . . . . . . . . . . . . . . . . . . 77
C.1. example-jukebox YANG Module . . . . . . . . . . . . . . . 78 A.5. 00 - 01 . . . . . . . . . . . . . . . . . . . . . . . . . 78
Appendix D. RESTCONF Message Examples . . . . . . . . . . . . . 84 A.6. bierman:restconf-04 to ietf:restconf-00 . . . . . . . . . 79
D.1. Resource Retrieval Examples . . . . . . . . . . . . . . . 84 Appendix B. Open Issues . . . . . . . . . . . . . . . . . . . . 79
D.1.1. Retrieve the Top-level API Resource . . . . . . . . . 84 Appendix C. Example YANG Module . . . . . . . . . . . . . . . . 79
D.1.2. Retrieve The Server Module Information . . . . . . . 85 C.1. example-jukebox YANG Module . . . . . . . . . . . . . . . 80
D.1.3. Retrieve The Server Capability Information . . . . . 86 Appendix D. RESTCONF Message Examples . . . . . . . . . . . . . 85
D.2. Edit Resource Examples . . . . . . . . . . . . . . . . . 87 D.1. Resource Retrieval Examples . . . . . . . . . . . . . . . 86
D.2.1. Create New Data Resources . . . . . . . . . . . . . . 87 D.1.1. Retrieve the Top-level API Resource . . . . . . . . . 86
D.2.2. Detect Resource Entity Tag Change . . . . . . . . . . 88 D.1.2. Retrieve The Server Module Information . . . . . . . 87
D.3. Query Parameter Examples . . . . . . . . . . . . . . . . 89 D.1.3. Retrieve The Server Capability Information . . . . . 88
D.3.1. "content" Parameter . . . . . . . . . . . . . . . . . 89 D.2. Edit Resource Examples . . . . . . . . . . . . . . . . . 89
D.3.2. "depth" Parameter . . . . . . . . . . . . . . . . . . 92 D.2.1. Create New Data Resources . . . . . . . . . . . . . . 89
D.3.3. "fields" Parameter . . . . . . . . . . . . . . . . . 95 D.2.2. Detect Resource Entity Tag Change . . . . . . . . . . 90
D.3.4. "insert" Parameter . . . . . . . . . . . . . . . . . 96 D.2.3. Edit a Datastore Resource . . . . . . . . . . . . . . 91
D.3.5. "point" Parameter . . . . . . . . . . . . . . . . . . 97 D.3. Query Parameter Examples . . . . . . . . . . . . . . . . 92
D.3.6. "filter" Parameter . . . . . . . . . . . . . . . . . 97 D.3.1. "content" Parameter . . . . . . . . . . . . . . . . . 92
D.3.7. "start-time" Parameter . . . . . . . . . . . . . . . 98 D.3.2. "depth" Parameter . . . . . . . . . . . . . . . . . . 95
D.3.8. "stop-time" Parameter . . . . . . . . . . . . . . . . 98 D.3.3. "fields" Parameter . . . . . . . . . . . . . . . . . 98
D.3.9. "with-defaults" Parameter . . . . . . . . . . . . . . 98 D.3.4. "insert" Parameter . . . . . . . . . . . . . . . . . 99
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 100 D.3.5. "point" Parameter . . . . . . . . . . . . . . . . . . 100
D.3.6. "filter" Parameter . . . . . . . . . . . . . . . . . 101
D.3.7. "start-time" Parameter . . . . . . . . . . . . . . . 101
D.3.8. "stop-time" Parameter . . . . . . . . . . . . . . . . 101
D.3.9. "with-defaults" Parameter . . . . . . . . . . . . . . 102
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 notification events 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 [RFC6020], using
datastores defined in NETCONF [RFC6241]. 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 notification events. 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 statement can be invoked with the POST method. Data-model specific
notification events defined with the YANG "notification" statement event notifications defined with the YANG "notification" statement
can be accessed. can be accessed.
1.1. Simple Subset of NETCONF Functionality 1.1. Simple Subset of NETCONF Functionality
The framework and meta-model used for an HTTP-based API does not need An HTTP-based management protocol does not need to mirror the
to mirror those used by the NETCONF protocol, but it needs to be functionality of the NETCONF protocol, but it needs to be compatible
compatible with NETCONF. Instead, a simplified framework and with NETCONF. A simplified transaction model is needed that allows
protocol is needed that co-exists with the three NETCONF datastores basic CRUD operations on a hierarchy of conceptual resources. This
(candidate, running, startup), but hides the complexity of multiple represents a limited subset of the transaction capabilities of the
datastores from the client. NETCONF protocol.
A simplified transaction model is needed that allows basic CRUD
operations on a hierarchy of conceptual resources. This represents a
limited subset of the transaction capabilities of the NETCONF
protocol.
The HTTP POST, PUT, PATCH, and DELETE methods are used to edit data The HTTP POST, PUT, PATCH, and DELETE methods are used to edit data
resources represented by YANG data models. These basic edit resources represented by YANG data models. These basic edit
operations allow the running configuration to be altered in an all- operations allow the running configuration to be altered in an all-
or-none fashion. This is similar to the "rollback-on-error" or-none fashion. This is similar to the "rollback-on-error"
capability in NETCONF. Edits are usually applied to one data capability in NETCONF. Edits are usually applied to one data
resource instance at a time. resource instance at a time.
Applications that require more complex transaction capabilities might The base RESTCONF protocol is intentionally simple to allow
consider NETCONF instead of RESTCONF. The following transaction deployment for as many use cases as possible. Additional
features are not directly provided in RESTCONF: functionality can be defined in external documents, outside the scope
of this document.
o datastore locking (full or partial)
o candidate datastore
o startup datastore
o validate operation
o confirmed-commit procedure
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 |
| | | |
skipping to change at page 7, line 20 skipping to change at page 7, line 15
the YANG module definitions. the YANG module definitions.
Operational experience with CLI and SNMP indicates that operators Operational experience with CLI and SNMP indicates that operators
learn the 'location' of specific service or device related data and learn the 'location' of specific service or device related data and
do not expect such information to be arbitrary and discovered each do not expect such information to be arbitrary and discovered each
time the client opens a management session to a server. time the client opens a management session to a server.
The RESTCONF protocol operates on a conceptual datastore defined with The RESTCONF protocol operates on a conceptual datastore defined with
the YANG data modeling language. The server lists each YANG module the YANG data modeling language. The server lists each YANG module
it supports using the "ietf-yang-library" YANG module, defined in it supports using the "ietf-yang-library" YANG module, defined in
[I-D.ietf-netconf-yang-library]. [I-D.ietf-netconf-yang-library]. The server MUST implement the
"ietf-yang-library" module, which SHOULD identify all the YANG
modules used by the server.
The conceptual datastore contents, data-model-specific operations and The conceptual datastore contents, data-model-specific operations and
notification events are identified by this set of YANG modules. All event notifications are identified by this set of YANG modules. All
RESTCONF content identified as either a data resource, operation RESTCONF content identified as either a data resource, operation
resource, or event stream resource is defined with the YANG language. resource, or event stream resource is defined with the YANG language.
The classification of data as configuration or non-configuration is The classification of data as configuration or non-configuration is
derived from the YANG "config" statement. Data ordering behavior is derived from the YANG "config" statement. Data ordering behavior is
derived from the YANG "ordered-by" statement. derived from the YANG "ordered-by" statement.
The RESTCONF datastore editing model is simple and direct, similar to The RESTCONF datastore editing model is simple and direct, similar to
the behavior of the ":writable-running" capability in NETCONF. Each the behavior of the :writable-running capability in NETCONF. Each
RESTCONF edit of a datastore resource is activated upon successful RESTCONF edit of a datastore resource is activated upon successful
completion of the transaction. completion of the transaction.
1.3. Terminology 1.3. Coexistence with NETCONF
RESTCONF can be implemented on a device that supports NETCONF.
If the device supports :writable-running, all edits to configuration
nodes in {+restconf}/data are performed in the running configuration
datastore.
Otherwise, if the device supports :candidate, all edits to
configuration nodes in {+restconf}/data are performed in the
candidate configuration datastore. The candidate is automatically
committed to running after a successful edit.
If the device supports :startup, the device automatically copies the
content of running to startup after running has been updated as a
consequence of a RESTCONF edit operation.
If a datastore that would be modified by a RESTCONF operation has an
active lock, the RESTCONF edit operation MUST fail with a 409
(Conflict) error code.
1.4. Terminology
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP "OPTIONAL" in this document are to be interpreted as described in BCP
14, [RFC2119]. 14, [RFC2119].
1.3.1. NETCONF 1.4.1. NETCONF
The following terms are defined in [RFC6241]: The following terms are defined in [RFC6241]:
o candidate configuration datastore o candidate configuration datastore
o client o client
o configuration data o configuration data
o datastore o datastore
o configuration datastore o configuration datastore
o protocol operation o protocol operation
o running configuration datastore o running configuration datastore
o server o server
skipping to change at page 8, line 20 skipping to change at page 8, line 42
o running configuration datastore o running configuration datastore
o server o server
o startup configuration datastore o startup configuration datastore
o state data o state data
o user o user
1.3.2. HTTP 1.4.2. HTTP
The following terms are defined in [RFC3986]: The following terms are defined in [RFC3986]:
o fragment o fragment
o path o path
o query o query
The following terms are defined in [RFC7230]: The following terms are defined in [RFC7230]:
skipping to change at page 9, line 7 skipping to change at page 9, line 27
o method o method
o request o request
o resource o resource
The following terms are defined in [RFC7232]: The following terms are defined in [RFC7232]:
o entity tag o entity tag
1.3.3. YANG 1.4.3. YANG
The following terms are defined in [RFC6020]: The following terms are defined in [RFC6020]:
o container o container
o data node o data node
o key leaf o key leaf
o leaf o leaf
skipping to change at page 9, line 33 skipping to change at page 10, line 5
o presence container (or P-container) o presence container (or P-container)
o RPC operation (now called protocol operation) o RPC operation (now called protocol operation)
o non-presence container (or NP-container) o non-presence container (or NP-container)
o ordered-by system o ordered-by system
o ordered-by user o ordered-by user
1.3.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 and anyxml nodes can be data resources.
skipping to change at page 10, line 7 skipping to change at page 10, line 28
Represents a datastore. Represents a datastore.
o edit operation: a RESTCONF operation on a data resource using o edit operation: a RESTCONF operation on a data resource using
either a POST, PUT, PATCH, or DELETE method. either a POST, PUT, PATCH, or DELETE method.
o event stream resource: This resource represents an SSE (Server- o event stream resource: This resource represents an SSE (Server-
Sent Events) event stream. The content consists of text using the Sent Events) event stream. The content consists of text using the
media type "text/event-stream", as defined by the HTML5 media type "text/event-stream", as defined by the HTML5
specification. Each event represents one <notification> message specification. Each event represents one <notification> message
generated by the server. It contains a conceptual system or data- generated by the server. It contains a conceptual system or data-
model specific event that is delivered within a notification event model specific event that is delivered within an event
stream. Also called a "stream resource". notification stream. Also called a "stream resource".
o media-type: HTTP uses Internet media types [RFC2046] in the o media-type: HTTP uses Internet media types [RFC2046] in the
Content-Type and Accept header fields in order to provide open and Content-Type and Accept header fields in order to provide open and
extensible data typing and type negotiation. extensible data typing and type negotiation.
o operation: the conceptual RESTCONF operation for a message, o operation: the conceptual RESTCONF operation for a message,
derived from the HTTP method, request URI, headers, and message- derived from the HTTP method, request URI, headers, and message-
body. body.
o operation resource: a resource with the media type "application/ o operation resource: a resource with the media type "application/
skipping to change at page 10, line 41 skipping to change at page 11, line 15
o RESTCONF capability: An optional RESTCONF protocol feature o RESTCONF capability: An optional RESTCONF protocol feature
supported by the server, which is identified by an IANA registered supported by the server, which is identified by an IANA registered
NETCONF Capability URI, and advertised with an entry in the NETCONF Capability URI, and advertised with an entry in the
"capability" leaf-list in Section 9.3. "capability" leaf-list in Section 9.3.
o retrieval request: a request using the GET or HEAD methods. o retrieval request: a request using the GET or HEAD methods.
o target resource: the resource that is associated with a particular o target resource: the resource that is associated with a particular
message, identified by the "path" component of the request URI. message, identified by the "path" component of the request URI.
o unified datastore: A conceptual representation of the device
running configuration. The server will hide all NETCONF datastore
details for edit operations, such as the ":candidate" and
":startup" capabilities.
o schema resource: a resource with the media type "application/ o schema resource: a resource with the media type "application/
yang". The YANG representation of the schema can be retrieved by yang". The YANG representation of the schema can be retrieved by
the client with the GET method. the client with the GET method.
o stream list: the set of data resource instances that describe the o stream list: the set of data resource instances that describe the
event stream resources available from the server. This event stream resources available from the server. This
information is defined in the "ietf-restconf-monitoring" module as information is defined in the "ietf-restconf-monitoring" module as
the "stream" list. It can be retrieved using the target resource the "stream" list. It can be retrieved using the target resource
"{+restconf}/data/ietf-restconf-monitoring:restconf-state/streams/ "{+restconf}/data/ietf-restconf-monitoring:restconf-state/streams/
stream". The stream list contains information about each stream, stream". The stream list contains information about each stream,
such as the URL to retrieve the event stream data. such as the URL to retrieve the event stream data.
1.3.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.3.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).
skipping to change at page 12, line 11 skipping to change at page 12, line 25
RESTCONF requires that the transport-layer protocol provides both RESTCONF requires that the transport-layer protocol provides both
data integrity and confidentiality, such as are provided by the TLS data integrity and confidentiality, such as are provided by the TLS
protocol [RFC5246]. protocol [RFC5246].
2.2. HTTPS with X.509v3 Certificates 2.2. HTTPS with X.509v3 Certificates
Given the nearly ubiquitous support for HTTP over TLS [RFC7230], Given the nearly ubiquitous support for HTTP over TLS [RFC7230],
RESTCONF implementations MUST support the "https" URI scheme, which RESTCONF implementations MUST support the "https" URI scheme, which
has the IANA assigned default port 443. Consistent with the has the IANA assigned default port 443. Consistent with the
exclusive use of X.509v3 certificates for NETCONF over TLS exclusive use of X.509v3 certificates for NETCONF over TLS
[draft-ietf-netconf-rfc5539bis-07], use of certificates in RESTCONF [draft-ietf-netconf-rfc5539bis-10], use of certificates in RESTCONF
is also limited to X.509v3 certificates. is also limited to X.509v3 certificates.
2.3. Certificate Validation 2.3. Certificate Validation
When presented an X.509 certificate, the RESTCONF peer MUST use X.509 When presented an X.509 certificate, the RESTCONF peer MUST use X.509
certificate path validation [RFC5280] to verify the integrity of the certificate path validation [RFC5280] to verify the integrity of the
certificate. The presented X.509 certificate MAY also be considered certificate. The presented X.509 certificate MAY also be considered
valid if it matches a locally configured certificate fingerprint. If valid if it matches a locally configured certificate fingerprint. If
X.509 certificate path validation fails and the presented X.509 X.509 certificate path validation fails and the presented X.509
certificate does not match a locally configured certificate certificate does not match a locally configured certificate
fingerprint, the connection MUST be terminated as defined in fingerprint, the connection MUST be terminated as defined in
[RFC5246]. [RFC5246].
2.4. Authenticated Server Identity 2.4. Authenticated Server Identity
The RESTCONF client MUST carefully examine the certificate presented The RESTCONF client MUST carefully examine the certificate presented
by the RESTCONF server to determine if it meets the client's by the RESTCONF server to determine if it meets the client's
expectations. If the RESTCONF client has external information as to expectations. The RESTCONF client MUST check the identity of the
the expected identity of the RESTCONF server, the hostname check MAY server according to Section 6 of [RFC6125], including processing the
be omitted. Otherwise, the RESTCONF client MUST check its outcome as described in Section 6.6 of [RFC6125].
understanding of the RESTCONF server hostname against the server's
identity as presented in the server certificate message. Matching is
performed according to the rules and guidelines defined in [RFC6125].
If the match fails, the RESTCONF client MUST either ask for explicit
user confirmation or terminate the connection with an indication that
the RESTCONF server's identity is suspect.
2.5. Authenticated Client Identity 2.5. Authenticated Client Identity
The RESTCONF server MUST authenticate the client access to any The RESTCONF server MUST authenticate client access to any protected
protected resource using HTTP Authentication [RFC7235]. If the resource using HTTP Authentication [RFC7235]. If the RESTCONF client
RESTCONF client is not authenticated to access a resource, the server is not authenticated to access a resource, the server MUST send a
MUST send a response with status code 401 (Unauthorized) and a WWW- response with status code 401 (Unauthorized) and a WWW-Authenticate
Authenticate header field containing at least one challenge header field containing at least one challenge applicable to the
applicable to the target resource. The RESTCONF server MAY advertise target resource. The RESTCONF server MAY advertise support for any
support for any number of authentication schemes but, in order to number of authentication schemes but, in order to ensure
ensure interoperability, the RESTCONF server MUST advertise at least interoperability, the RESTCONF server MUST advertise at least one of
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 due to their similarity to These authentication schemes are selected for to their similarity to
authentication schemes supported by NETCONF. In particular, the 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
verify 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-07]. 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
scheme is hereafter known as the "RESTCONF username" and subject to scheme is hereafter known as the "RESTCONF username" and subject to
the NETCONF Access Control Module (NACM) [RFC6536]. the NETCONF Access Control Module (NACM) [RFC6536].
3. Resources 3. Resources
The RESTCONF protocol operates on a hierarchy of resources, starting The RESTCONF protocol operates on a hierarchy of resources, starting
with the top-level API resource itself (Section 3.1). Each resource with the top-level API resource itself (Section 3.1). Each resource
represents a manageable component within the device. represents a manageable component within the device.
skipping to change at page 13, line 41 skipping to change at page 13, line 49
resources. The child resource types and methods allowed on them are resources. The child resource types and methods allowed on them are
data-model specific. data-model specific.
A resource has its own media type identifier, represented by the A resource has its own media type identifier, represented by the
"Content-Type" header in the HTTP response message. A resource can "Content-Type" header in the HTTP response message. A resource can
contain zero or more nested resources. A resource can be created and contain zero or more nested resources. A resource can be created and
deleted independently of its parent resource, as long as the parent deleted independently of its parent resource, as long as the parent
resource exists. resource exists.
All RESTCONF resources are defined in this document except specific All RESTCONF resources are defined in this document except specific
datastore contents, protocol operations, and notification events. datastore contents, protocol operations, and event notifications.
The syntax and semantics for these resource types are defined in YANG The syntax and semantics for these resource types are defined in YANG
modules. modules.
The RESTCONF resources are accessed via a set of URIs defined in this The RESTCONF resources are accessed via a set of URIs defined in this
document. The set of YANG modules supported by the server will document. The set of YANG modules supported by the server will
determine the data model specific operations, top-level data node determine the data model specific operations, top-level data node
resources, and notification event messages supported by the server. resources, and event notification messages supported by the server.
The RESTCONF protocol does not include a resource discovery The RESTCONF protocol does not include a resource discovery
mechanism. Instead, the definitions within the YANG modules mechanism. Instead, the definitions within the YANG modules
advertised by the server are used to construct a predictable advertised by the server are used to construct a predictable
operation or data resource identifier. operation or data resource identifier.
3.1. Root Resource Discovery 3.1. Root Resource Discovery
In line with the best practices defined by [RFC7320], RESTCONF In line with the best practices defined by [RFC7320], RESTCONF
enables deployments to specify where the RESTCONF API is located. enables deployments to specify where the RESTCONF API is located.
skipping to change at page 14, line 35 skipping to change at page 14, line 43
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; e.g. in this example a the operations supported by the the server. In this example a custom
custom "play" operation is supported: "play" operation is supported:
Request Request
------- -------
GET /restconf/operations HTTP/1.1 GET /restconf/operations HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.api+json Accept: application/yang.api+json
Response Response
-------- --------
HTTP/1.1 200 OK HTTP/1.1 200 OK
skipping to change at page 15, line 49 skipping to change at page 15, line 49
| | application/yang.errors+json | | | application/yang.errors+json |
| Operation | application/yang.operation+xml | | Operation | application/yang.operation+xml |
| | application/yang.operation+json | | | application/yang.operation+json |
| Schema | application/yang | | Schema | application/yang |
+-----------+---------------------------------+ +-----------+---------------------------------+
RESTCONF Media Types RESTCONF Media Types
3.3. API Resource 3.3. API Resource
The API resource contains the state and access points for the The API resource contains the entry points for the RESTCONF datastore
RESTCONF features. 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.
This resource has the following child resources: This resource has the following child resources:
+----------------+--------------------------------+ +----------------+--------------------------------+
| Child Resource | Description | | Child Resource | Description |
+----------------+--------------------------------+ +----------------+--------------------------------+
| data | Contains all data resources | | data | Contains all data resources |
| operations | Data-model specific operations | | operations | Data-model specific operations |
+----------------+--------------------------------+ +----------------+--------------------------------+
RESTCONF API Resource RESTCONF API Resource
skipping to change at page 16, line 38 skipping to change at page 16, line 40
This mandatory resource represents the combined configuration and This mandatory resource represents the combined configuration and
operational data resources that can be accessed by a client. It operational data resources that can be accessed by a client. It
cannot be created or deleted by the client. The datastore resource cannot be created or deleted by the client. The datastore resource
type is defined in Section 3.4. type is defined in Section 3.4.
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.3). 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+json 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+json Content-Type: application/yang.data+xml
{ <library xmlns="https://example.com/ns/example-jukebox">
"example-jukebox:library" : { <artist-count>42</artist-count>
"artist-count" : 42, <album-count>59</album-count>
"album-count" : 59, <song-count>374</song-count>
"song-count" : 374 </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 operations defined in the YANG modules
advertised by the server MAY be available as child nodes of this advertised by the server MAY be available as child nodes of this
resource. 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.
A "unified datastore" interface is used to simplify resource editing This resource type is an abstraction of the system's underlying
for the client. The RESTCONF unified datastore is a conceptual datastore implementation. It is used to simplify resource editing
interface to the native configuration datastores that are present on for the client. The RESTCONF datastore resource is a conceptual
the device. collection of all configuration and operational data that is present
on the device.
The underlying NETCONF datastores (i.e., candidate, running, startup)
can be used to implement the unified datastore, but the server design
is not limited to the exact datastore procedures defined in NETCONF.
The "candidate" and "startup" datastores are not visible in the Configuration edit transaction management and configuration
RESTCONF protocol. 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. client. A datastore resource can only be written directly with the
PATCH method. Each RESTCONF edit of a datastore resource is saved to
A datastore resource can only be written directly with the PATCH non-volatile storage in an implementation-specific matter by the
method. Only the configuration data resources within the datastore server.
resource can be edited directly with all methods.
Each RESTCONF edit of a datastore resource is saved to non-volatile
storage in an implementation-specific matter by the server. There is
no guarantee that configuration changes are saved immediately, or
that the saved configuration is always a mirror of the NETCONF
running datastore, if the server also supports NETCONF.
3.4.1. Edit Collision Detection 3.4.1. Edit Collision Detection
Two "edit collision detection" mechanisms are provided in RESTCONF, Two "edit collision detection" mechanisms are provided in RESTCONF,
for datastore and data resources. for datastore and data resources.
3.4.1.1. Timestamp 3.4.1.1. Timestamp
The last change time is maintained and the "Last-Modified" The last change time is maintained and the "Last-Modified"
([RFC7232], section 2.2) header is returned in the response for a ([RFC7232], Section 2.2) header is returned in the response for a
retrieval request. The "If-Unmodified-Since" header can be used in retrieval request. The "If-Unmodified-Since" header can be used in
edit operation requests to cause the server to reject the request if edit operation requests to cause the server to reject the request if
the resource has been modified since the specified timestamp. the resource has been modified since the specified timestamp.
The server MUST maintain a last-modified timestamp for the top-level The server MUST maintain a last-modified timestamp for the top-level
{+restconf}/data resource and SHOULD maintain last-modified {+restconf}/data resource and SHOULD maintain last-modified
timestamps for descendant resources. For all resources, the server timestamps for descendant resources. For all resources, the server
MUST return the "Last-Modified" header when the resource is retrieved MUST return the "Last-Modified" header when the resource is retrieved
with the GET or HEAD methods. If the server does not maintain a with the GET or HEAD methods. If the server does not maintain a
timestamp for a resource, it MUST return the timestamp of the timestamp for a resource, it MUST return the timestamp of the
resource's ancestor, a process that may recurse up to the top-level resource's ancestor, a process that may recurse up to the top-level
{+restconf}/data resource. Only changes to configuration data {+restconf}/data resource. Only changes to configuration data
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}/data resource and SHOULD maintain entity tags for {+restconf}/data resource and SHOULD maintain entity tags for
descendant resources. For all resources, the server MUST return the descendant resources. For all resources, the server MUST return the
"ETag" header when the resource is retrieved with the GET or HEAD "ETag" header when the resource is retrieved with the GET or HEAD
methods. If the server does not maintain an entity tag for a methods. If the server does not maintain an entity tag for a
resource, it MUST return the entity tag of the resource's ancestor, a resource, it MUST return the entity tag of the resource's ancestor, a
skipping to change at page 20, line 18 skipping to change at page 20, line 7
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 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
representation for the YANG data type. Any reserved characters
MUST be encoded with escape sequences, according to [RFC2396],
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 supported in the key leaf values. Quoted
strings MUST be used to express empty strings. (example: strings MUST be used to express empty strings. (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.
skipping to change at page 21, line 38 skipping to change at page 21, line 38
api-path = "/" | api-path = "/" |
("/" api-identifier ("/" api-identifier
0*("/" (api-identifier | list-instance ))) 0*("/" (api-identifier | list-instance )))
api-identifier = [module-name ":"] identifier ;; note 1 api-identifier = [module-name ":"] identifier ;; note 1
module-name = identifier module-name = identifier
list-instance = api-identifier "=" key-value ["," key-value]* list-instance = api-identifier "=" key-value ["," key-value]*
key-value = string key-value = string ;; note 1
string = <a quoted or unquoted or empty string> string = <a quoted or unquoted string>
;; An identifier MUST NOT start with ;; An identifier MUST NOT start with
;; (('X'|'x') ('M'|'m') ('L'|'l')) ;; (('X'|'x') ('M'|'m') ('L'|'l'))
identifier = (ALPHA / "_") identifier = (ALPHA / "_")
*(ALPHA / DIGIT / "_" / "-" / ".") *(ALPHA / DIGIT / "_" / "-" / ".")
Note 1: The syntax for "api-identifier" MUST conform to the JSON Note 1: The syntax for "api-identifier" and "key-value" MUST conform
identifier encoding rules in section 4 of to the JSON identifier encoding rules in Section 4 of
[I-D.ietf-netmod-yang-json]. [I-D.ietf-netmod-yang-json].
3.5.2. Defaults Handling 3.5.2. Defaults Handling
RESTCONF requires that a server report its default handling mode (see RESTCONF requires that a server report its default handling mode (see
Section 4.8.2 for details). If the optional "with-defaults" query Section 9.1.2 for details). If the optional "with-defaults" query
parameter is supported by the server, a client may use it to control parameter is supported by the server, a client may use it to control
retrieval of default values (see Section 4.8.11 for details). retrieval of default values (see Section 4.8.9 for details).
If the target of a GET method is a data node that represents a leaf If the target of a GET method is a data node that represents a leaf
that has a default value, and the leaf has not been given a value that has a default value, and the leaf has not been given a value
yet, the server MUST return the default value that is in use by the yet, the server MUST return the default value that is in use by the
server. server.
If the target of a GET method is a data node that represents a If the target of a GET method is a data node that represents a
container or list that has any child resources with default values, container or list that has any child resources with default values,
for the child resources that have not been given value yet, the for the child resources that have not been given value yet, the
server MAY return the default values that are in use by the server, server MAY return the default values that are in use by the server,
in accordance with its reported default handing mode and query in accordance with its reported default handing mode and query
parameters passed by the client. parameters passed by the client.
3.6. Operation Resource 3.6. Operation Resource
An operation resource represents a protocol operation defined with An operation resource represents a protocol operation defined with
the YANG "rpc" statement. the YANG "rpc" statement. It is invoked using a POST method on the
operation resource.
All operation resources share the same module namespace as any top- POST {+restconf}/operations/<operation>
level data resources, so the name of an operation resource cannot
conflict with the name of a top-level data resource defined within
the same module.
If 2 different YANG modules define the same "rpc" identifier, then The <operation> field identifies the module name and rpc identifier
the module name MUST be used in the request URI. For example, if string for the desired operation.
"module-A" and "module-B" both defined a "reset" operation, then
invoking the operation from "module-A" would be requested as follows: For example, if "module-A" defined a "reset" operation, then 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
Any usage of an operation resource from the same module, with the
same name, refers to the same "rpc" statement definition. This
behavior can be used to design protocol operations that perform the
same general function on different resource types.
If the "rpc" statement has an "input" section, then a message-body If the "rpc" statement has an "input" section, then a message-body
MAY be sent by the client in the request, otherwise the request MAY be sent by the client in the request, otherwise the request
message MUST NOT include a message-body. If the "rpc" statement has message MUST NOT include a message-body.
an "output" section, then a message-body MAY be sent by the server in
the response, otherwise the response message MUST NOT include a If the operation is successfully invoked, and if the "rpc" statement
message-body in the response message, and MUST send a "204 No has an "output" section, then a message-body MAY be sent by the
Content" status-line instead. 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
SHOULD be sent by the server, containing an "errors" resource, as
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 "rpc" statement has an "input" section, then the "input" node
is provided in the message-body, corresponding to the YANG data is provided in the message-body, corresponding to the YANG data
definition statements within the "input" section. 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 {
namespace "https://example.com/ns/example-ops";
prefix "ops";
rpc reboot { rpc reboot {
input { input {
leaf delay { leaf delay {
units seconds; units seconds;
type uint32; type uint32;
default 0; default 0;
} }
leaf message { type string; } leaf message { type string; }
leaf language { type string; } leaf language { type string; }
} }
} }
rpc get-reboot-info {
output {
leaf reboot-time {
units seconds;
type uint32;
}
leaf message { 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+json Content-Type: application/yang.operation+xml
<input xmlns="https://example.com/ns/example-ops">
{ <delay>600</delay>
"example-ops:input" : { <message>Going down for system maintenance</message>
"delay" : 600, <language>en-US</language>
"message" : "Going down for system maintenance", </input>
"language" : "en-US"
}
}
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 "rpc" statement has an "output" section, then the "output"
node is provided in the message-body, corresponding to the YANG data node is provided in the message-body, corresponding to the YANG data
definition statements within the "output" section. definition statements within the "output" section.
Example: Example:
The following YANG definition is used for the examples in this The "example-ops" YANG module defined in Section 3.6.1 is used for
section. the examples in this section.
rpc get-reboot-info {
output {
leaf reboot-time {
units seconds;
type uint32;
}
leaf message { 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: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
skipping to change at page 24, line 48 skipping to change at page 25, line 5
Content-Type: application/yang.operation+json Content-Type: application/yang.operation+json
{ {
"example-ops:output" : { "example-ops:output" : {
"reboot-time" : 30, "reboot-time" : 30,
"message" : "Going down for system maintenance", "message" : "Going down for system maintenance",
"language" : "en-US" "language" : "en-US"
} }
} }
3.6.3. Encoding Operation Errors
If any errors occur while attempting to invoke the operation, then an
"errors" data structure is returned with the appropriate error
status.
Using the "reset" operation example above, the client might send the
following POST request message:
POST /restconf/operations/example-ops:reboot HTTP/1.1
Host: example.com
Content-Type: application/yang.operation+xml
<input xmlns="https://example.com/ns/example-ops">
<delay>-33</delay>
<message>Going down for system maintenance</message>
<language>en-US</language>
</input>
The server might respond with an "invalid-value" error:
HTTP/1.1 400 Bad Request
Date: Mon, 25 Apr 2012 11:10:30 GMT
Server: example-server
Content-Type: application/yang.errors+xml
<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error>
<error-type>protocol</error-type>
<error-tag>invalid-value</error-tag>
<error-path xmlns:err="https://example.com/ns/example-ops">
err:input/err:delay
</error-path>
<error-message>Invalid input parameter</error-message>
</error>
</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. To retrieve a YANG module, a client first needs to get the supports, using the "ietf-yang-library" module, defined in
URL for retrieving the schema. [I-D.ietf-netconf-yang-library].
To retrieve a YANG module, a client first needs to get the URL for
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/2014-07-03" "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/2014-07-03 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 {
namespace "http://example.com/ns/example-jukebox"; // contents of YANG module deleted for this example...
prefix "jbox";
// rest of YANG module content deleted...
} }
3.8. Event Stream Resource 3.8. Event Stream Resource
An "event stream" resource represents a source for system generated An "event stream" resource represents a source for system generated
event notifications. Each stream is created and modified by the event notifications. Each stream is created and modified by the
server only. A client can retrieve a stream resource or initiate a server only. A client can retrieve a stream resource or initiate a
long-poll server sent event stream, using the procedure specified in long-poll server sent event stream, using the procedure specified in
Section 6.3. Section 6.3.
skipping to change at page 26, line 28 skipping to change at page 27, line 26
behavior is defined in Section 7. behavior is defined in Section 7.
4. Operations 4. Operations
The RESTCONF protocol uses HTTP methods to identify the CRUD The RESTCONF protocol uses HTTP methods to identify the CRUD
operation requested for a particular resource. operation requested for a particular resource.
The following table shows how the RESTCONF operations relate to The following table shows how the RESTCONF operations relate to
NETCONF protocol operations: NETCONF protocol operations:
+----------+-------------------------------------+ +----------+--------------------------------------------+
| RESTCONF | NETCONF | | RESTCONF | NETCONF |
+----------+-------------------------------------+ +----------+--------------------------------------------+
| OPTIONS | none | | OPTIONS | none |
| HEAD | none | | HEAD | none |
| GET | <get-config>, <get> | | GET | <get-config>, <get> |
| POST | <edit-config> (operation="create") | | POST | <edit-config> (operation="create") |
| PUT | <edit-config> (operation="replace") | | PUT | <edit-config> (operation="create/replace") |
| PATCH | <edit-config> (operation="merge") | | PATCH | <edit-config> (operation="merge") |
| DELETE | <edit-config> (operation="delete") | | DELETE | <edit-config> (operation="delete") |
+----------+-------------------------------------+ +----------+--------------------------------------------+
Table 1: CRUD Methods in RESTCONF Table 1: CRUD Methods in RESTCONF
The NETCONF "remove" operation attribute is not supported by the HTTP The NETCONF "remove" operation attribute is not supported by the HTTP
DELETE method. The resource must exist or the DELETE method will DELETE method. The resource must exist or the DELETE method will
fail. The PATCH method is equivalent to a "merge" operation when fail. The PATCH method is equivalent to a "merge" operation when
using a plain patch (see Section 4.6.1), other media-types may using a plain patch (see Section 4.6.1), other media-types may
provide more granular control. provide more granular control.
Access control mechanisms may be used to limit what operations can be Access control mechanisms may be used to limit what operations can be
skipping to change at page 27, line 37 skipping to change at page 28, line 34
defined in [RFC5789]. defined in [RFC5789].
4.2. HEAD 4.2. HEAD
The HEAD method is sent by the client to retrieve just the headers The HEAD method is sent by the client to retrieve just the headers
that would be returned for the comparable GET method, without the that would be returned for the comparable GET method, without the
response message-body. It is supported for all resource types, response message-body. It is supported for all resource types,
except operation resources. except operation resources.
The request MUST contain a request URI that contains at least the The request MUST contain a request URI that contains at least the
entry point component. The same query parameters supported by the entry point. The same query parameters supported by the GET method
GET method are supported by the HEAD method. are supported by the HEAD method.
The access control behavior is enforced as if the method was GET The access control behavior is enforced as if the method was GET
instead of HEAD. The server MUST respond the same as if the method instead of HEAD. The server MUST respond the same as if the method
was GET instead of HEAD, except that no response message-body is was GET instead of HEAD, except that no response message-body is
included. included.
4.3. GET 4.3. GET
The GET method is sent by the client to retrieve data and meta-data The GET method is sent by the client to retrieve data and meta-data
for a resource. It is supported for all resource types, except for a resource. It is supported for all resource types, except
operation resources. The request MUST contain a request URI that operation resources. The request MUST contain a request URI that
contains at least the entry point component. contains at least the entry point.
The server MUST NOT return any data resources for which the user does The server MUST NOT return any data resources for which the user does
not have read privileges. If the user is not authorized to read the not have read privileges. If the user is not authorized to read the
target resource, an error response containing a "403 Forbidden" or target resource, an error response containing a "403 Forbidden" or
"404 Not Found" status-line is returned to the client. "404 Not Found" status-line is returned to the client.
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 a JSON The client might request the response headers for a JSON
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+json 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+json 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">
"example-jukebox:album" : [ <name>Wasting Light</name>
{ <genre xmlns:g="http://example.com/ns/example-jukebox">
"name" : "Wasting Light", g:alternative
"genre" : "example-jukebox:alternative", </genre>
"year" : 2011 <year>2011</2011>
} </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 29, line 48 skipping to change at page 30, line 38
Example: Example:
To create a new "jukebox" resource, the client might send: To create a new "jukebox" resource, the client might send:
POST /restconf/data HTTP/1.1 POST /restconf/data HTTP/1.1
Host: example.com Host: example.com
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ "example-jukebox:jukebox" : [null] } { "example-jukebox:jukebox" : [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
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/example-jukebox:jukebox Location: https://example.com/restconf/data/
Last-Modified: Mon, 23 Apr 2012 17:01:00 GMT example-jukebox:jukebox
ETag: b3a3e673be2 Last-Modified: Mon, 23 Apr 2012 17:01:00 GMT
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 14 skipping to change at page 32, line 5
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.
The "insert" (Section 4.8.6) and "point" (Section 4.8.7) query The "insert" (Section 4.8.4) and "point" (Section 4.8.5) query
parameters are supported by the PUT method for data resources. parameters are supported by the PUT method for data resources.
Consistent with [RFC7231], if the PUT request creates a new resource, Consistent with [RFC7231], if the PUT request creates a new resource,
a "201 Created" status-line is returned. If an existing resource is a "201 Created" status-line is returned. If an existing resource is
modified, either "200 OK" or "204 No Content" are returned. modified, either "200 OK" or "204 No Content" are returned.
If the user is not authorized to create or replace the target If the user is not authorized to create or replace the target
resource an error response containing a "403 Forbidden" or "404 Not resource an error response containing a "403 Forbidden" or "404 Not
Found" status-line is returned to the client. All other error Found" status-line is returned to the client. All other error
responses are handled according to the procedures defined in responses are handled according to the procedures defined in
skipping to change at page 33, line 9 skipping to change at page 33, line 46
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+json Content-Type: application/yang.data+xml
{ <album xmlns="http://example.com/ns/example-jukebox">
"example-jukebox:album" : { <year>2011</year>
"year" : 2011 </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
The XML encoding for the same request might be:
PATCH /restconf/data/example-jukebox:jukebox/
library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
Host: example.com
If-Match: b8389233a4c
Content-Type: application/yang.data+xml
<album xmlns="http://example.com/ns/example-jukebox">
<year>2011</year>
</album>
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.
skipping to change at page 35, line 9 skipping to change at page 35, line 39
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
prefix (such as the enterprise or organization name) for query prefix (such as the enterprise or organization name) for query
parameter names in order to avoid collisions with other parameters. parameter names in order to avoid collisions with other parameters.
4.8.1. Query Parameter URIs 4.8.1. The "content" Query Parameter
A new set of RESTCONF Capability URIs are defined to identify the
specific query parameters and protocol features supported by the
server.
+--------------+----------------------------------------------------+
| Name | URI |
+--------------+----------------------------------------------------+
| defaults | urn:ietf:params:restconf:capability:defaults:1.0 |
| depth | urn:ietf:params:restconf:capability:depth:1.0 |
| fields | urn:ietf:params:restconf:capability:fields:1.0 |
| filter | urn:ietf:params:restconf:capability:filter:1.0 |
| insert | urn:ietf:params:restconf:capability:insert:1.0 |
| replay | urn:ietf:params:restconf:capability:replay:1.0 |
| with- | urn:ietf:params:restconf:capability:with- |
| defaults | defaults:1.0 |
+--------------+----------------------------------------------------+
RESTCONF Query Parameter URIs
4.8.2. The "defaults" Protocol Capability URI
This URI identifies the defaults handling mode that is used by the
server for processing default leafs in the unified datastore. A
parameter named "basic-mode" is required for this capability URI.
The "basic-mode" definitions are specified in the "With-Defaults
Capability for NETCONF" [RFC6243].
This protocol capability URI MUST be supported by the server, and the
MUST be listed in the "capability" leaf-list in Section 9.3.
+------------+------------------------------------------------------+
| Value | Description |
+------------+------------------------------------------------------+
| report-all | No data nodes are considered default |
| trim | Values set to the YANG default-stmt value are |
| | default |
| explicit | Values set by the client are never considered |
| | default |
+------------+------------------------------------------------------+
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
[RFC6243].
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].
If the "basic-mode" is set to "explicit" then the server MUST adhere
to the defaults handling behavior defined in section 2.3 of
[RFC6243].
Example: (split for display purposes only)
urn:ietf:params:restconf:capability:defaults:1.0?
basic-mode=explicit
4.8.3. The "content" Query Parameter
The "content" parameter controls how descendant nodes of the The "content" parameter controls how descendant nodes of the
requested data nodes will be processed in the reply. requested data nodes will be processed in the reply.
The allowed values are: The allowed values are:
+-----------+-----------------------------------------------------+ +-----------+-----------------------------------------------------+
| Value | Description | | Value | Description |
+-----------+-----------------------------------------------------+ +-----------+-----------------------------------------------------+
| config | Return only configuration descendant data nodes | | config | Return only configuration descendant data nodes |
skipping to change at page 36, line 46 skipping to change at page 36, line 16
resources. A 400 Bad Request error is returned if used for other resources. A 400 Bad Request error is returned if used for other
methods or resource types. methods or resource types.
The default value is determined by the "config" statement value of The default value is determined by the "config" statement value of
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.4. 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. Any child nodes which
are contained within a parent node have a depth value that is 1 are contained within a parent node have a depth value that is 1
greater than its parent. 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
requested resource. Only one level of sub-resources with a different requested resource. Only one level of sub-resources with a different
media type than the target resource will be returned. media type than the target resource will be returned.
If this query parameter is supported by the server, then the "depth" If the "depth" query parameter URI is listed in the "capability"
query parameter URI MUST be listed in the "capability" leaf-list in leaf-list in Section 9.3, then the server supports the "depth" query
Section 9.3. parameter.
4.8.5. 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 /
skipping to change at page 38, line 9 skipping to change at page 37, line 22
album, use: "fields=admin(label;catalogue-number)". 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/label". "fields=admin/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 this query parameter is supported by the server, then the "fields" If the "fields" query parameter URI is listed in the "capability"
query parameter URI MUST be listed in the "capability" leaf-list in leaf-list in Section 9.3, then the server supports the "fields"
Section 9.3. parameter.
4.8.6. 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. |
skipping to change at page 38, line 42 skipping to change at page 38, line 9
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
Bad Request error is returned. Bad Request error is returned.
If this query parameter is supported by the server, then the "insert" The "insert" query parameter MUST be supported by the server.
query parameter URI MUST be listed in the "capability" leaf-list in
Section 9.3. The "point" query parameter MUST also be supported by
the server.
4.8.7. The "point" Query Parameter 4.8.5. The "point" Query Parameter
The "point" parameter is used to specify the insertion point for a The "point" parameter is used to specify the insertion point for a
data resource that is being created or moved within a user ordered data resource that is being created or moved within a user ordered
list or leaf-list. list or leaf-list.
The value of the "point" parameter is of type The value of the "point" parameter is a string that identifies the
"data-resource-identifier", defined in the "ietf-restconf" YANG path to the insertion point object. The format is the same as a
module Section 8. target resource URI string.
This parameter is only supported for the POST and PUT methods. It is This parameter is only supported for the POST and PUT methods. It is
also only supported if the target resource is a data resource, and also only supported if the target resource is a data resource, and
that data represents a YANG list or leaf-list that is ordered by the that data represents a YANG list or leaf-list that is ordered by the
user. user.
If the "insert" query parameter is not present, or has a value other If the "insert" query parameter is not present, or has a value other
than "before" or "after", then a 400 Bad Request error is returned. than "before" or "after", then a 400 Bad Request error is returned.
This parameter contains the instance identifier of the resource to be This parameter contains the instance identifier of the resource to be
used as the insertion point for a POST or PUT method. used as the insertion point for a POST or PUT method.
If the server includes the "insert" query parameter URI in the The "point" query parameter MUST be supported by the server.
"capability" leaf-list in Section 9.3, then the "point" query
parameter MUST be supported.
4.8.8. The "filter" Query Parameter 4.8.6. The "filter" Query Parameter
The "filter" parameter is used to indicate which subset of all The "filter" parameter is used to indicate which subset of all
possible events are of interest. If not present, all events not possible events are of interest. If not present, all events not
precluded by other parameters will be sent. precluded by other parameters will be sent.
This parameter is only allowed for GET methods on a text/event-stream This parameter is only allowed for GET methods on a text/event-stream
data resource. A 400 Bad Request error is returned if used for other data resource. A 400 Bad Request error is returned if used for other
methods or resource types. methods or resource types.
The format of this parameter is an XPath 1.0 expression, and is The format of this parameter is an XPath 1.0 expression, and is
skipping to change at page 39, line 49 skipping to change at page 39, line 12
is the YANG module name, and the namespace is as defined by the is the YANG module name, and the namespace is as defined by the
"namespace" statement in the YANG module. "namespace" statement in the YANG module.
o The function library is the core function library defined in XPath o The function library is the core function library defined in XPath
1.0. 1.0.
o The set of variable bindings is empty. o The set of variable bindings is empty.
o The context node is the root node. o The context node is the root node.
The filter is used as defined in [RFC5277], section 3.6. If the The filter is used as defined in [RFC5277], Section 3.6. If the
boolean result of the expression is true when applied to the boolean result of the expression is true when applied to the
conceptual "notification" document root, then the notification event conceptual "notification" document root, then the event notification
is delivered to the client. is delivered to the client.
If this query parameter is supported by the server, then the "filter" If the "filter" query parameter URI is listed in the "capability"
query parameter URI MUST be listed in the "capability" leaf-list in leaf-list in Section 9.3, then the server supports the "filter" query
Section 9.3. parameter.
4.8.9. The "start-time" Query Parameter 4.8.7. The "start-time" Query Parameter
The "start-time" parameter is used to trigger the notification replay The "start-time" parameter is used to trigger the notification replay
feature and indicate that the replay should start at the time feature and indicate that the replay should start at the time
specified. If the stream does not support replay, per the specified. If the stream does not support replay, per the
"replay-support" attribute returned by stream list entry for the "replay-support" attribute returned by stream list entry for the
stream resource, then the server MUST return the HTTP error code 400 stream resource, then the server MUST return the HTTP error code 400
Bad Request. Bad Request.
The value of the "start-time" parameter is of type "date-and-time", The value of the "start-time" parameter is of type "date-and-time",
defined in the "ietf-yang" YANG module [RFC6991]. defined in the "ietf-yang" YANG module [RFC6991].
skipping to change at page 40, line 40 skipping to change at page 40, line 5
If this query parameter is supported by the server, then the "replay" If this query parameter is supported by the server, then the "replay"
query parameter URI MUST be listed in the "capability" leaf-list in query parameter URI MUST be listed in the "capability" leaf-list in
Section 9.3. The "stop-time" query parameter MUST also be supported Section 9.3. The "stop-time" query parameter MUST also be supported
by the server. by the server.
If the "replay-support" leaf is present in the "stream" entry If the "replay-support" leaf is present in the "stream" entry
(defined in Section 9.3) then the server MUST support the (defined in Section 9.3) then the server MUST support the
"start-time" and "stop-time" query parameters for that stream. "start-time" and "stop-time" query parameters for that stream.
4.8.10. The "stop-time" Query Parameter 4.8.8. The "stop-time" Query Parameter
The "stop-time" parameter is used with the replay feature to indicate The "stop-time" parameter is used with the replay feature to indicate
the newest notifications of interest. This parameter MUST be used the newest notifications of interest. This parameter MUST be used
with and have a value later than the "start-time" parameter. with and have a value later than the "start-time" parameter.
The value of the "stop-time" parameter is of type "date-and-time", The value of the "stop-time" parameter is of type "date-and-time",
defined in the "ietf-yang" YANG module [RFC6991]. defined in the "ietf-yang" YANG module [RFC6991].
This parameter is only allowed for GET methods on a text/event-stream This parameter is only allowed for GET methods on a text/event-stream
data resource. A 400 Bad Request error is returned if used for other data resource. A 400 Bad Request error is returned if used for other
skipping to change at page 41, line 18 skipping to change at page 40, line 31
If this query parameter is supported by the server, then the "replay" If this query parameter is supported by the server, then the "replay"
query parameter URI MUST be listed in the "capability" leaf-list in query parameter URI MUST be listed in the "capability" leaf-list in
Section 9.3. The "start-time" query parameter MUST also be supported Section 9.3. The "start-time" query parameter MUST also be supported
by the server. by the server.
If the "replay-support" leaf is present in the "stream" entry If the "replay-support" leaf is present in the "stream" entry
(defined in Section 9.3) then the server MUST support the (defined in Section 9.3) then the server MUST support the
"start-time" and "stop-time" query parameters for that stream. "start-time" and "stop-time" query parameters for that stream.
4.8.11. 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 are not |
| | reported | | | reported |
| explicit | Data nodes set by the client are not reported | | explicit | Data nodes set by the client are not reported |
| report-all-tagged | All data nodes are reported and defaults are | | report-all-tagged | All data nodes are reported and defaults are |
skipping to change at page 41, line 38 skipping to change at page 41, line 4
+-------------------+-----------------------------------------------+ +-------------------+-----------------------------------------------+
| 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 are not |
| | reported | | | reported |
| explicit | Data nodes set by the client are not reported | | explicit | Data nodes set by the client are not reported |
| report-all-tagged | All data nodes are reported and defaults are | | report-all-tagged | All data nodes are reported and defaults are |
| | tagged | | | tagged |
+-------------------+-----------------------------------------------+ +-------------------+-----------------------------------------------+
If the "with-defaults" parameter is set to "report-all" then the If the "with-defaults" parameter is set to "report-all" then the
server MUST adhere to the defaults reporting behavior defined in server MUST adhere to the defaults reporting behavior defined in
section 3.1 of [RFC6243]. Section 3.1 of [RFC6243].
If the "with-defaults" parameter is set to "trim" then the server If the "with-defaults" parameter is set to "trim" then the server
MUST adhere to the defaults reporting behavior defined in section 3.2 MUST adhere to the defaults reporting behavior defined in Section 3.2
of [RFC6243]. of [RFC6243].
If the "with-defaults" parameter is set to "explicit" then the server If the "with-defaults" parameter is set to "explicit" then the server
MUST adhere to the defaults reporting behavior defined in section 3.3 MUST adhere to the defaults reporting behavior defined in Section 3.3
of [RFC6243]. of [RFC6243].
If the "with-defaults" parameter is set to "report-all-tagged" then If the "with-defaults" parameter is set to "report-all-tagged" then
the server MUST adhere to the defaults reporting behavior defined in the server MUST adhere to the defaults reporting behavior defined in
section 3.4 of [RFC6243]. Section 3.4 of [RFC6243].
If the "with-defaults" parameter is not present then the server MUST If the "with-defaults" parameter is not present then the server MUST
adhere to the defaults reporting behavior defined in its "basic-mode" adhere to the defaults reporting behavior defined in its "basic-mode"
parameter for the "defaults" protocol capability URI, defined in parameter for the "defaults" protocol capability URI, defined in
Section 4.8.2. Section 9.1.2.
If the server includes the "with-defaults" query parameter URI in the If the server includes the "with-defaults" query parameter URI in the
"capability" leaf-list in Section 9.3, then the "with-defaults" query "capability" leaf-list in Section 9.3, then the "with-defaults" query
parameter MUST be supported. parameter MUST be supported.
5. Messages 5. Messages
The RESTCONF protocol uses HTTP entities for messages. A single HTTP The RESTCONF protocol uses HTTP entities for messages. A single HTTP
message corresponds to a single protocol method. Most messages can message corresponds to a single protocol method. Most messages can
perform a single task on a single resource, such as retrieving a perform a single task on a single resource, such as retrieving a
skipping to change at page 43, line 24 skipping to change at page 42, line 38
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. All query These have the familiar form of "name=value" pairs. All 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 query parameter is identified by a URI. use by the client. Each query parameter is identified by a URI.
The server MUST list the query parameter URIs it supports in the The server MUST list the query parameter URIs it supports in the
"capabilities" list defined in Section 9.3. "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 [RFC2396], Section 3.4. Any reserved characters MUST be
encoded with escape sequences, according to [RFC2396], section 2.4. encoded with escape sequences, according to [RFC2396], Section 2.4.
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 47, line 14 skipping to change at page 47, line 14
<streams <streams
xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring"> xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring">
<stream> <stream>
<name>NETCONF</name> <name>NETCONF</name>
<description>default NETCONF event stream <description>default NETCONF event stream
</description> </description>
<replay-support>true</replay-support> <replay-support>true</replay-support>
<replay-log-creation-time> <replay-log-creation-time>
2007-07-08T00:00:00Z 2007-07-08T00:00:00Z
</replay-log-creation-time> </replay-log-creation-time>
<encoding> <access>
<type>xml</type> <encoding>xml</encoding>
<events>https://example.com/streams/NETCONF</events> <location>https://example.com/streams/NETCONF
</encoding> </location>
<encoding> </access>
<type>json</type> <access>
<events>https://example.com/streams/NETCONF-JSON</events> <encoding>json</encoding>
</encoding> <location>https://example.com/streams/NETCONF-JSON
</location>
</access>
</stream> </stream>
<stream> <stream>
<name>SNMP</name> <name>SNMP</name>
<description>SNMP notifications</description> <description>SNMP notifications</description>
<replay-support>false</replay-support> <replay-support>false</replay-support>
<encoding> <access>
<type>xml</type> <encoding>xml</encoding>
<events>https://example.com/streams/SNMP</events> <location>https://example.com/streams/SNMP</location>
</encoding> </access>
</stream> </stream>
<stream> <stream>
<name>syslog-critical</name> <name>syslog-critical</name>
<description>Critical and higher severity <description>Critical and higher severity
</description> </description>
<replay-support>true</replay-support> <replay-support>true</replay-support>
<replay-log-creation-time> <replay-log-creation-time>
2007-07-01T00:00:00Z 2007-07-01T00:00:00Z
</replay-log-creation-time> </replay-log-creation-time>
<encoding> <access>
<type>xml</type> <encoding>xml</encoding>
<events> <location>
https://example.com/streams/syslog-critical https://example.com/streams/syslog-critical
</events> </location>
</encoding> </access>
</stream> </stream>
</streams> </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
"events" leaf with the stream list entry. The value returned by the "location" leaf with the stream list entry. The value returned by
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".
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/encoding=xml/events HTTP/1.1 streams/stream=NETCONF/encoding=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
<events <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
</events> </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
skipping to change at page 49, line 23 skipping to change at page 49, line 23
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.
+------------+---------+-------------------------+ +------------+---------+-------------------------+
| Name | Section | Description | | Name | Section | Description |
+------------+---------+-------------------------+ +------------+---------+-------------------------+
| start-time | 4.8.9 | replay event start time | | start-time | 4.8.7 | replay event start time |
| stop-time | 4.8.10 | replay event stop time | | stop-time | 4.8.8 | replay event stop time |
| filter | 4.8.8 | boolean content filter | | filter | 4.8.6 | boolean content filter |
+------------+---------+-------------------------+ +------------+---------+-------------------------+
NETCONF Stream Query Parameters NETCONF Stream Query Parameters
The semantics and syntax for these query parameters are defined in The semantics and syntax for these query parameters are defined in
the sections listed above. The YANG encoding MUST be converted to the sections listed above. The YANG encoding MUST be converted to
URL-encoded string for use in the request URI. URL-encoded string for use in the request URI.
Refer to Appendix D.3.6 for filter parameter examples. Refer to Appendix D.3.6 for filter parameter examples.
6.4. Receiving Event Notifications 6.4. Receiving Event Notifications
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 is "ietf-restconf". For JSON encoding purposes, the module name for the "notification"
element is "ietf-restconf".
An example SSE notification encoded using XML: Two child nodes within the "notification" container are expected,
representing the event time and the event payload. The "event-time"
node is defined within the "ietf-restconf" module namespace. The
name and namespace of the payload element are determined by the YANG
module containing the notification-stmt.
In the following example, the YANG module "example-mod" is used:
module example-mod {
namespace "http://example.com/event/1.0";
notification event {
leaf event-class { type string; }
container reporting-entity {
leaf card { type string; }
}
leaf severity { type string; }
}
}
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 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: }
skipping to change at page 53, line 12 skipping to change at page 54, line 10
document, except for the one below, assume the default XML encoding document, except for the one below, assume the default XML encoding
will be returned if there is an error. 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-node)? +--ro error-path? instance-identifier
| +--:(error-path)
| | +--ro error-path? instance-identifier
| +--:(error-urlpath)
| +--ro error-urlpath? data-resource-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"
skipping to change at page 55, line 16 skipping to change at page 55, line 41
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-01-30.yang" <CODE BEGINS> file "ietf-restconf@2015-06-04.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 23 skipping to change at page 56, line 47
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-04.txt // Note: extracted from draft-ietf-netconf-restconf-05.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-01-30 { revision 2015-06-04 {
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
// 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 template. 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
scope of this extension statement. RFC 6020 defines XML scope of this extension statement. RFC 6020 defines XML
encoding rules for all RESTCONF media types that use encoding rules for all RESTCONF media types that use
the '+xml' suffix. draft-ietf-netmod-yang-json defines the '+xml' suffix. draft-ietf-netmod-yang-json defines
JSON encoding rules for all RESTCONF media types that JSON encoding rules for all RESTCONF media types that
use the '+json' suffix. use the '+json' suffix.
The 'media-type-id' parameter value identifies the media type The 'media-type-id' parameter value identifies the media type
that is being defined. It contains the string associated that is being defined. It contains the string associated
skipping to change at page 58, line 4 skipping to change at page 58, line 28
- The list-stmt is not required to have a key-stmt defined. - The list-stmt is not required to have a key-stmt defined.
- The if-feature-stmt is ignored if present. - The if-feature-stmt is ignored if present.
- The config-stmt is ignored if present. - The config-stmt is ignored if present.
- The available identity values for any 'identityref' - The available identity values for any 'identityref'
leaf or leaf-list nodes is limited to the module leaf or leaf-list nodes is limited to the module
containing this extension statement, and the modules containing this extension statement, and the modules
imported into that module. imported into that module.
"; ";
} }
rc:restconf-media-type "application/yang.errors" { rc:restconf-media-type "application/yang.errors" {
uses errors; uses errors;
} }
rc:restconf-media-type "application/yang.api" { rc:restconf-media-type "application/yang.api" {
uses restconf; uses restconf;
} }
typedef data-resource-identifier {
type string {
length "1 .. max";
}
description
"Contains a Data Resource Identifier formatted string
to identify a specific data resource instance.
The document root for all data resources is a
datastore resource container. Each top-level YANG
data nodes supported by the server will be represented
as a child node of the document root.
The canonical representation of a data resource identifier
includes the full server specification that is returned
in the Location header when a new data resource is created
with the POST method.
The abbreviated representation does not contain any server
location identification. Instead the identifier will start
with the '/' character to represent the datastore document
root for the data resource instance.
The server MUST accept either representation and SHOULD
return the canonical representation in any response message.";
reference
"RFC XXXX: [sec. 5.3.1.1 ABNF For Data Resource Identifiers]";
}
grouping errors { grouping errors {
description description
"A grouping that contains a YANG container "A grouping that contains a YANG container
representing the syntax and semantics of a representing the syntax and semantics of a
YANG Patch errors report within a response message."; YANG Patch errors report within a response message.";
container errors { container errors {
description description
"Represents an error report returned by the server if "Represents an error report returned by the server if
a request results in an error."; a request results in an error.";
skipping to change at page 59, line 46 skipping to change at page 59, line 40
description description
"The enumerated error tag."; "The enumerated error tag.";
} }
leaf error-app-tag { leaf error-app-tag {
type string; type string;
description description
"The application-specific error tag."; "The application-specific error tag.";
} }
choice error-node { leaf error-path {
type instance-identifier;
description description
"The server will return the location of the error node "The YANG instance identifier associated
in a format that is appropriate for the protocol. with the error node.";
If no specific node within the request message body
caused the error then this choice will not be present.";
leaf error-path {
type instance-identifier;
description
"The YANG instance identifier associated
with the error node. This leaf will only be
present if the error node is not a data resource,
e.g., the error node is an input parameter
for an operation resource.";
}
leaf error-urlpath {
type data-resource-identifier;
description
"The target data resource identifier associated
with the error node. This leaf will only be
present if the error node is associated with
a data resource (either within the server or
in the request message).";
}
} }
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 "Arbitrary XML that represents a container
of additional information for the error report."; of additional information for the error report.";
} }
} }
} }
} // grouping errors }
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
application/yang.api resource type."; application/yang.api resource type.";
skipping to change at page 61, line 31 skipping to change at page 61, line 4
E.g.; E.g.;
POST /restconf/operations/show-log-errors POST /restconf/operations/show-log-errors
leaf show-log-errors { leaf show-log-errors {
type empty; type empty;
} }
"; ";
} }
} // container restconf
} // grouping restconf }
}
} }
<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 notification event streams RESTCONF protocol capabilities and event notification streams
available from the server. Implementation is mandatory for RESTCONF available from the server. Implementation is mandatory for RESTCONF
servers, if any protocol capabilities or notification event streams servers, if any protocol capabilities or event notification streams
are supported. are supported.
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 encoding* [type] +--ro access* [type]
+--ro type string +--ro encoding string
+--ro events 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.
The server SHOULD maintain an entity-tag for this container, and The server SHOULD maintain an entity-tag for this container, and
return the "ETag" header when this data node is retrieved with the return the "ETag" header when this data node is retrieved with the
GET or HEAD methods. GET or HEAD methods.
The server MUST include a "capability" URI leaf-list entry for the
"defaults" mode used by the server, defined in Section 9.1.2.
The server MUST include a "capability" URI leaf-list entry
identifying each supported optional protocol feature. This includes
optional query parameters and MAY include other capability URIs
defined outside this document.
9.1.1. Query Parameter URIs
A new set of RESTCONF Capability URIs are defined to identify the
specific query parameters (defined in Section 4.8) supported by the
server.
The server MUST include a "capability" leaf-list entry for each
optional query parameter that it supports.
+------------+--------+---------------------------------------------+
| Name | Sectio | URI |
| | n | |
+------------+--------+---------------------------------------------+
| depth | 4.8.2 | urn:ietf:params:restconf:capability:depth:1 |
| | | .0 |
| fields | 4.8.3 | urn:ietf:params:restconf:capability:fields: |
| | | 1.0 |
| filter | 4.8.6 | urn:ietf:params:restconf:capability:filter: |
| | | 1.0 |
| replay | 4.8.7 | urn:ietf:params:restconf:capability:replay: |
| | 4.8.8 | 1.0 |
| with- | 4.8.9 | urn:ietf:params:restconf:capability:with- |
| defaults | | defaults:1.0 |
+------------+--------+---------------------------------------------+
RESTCONF Query Parameter URIs
9.1.2. The "defaults" Protocol Capability URI
This URI identifies the defaults handling mode that is used by the
server for processing default leafs in requests for data resources.
A parameter named "basic-mode" is required for this capability URI.
The "basic-mode" definitions are specified in the "With-Defaults
Capability for NETCONF" [RFC6243].
+----------+--------------------------------------------------+
| Name | URI |
+----------+--------------------------------------------------+
| defaults | urn:ietf:params:restconf:capability:defaults:1.0 |
+----------+--------------------------------------------------+
RESTCONF defaults capability URI
This protocol capability URI MUST be supported by the server, and the
MUST be listed in the "capability" leaf-list in Section 9.3.
+------------+------------------------------------------------------+
| Value | Description |
+------------+------------------------------------------------------+
| report-all | No data nodes are considered default |
| trim | Values set to the YANG default-stmt value are |
| | default |
| explicit | Values set by the client are never considered |
| | default |
+------------+------------------------------------------------------+
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
[RFC6243].
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].
If the "basic-mode" is set to "explicit" then the server MUST adhere
to the defaults handling behavior defined in Section 2.3 of
[RFC6243].
Example: (split for display purposes only)
urn:ietf:params:restconf:capability:defaults:1.0?
basic-mode=explicit
9.2. restconf-state/streams 9.2. restconf-state/streams
This optional container provides access to the notification event 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 notification event 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
resource. resource.
Stream resources are defined in Section 3.8. Notifications are Stream resources are defined in Section 3.8. Notifications are
defined in Section 6. defined in Section 6.
9.3. RESTCONF Monitoring Module 9.3. RESTCONF Monitoring Module
The "ietf-restconf-monitoring" module defines monitoring information The "ietf-restconf-monitoring" module defines monitoring information
for the RESTCONF protocol. for the RESTCONF protocol.
The "ietf-yang-types" and "ietf-inet-types" modules from [RFC6991] The "ietf-yang-types" and "ietf-inet-types" modules from [RFC6991]
are used by this module for some type definitions. are used by this module for some type definitions.
RFC Ed.: update the date below with the date of RFC publication and RFC Ed.: update the date below with the date of RFC publication and
remove this note. remove this note.
<CODE BEGINS> file "ietf-restconf-monitoring@2015-01-30.yang" <CODE BEGINS> file "ietf-restconf-monitoring@2015-06-04.yang"
module ietf-restconf-monitoring { module ietf-restconf-monitoring {
namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring"; namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring";
prefix "rcmon"; prefix "rcmon";
import ietf-yang-types { prefix yang; } import ietf-yang-types { prefix yang; }
import ietf-inet-types { prefix inet; } import ietf-inet-types { prefix inet; }
organization organization
"IETF NETCONF (Network Configuration) Working Group"; "IETF NETCONF (Network Configuration) Working Group";
skipping to change at page 64, line 11 skipping to change at page 65, line 11
set forth in Section 4.c of the IETF Trust's Legal Provisions set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents Relating to IETF Documents
(http://trustee.ietf.org/license-info). (http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; see This version of this YANG module is part of RFC XXXX; see
the RFC itself for full legal notices."; the RFC itself for full legal notices.";
// RFC Ed.: replace XXXX with actual RFC number and remove this // RFC Ed.: replace XXXX with actual RFC number and remove this
// note. // note.
// RFC Ed.: remove this note // RFC Ed.: remove this note
// Note: extracted from draft-ietf-netconf-restconf-04.txt // Note: extracted from draft-ietf-netconf-restconf-05.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-01-30 { revision 2015-06-04 {
description description
"Initial revision."; "Initial revision.";
reference reference
"RFC XXXX: RESTCONF Protocol."; "RFC XXXX: RESTCONF Protocol.";
} }
container restconf-state { container restconf-state {
config false; config false;
description description
"Contains RESTCONF protocol monitoring information."; "Contains RESTCONF protocol monitoring information.";
skipping to change at page 65, line 39 skipping to change at page 66, line 39
} }
type yang:date-and-time; type yang:date-and-time;
description description
"Indicates the time the replay log for this stream "Indicates the time the replay log for this stream
was created."; was created.";
reference reference
"RFC 5277, Section 3.4, <replayLogCreationTime> "RFC 5277, Section 3.4, <replayLogCreationTime>
element."; element.";
} }
list encoding { list access {
key type; key type;
min-elements 1; min-elements 1;
description description
"The server will create an entry in this list for each "The server will create an entry in this list for each
encoding format that is supported for this stream. encoding format that is supported for this stream.
The media type 'application/yang.stream' is expected The media type 'application/yang.stream' is expected
for all event streams. This list identifies the for all event streams. This list identifies the
sub-types supported for this stream."; sub-types supported for this stream.";
leaf type { leaf encoding {
type string; type string;
description description
"This is the secondary encoding format within the "This is the secondary encoding format within the
'text/event-stream' encoding used by all streams. 'text/event-stream' encoding used by all streams.
The type 'xml' is supported for the media type The type 'xml' is supported for the media type
'application/yang.stream+xml'. The type 'json' 'application/yang.stream+xml'. The type 'json'
is supported for the media type is supported for the media type
'application/yang.stream+json'."; 'application/yang.stream+json'.";
} }
leaf events { leaf location {
type inet:uri; type inet:uri;
mandatory true; mandatory true;
description description
"Contains a URL that represents the entry point "Contains a URL that represents the entry point
for establishing notification delivery via server for establishing notification delivery via server
sent events."; sent events.";
} }
} }
} }
} }
skipping to change at page 69, line 16 skipping to change at page 70, line 16
- data - data
- datastore - datastore
- errors - errors
- operation - operation
- stream - stream
Type name: application Type name: application
Subtype name: yang.xxx Subtype name: yang.xxx
Required parameters: TBD Required parameters: none
Optional parameters: TBD Optional parameters: See section 4.8 in RFC XXXX
Encoding considerations: TBD Encoding considerations: 8-bit
Security considerations: TBD Security considerations: See Section 12 in RFC XXXX
Interoperability considerations: TBD 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.
The name of the registry is "RESTCONF Capability URNs". The registry
shall record for each entry:
o the name of the RESTCONF capability. By convention, this name is
prefixed with the colon ':' character.
o the URN for the RESTCONF capability.
This document registers several capability identifiers in "RESTCONF This document registers several capability identifiers in "RESTCONF
Protocol Capability URNs" registry Capability URNs" registry:
Index Index
Capability Identifier Capability Identifier
------------------------ ------------------------
:defaults :defaults
urn:ietf:params:restconf:capability:defaults:1.0 urn:ietf:params:restconf:capability:defaults:1.0
:depth :depth
urn:ietf:params:restconf:capability:depth:1.0 urn:ietf:params:restconf:capability:depth:1.0
:fields :fields
urn:ietf:params:restconf:capability:fields:1.0 urn:ietf:params:restconf:capability:fields:1.0
:filter :filter
urn:ietf:params:restconf:capability:filter:1.0 urn:ietf:params:restconf:capability:filter:1.0
:insert
urn:ietf:params:restconf:capability:insert:1.0
:replay :replay
urn:ietf:params:restconf:capability:replay:1.0 urn:ietf:params:restconf:capability:replay:1.0
:with-defaults :with-defaults
urn:ietf:params:restconf:capability:with-defaults:1.0 urn:ietf:params:restconf:capability:with-defaults:1.0
12. Security Considerations 12. Security Considerations
This section provides security considerations for the resources This section provides security considerations for the resources
defined by the RESTCONF protocol. Security considerations for HTTPS defined by the RESTCONF protocol. Security considerations for HTTPS
are defined in [RFC2818]. Security considerations for the content are defined in [RFC2818]. Security considerations for the content
manipulated by RESTCONF can be found in the documents defining data manipulated by RESTCONF can be found in the documents defining data
models. models.
This document does not specify an authentication scheme, but it does This document does not specify an authentication scheme, but it does
require that an authenticated NETCONF username be associated with require that an authenticated NETCONF username be associated with
each HTTP request. The authentication scheme MAY be implemented in each HTTP request. The authentication scheme MAY be implemented in
the underlying transport layer (e.g., client certificates) or within the underlying transport layer (e.g., client certificates) or within
the HTTP layer (e.g., Basic Auth, OAuth, etc.). RESTCONF does not the HTTP layer (e.g., Basic Auth, OAuth, etc.). RESTCONF does not
itself define an authentication mechanism, authentication MUST occur itself define an authentication mechanism. Authentication MUST occur
in a lower layer. Implementors SHOULD provide a comprehensive in a lower layer. Implementors SHOULD provide a comprehensive
authorization scheme with RESTCONF and ensure that the resulting authorization scheme with RESTCONF and ensure that the resulting
NETCONF username is made available to the RESTCONF server. NETCONF username is made available to the RESTCONF server.
Authorization of individual user access to operations and data MAY be Authorization of individual user access to operations and data MAY be
configured via NETCONF Access Control Model (NACM) [RFC6536], as configured via NETCONF Access Control Model (NACM) [RFC6536], as
specified in Section 4. Other authorization models MAY be used, but specified in Section 4.
are outside of the scope of this document.
Configuration information is by its very nature sensitive. Its Configuration information is by its very nature sensitive. Its
transmission in the clear and without integrity checking leaves transmission in the clear and without integrity checking leaves
devices open to classic eavesdropping and false data injection devices open to classic eavesdropping and false data injection
attacks. Configuration information often contains passwords, user attacks. Configuration information often contains passwords, user
names, service descriptions, and topological information, all of names, service descriptions, and topological information, all of
which are sensitive. Because of this, this protocol SHOULD be which are sensitive. Because of this, this protocol SHOULD be
implemented carefully with adequate attention to all manner of attack implemented carefully with adequate attention to all manner of attack
one might expect to experience with other management interfaces. one might expect to experience with other management interfaces.
skipping to change at page 71, line 43 skipping to change at page 72, line 38
Library", draft-ietf-netconf-yang-library-00 (work in Library", draft-ietf-netconf-yang-library-00 (work in
progress), January 2015. progress), January 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-02 (work in progress), draft-ietf-netmod-yang-json-02 (work in progress),
November 2014. November 2014.
[I-D.lhotka-netmod-yang-metadata] [I-D.lhotka-netmod-yang-metadata]
Lhotka, L., "Defining and Using Metadata with YANG", Lhotka, L., "Defining and Using Metadata with YANG",
draft-lhotka-netmod-yang-metadata-00 (work in progress), draft-lhotka-netmod-yang-metadata-01 (work in progress),
September 2014. February 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 [RFC2396] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifiers (URI): Generic Syntax", RFC 2396, Resource Identifiers (URI): Generic Syntax", RFC 2396,
skipping to change at page 73, line 49 skipping to change at page 74, line 46
Consortium CR CR-eventsource-20121211, December 2012, Consortium CR CR-eventsource-20121211, December 2012,
<http://www.w3.org/TR/2012/CR-eventsource-20121211>. <http://www.w3.org/TR/2012/CR-eventsource-20121211>.
[W3C.REC-xml-20081126] [W3C.REC-xml-20081126]
Yergeau, F., Maler, E., Paoli, J., Sperberg-McQueen, C., Yergeau, F., Maler, E., Paoli, J., Sperberg-McQueen, C.,
and T. Bray, "Extensible Markup Language (XML) 1.0 (Fifth and T. Bray, "Extensible Markup Language (XML) 1.0 (Fifth
Edition)", World Wide Web Consortium Recommendation REC- Edition)", World Wide Web Consortium Recommendation REC-
xml-20081126, November 2008, xml-20081126, November 2008,
<http://www.w3.org/TR/2008/REC-xml-20081126>. <http://www.w3.org/TR/2008/REC-xml-20081126>.
[XPath] Clark, J. and S. DeRose, "XML Path Language (XPath)
Version 1.0", World Wide Web Consortium Recommendation
REC-xpath-19991116, November 1999,
<http://www.w3.org/TR/1999/REC-xpath-19991116>.
[draft-ietf-httpauth-basicauth-update-03] [draft-ietf-httpauth-basicauth-update-03]
Reschke, J., "The 'Basic' HTTP Authentication Scheme", Reschke, J., "The 'Basic' HTTP Authentication Scheme",
draft-ietf-httpauth-basicauth-update-03 (work in draft-ietf-httpauth-basicauth-update-03 (work in
progress), Dec 2014. progress), Dec 2014.
[draft-ietf-httpauth-digest-09] [draft-ietf-httpauth-digest-09]
Shekh-Yusef, R., Reschke, D., and S. Bremer, "HTTP Digest Shekh-Yusef, R., Reschke, D., and S. Bremer, "HTTP Digest
Access Authentication", draft-ietf-httpauth-digest-09 Access Authentication", draft-ietf-httpauth-digest-09
(work in progress), Dec 2014. (work in progress), Dec 2014.
[draft-ietf-netconf-rfc5539bis-07] [draft-ietf-netconf-rfc5539bis-10]
Badra, M., Luchuk, A., and J. Schoenwaelder, "Using the Badra, M., Luchuk, A., and J. Schoenwaelder, "Using the
NETCONF Protocol over Transport Layer Security (TLS) with NETCONF Protocol over Transport Layer Security (TLS) with
Mutual X.509 Authentication", draft-ietf-netconf- Mutual X.509 Authentication", draft-ietf-netconf-
rfc5539bis-07 (work in progress), Dec 2014. rfc5539bis-10 (work in progress), Dec 2014.
[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.
[rest-dissertation]
Fielding, R., "Architectural Styles and the Design of
Network-based Software Architectures", 2000.
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-03 (work in Media Type", draft-ietf-netconf-yang-patch-03 (work in
progress), January 2015. progress), January 2015.
[XPath] Clark, J. and S. DeRose, "XML Path Language (XPath) [rest-dissertation]
Version 1.0", World Wide Web Consortium Recommendation Fielding, R., "Architectural Styles and the Design of
REC-xpath-19991116, November 1999, Network-based Software Architectures", 2000.
<http://www.w3.org/TR/1999/REC-xpath-19991116>.
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. 03 - 04 A.1. 04 - 05
o changed term 'notification event' to 'event notification'
o removed intro text about framework and meta-model
o removed early mention of API resources
o removed term unified datastore and cleaned up text about NETCONF
datastores
o removed text about not immediate persistence of edits
o removed RESTCONF-specific data-resource-identifier typedef and its
usage
o clarified encoding of key leafs
o changed several examples from JSON to XML encoding
o made 'insert' and 'point' query parameters mandatory to implement
o removed ":insert" capability URI
o renamed stream/encoding to stream/access
o renamed stream/encoding/type to stream/access/encoding
o renamed stream/encoding/events to stream/access/location
o changed XPath from informative to normative reference
o changed rest-dissertation from normative to informative reference
o changed example-jukebox playlist 'id' from a data-resource-
identifier to a leafref pointing at the song name
A.2. 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)
o clarified authentication procedure (#9) o clarified authentication procedure (#9)
o moved ietf-yang-library module to draft-ietf-netconf-yang- o moved ietf-yang-library module to draft-ietf-netconf-yang-
library-00 (#13) library-00 (#13)
o clarified that JSON encoding of module name in a URI MUST follow o clarified that JSON encoding of module name in a URI MUST follow
the netmod-yang-json encoding rules (#14) the netmod-yang-json encoding rules (#14)
skipping to change at page 75, line 16 skipping to change at page 77, line 7
o clarified authentication procedure (#9) o clarified authentication procedure (#9)
o moved ietf-yang-library module to draft-ietf-netconf-yang- o moved ietf-yang-library module to draft-ietf-netconf-yang-
library-00 (#13) library-00 (#13)
o clarified that JSON encoding of module name in a URI MUST follow o clarified that JSON encoding of module name in a URI MUST follow
the netmod-yang-json encoding rules (#14) the netmod-yang-json encoding rules (#14)
o added restconf-media-type extension (#15) o added restconf-media-type extension (#15)
o remove 'content" query parameter URI and made this parameter o remove "content" query parameter URI and made this parameter
mandatory (#16) mandatory (#16)
o clarified datastore usage o clarified datastore usage
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.2. 02 - 03 A.3. 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 76, line 5 skipping to change at page 77, line 43
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.3. 01 - 02 A.4. 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)
o added 'capabilities' container to new YANG module (ietf-restconf- o added 'capabilities' container to new YANG module (ietf-restconf-
monitoring) monitoring)
o moved 'modules' container to new YANG module (ietf-yang-library) o moved 'modules' container to new YANG module (ietf-yang-library)
o added new leaf 'module-set-id' (ietf-yang-library) o added new leaf 'module-set-id' (ietf-yang-library)
o added new leaf 'conformance' (ietf-yang-library) o added new leaf 'conformance' (ietf-yang-library)
o changed 'schema' leaf to type inet:uri that returns the location o changed 'schema' leaf to type inet:uri that returns the location
skipping to change at page 76, line 43 skipping to change at page 78, line 31
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.4. 00 - 01 A.5. 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 77, line 39 skipping to change at page 79, line 27
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.5. bierman:restconf-04 to ietf:restconf-00 A.6. 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 instance-identifier | +--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";
import ietf-restconf { prefix rc; }
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 "2014-07-03" { 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";
} }
// abbreviated list of genre classifications // abbreviated list of genre classifications
identity alternative { identity alternative {
base genre; base genre;
description "Alternative music"; description "Alternative music";
skipping to change at page 82, line 50 skipping to change at page 84, line 44
list song { list song {
key index; key index;
ordered-by user; ordered-by user;
description description
"Example nested configuration data resource"; "Example nested configuration data resource";
leaf index { // not really needed leaf index { // not really needed
type uint32; type uint32;
description description
"An arbitrary integer index for this "An arbitrary integer index for this playlist song.";
playlist song.";
} }
leaf id { leaf id {
type rc:data-resource-identifier; type leafref {
path "/jbox:jukebox/jbox:library/jbox:artist/" +
"jbox:album/jbox:song/jbox:name";
}
mandatory true; mandatory true;
description description
"Song identifier. Must identify an instance of "Song identifier. Must identify an instance of
/jukebox/library/artist/album/song/name."; /jukebox/library/artist/album/song/name.";
} }
} }
} }
container player { container player {
description description
skipping to change at page 86, line 45 skipping to change at page 88, line 37
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+json Accept: application/yang.data+xml
The server might respond as follows. The server might respond as follows. The extra whitespace in
'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+json Content-Type: application/yang.data+xml
<capabilities xmlns="">
{ <capability>
"ietf-restconf-monitoring:capabilities": { urn:ietf:params:restconf:capability:content:1.0
"capability": [ </capability>
"urn:ietf:params:restconf:capability:content:1.0", <capability>
"urn:ietf:params:restconf:capability:depth:1.0", urn:ietf:params:restconf:capability:depth:1.0
"urn:ietf:params:restconf:capability:fields:1.0", </capability>
"urn:ietf:params:restconf:capability:filter:1.0", <capability>
"urn:ietf:params:restconf:capability:insert:1.0", urn:ietf:params:restconf:capability:fields:1.0
"urn:ietf:params:restconf:capability:point:1.0", </capability>
"urn:ietf:params:restconf:capability:start-time:1.0", <capability>
"urn:ietf:params:restconf:capability:stop-time:1.0", urn:ietf:params:restconf:capability:filter:1.0
"http://example.com/capabilities/myparam" </capability>
] <capability>
} urn:ietf:params:restconf:capability:point:1.0
} </capability>
<capability>
urn:ietf:params:restconf:capability:start-time:1.0
</capability>
<capability>
urn:ietf:params:restconf:capability:stop-time:1.0
</capability>
<capability>
http://example.com/capabilities/myparam
</capability>
</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
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ "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
skipping to change at page 88, line 38 skipping to change at page 90, line 38
} }
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
Accept: application/yang.data+json
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
In this example, the client modifies two different data nodes by
sending a PATCH to the datastore resource:
PATCH /restconf/data HTTP/1.1
Host: example.com
Content-Type: application/yang.datastore+xml
<data xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<jukebox xmlns=""http://example.com/ns/example-jukebox">
<library>
<artist>
<name>Foo Fighters</name>
<album>
<name>Wasting Light</name>
<year>2011</year>
</album>
</artist>
<artist>
<name>Nick Cave</name>
<album>
<name>Tender Prey</name>
<year>1988</year>
</album>
</artist>
</library>
</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.
skipping to change at page 92, line 32 skipping to change at page 95, line 32
} }
] ]
} }
} }
D.3.2. "depth" Parameter D.3.2. "depth" Parameter
The "depth" parameter is used to limit the number of levels of child The "depth" parameter is used to limit the number of levels of child
resources that are returned by the server for a GET method request. resources that are returned by the server for a GET method request.
The depth parameter starts counting levels at the level of the target
resource that is specified, so that a depth level of "1" includes
just the target resource level itself. A depth level of "2" includes
the target resource level and its child nodes.
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.
skipping to change at page 96, line 15 skipping to change at page 99, line 15
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": {
"module": [ "module": [
{ {
"name" : "example-jukebox", "name" : "example-jukebox",
"revision" : "2014-07-03" "revision" : "2015-06-04"
},
{
"name" : "ietf-inet-types",
"revision" : "2013-07-15"
}, },
{ {
"name" : "ietf-restconf-monitoring", "name" : "ietf-restconf-monitoring",
"revision" : "2015-01-30" "revision" : "2015-06-04"
}, },
{ {
"name" : "ietf-yang-library", "name" : "ietf-yang-library",
"revision" : "2015-01-30" "revision" : "2015-01-30"
},
{
"name" : "ietf-yang-types",
"revision" : "2013-07-15"
} }
] ]
} }
} }
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:
 End of changes. 199 change blocks. 
577 lines changed or deleted 691 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/