draft-ietf-netconf-restconf-00.txt   draft-ietf-netconf-restconf-01.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: September 23, 2014 Tail-f Systems Expires: January 4, 2015 Tail-f Systems
K. Watsen K. Watsen
Juniper Networks Juniper Networks
R. Fernando R. Fernando
Cisco Cisco
March 22, 2014 July 3, 2014
RESTCONF Protocol RESTCONF Protocol
draft-ietf-netconf-restconf-00 draft-ietf-netconf-restconf-01
Abstract Abstract
This document describes a REST-like protocol that provides a This document describes an HTTP-based protocol that provides a
programmatic interface over HTTP for accessing data defined in YANG, programmatic interface for accessing data defined in YANG, using the
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
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
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 September 23, 2014. This Internet-Draft will expire on January 4, 2015.
Copyright Notice Copyright Notice
Copyright (c) 2014 IETF Trust and the persons identified as the Copyright (c) 2014 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1. Simple Subset of NETCONF Functionality . . . . . . . . . . 5 1.1. Secure Transport . . . . . . . . . . . . . . . . . . . . . 5
1.2. Data Model Driven API . . . . . . . . . . . . . . . . . . 6 1.2. Simple Subset of NETCONF Functionality . . . . . . . . . . 5
1.3. Terminology . . . . . . . . . . . . . . . . . . . . . . . 8 1.3. Data Model Driven API . . . . . . . . . . . . . . . . . . 6
1.3.1. NETCONF . . . . . . . . . . . . . . . . . . . . . . . 8 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. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 11 1.4.4. Terms . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4.5. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 11
2. Operations . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2. Operations . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.1. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3. GET . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.3. GET . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4. POST . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.4. POST . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4.1. Create Resource Mode . . . . . . . . . . . . . . . . . 14 2.4.1. Create Resource Mode . . . . . . . . . . . . . . . . . 14
2.4.2. Invoke Operation Mode . . . . . . . . . . . . . . . . 15 2.4.2. Invoke Operation Mode . . . . . . . . . . . . . . . . 15
2.5. PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.5. PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.6. PATCH . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.6. PATCH . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.7. DELETE . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.7. DELETE . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.8. Query Parameters . . . . . . . . . . . . . . . . . . . . . 19 2.8. Query Parameters . . . . . . . . . . . . . . . . . . . . . 19
3. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.1. Request URI Structure . . . . . . . . . . . . . . . . . . 21 3.1. Request URI Structure . . . . . . . . . . . . . . . . . . 21
3.2. Message Headers . . . . . . . . . . . . . . . . . . . . . 22 3.2. RESTCONF Path Resolution . . . . . . . . . . . . . . . . . 22
3.3. Message Encoding . . . . . . . . . . . . . . . . . . . . . 23 3.3. Message Headers . . . . . . . . . . . . . . . . . . . . . 23
3.4. RESTCONF Meta-Data . . . . . . . . . . . . . . . . . . . . 23 3.4. Message Encoding . . . . . . . . . . . . . . . . . . . . . 24
3.4.1. JSON Encoding of RESTCONF Meta-Data . . . . . . . . . 24 3.5. RESTCONF Meta-Data . . . . . . . . . . . . . . . . . . . . 25
3.5. Return Status . . . . . . . . . . . . . . . . . . . . . . 26 3.6. Return Status . . . . . . . . . . . . . . . . . . . . . . 25
3.6. Message Caching . . . . . . . . . . . . . . . . . . . . . 26 3.7. Message Caching . . . . . . . . . . . . . . . . . . . . . 25
4. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.1. RESTCONF Resource Types . . . . . . . . . . . . . . . . . 27 4.1. RESTCONF Resource Types . . . . . . . . . . . . . . . . . 26
4.2. Resource Discovery . . . . . . . . . . . . . . . . . . . . 28 4.2. Resource Discovery . . . . . . . . . . . . . . . . . . . . 27
4.3. API Resource (/restconf) . . . . . . . . . . . . . . . . . 28 4.3. API Resource . . . . . . . . . . . . . . . . . . . . . . . 27
4.3.1. /restconf/data . . . . . . . . . . . . . . . . . . . . 29 4.3.1. {+restconf}/data . . . . . . . . . . . . . . . . . . . 28
4.3.2. /restconf/modules . . . . . . . . . . . . . . . . . . 30 4.3.2. {+restconf}/modules . . . . . . . . . . . . . . . . . 29
4.3.3. /restconf/operations . . . . . . . . . . . . . . . . . 31 4.3.3. {+restconf}/operations . . . . . . . . . . . . . . . . 30
4.3.4. /restconf/streams . . . . . . . . . . . . . . . . . . 31 4.3.4. {+restconf}/streams . . . . . . . . . . . . . . . . . 30
4.3.5. /restconf/version . . . . . . . . . . . . . . . . . . 31 4.4. Datastore Resource . . . . . . . . . . . . . . . . . . . . 30
4.4. Datastore Resource . . . . . . . . . . . . . . . . . . . . 31 4.4.1. Edit Collision Detection . . . . . . . . . . . . . . . 31
4.4.1. Edit Collision Detection . . . . . . . . . . . . . . . 32 4.5. Data Resource . . . . . . . . . . . . . . . . . . . . . . 31
4.5. Data Resource . . . . . . . . . . . . . . . . . . . . . . 33
4.5.1. Encoding YANG Instance Identifiers in the Request 4.5.1. Encoding YANG Instance Identifiers in the Request
URI . . . . . . . . . . . . . . . . . . . . . . . . . 33 URI . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.5.2. Defaults Handling . . . . . . . . . . . . . . . . . . 36 4.5.2. Defaults Handling . . . . . . . . . . . . . . . . . . 34
4.6. Operation Resource . . . . . . . . . . . . . . . . . . . . 36 4.6. Operation Resource . . . . . . . . . . . . . . . . . . . . 35
4.6.1. Encoding Operation Input Parameters . . . . . . . . . 37 4.6.1. Encoding Operation Input Parameters . . . . . . . . . 35
4.6.2. Encoding Operation Output Parameters . . . . . . . . . 38 4.6.2. Encoding Operation Output Parameters . . . . . . . . . 36
4.7. Schema Resource . . . . . . . . . . . . . . . . . . . . . 39 4.7. Schema Resource . . . . . . . . . . . . . . . . . . . . . 37
4.8. Stream Resource . . . . . . . . . . . . . . . . . . . . . 39 4.8. Stream Resource . . . . . . . . . . . . . . . . . . . . . 38
5. Notifications . . . . . . . . . . . . . . . . . . . . . . . . 41 4.9. Errors Resource . . . . . . . . . . . . . . . . . . . . . 38
5.1. Server Support . . . . . . . . . . . . . . . . . . . . . . 41 5. Notifications . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2. Event Streams . . . . . . . . . . . . . . . . . . . . . . 41 5.1. Server Support . . . . . . . . . . . . . . . . . . . . . . 39
5.3. Subscribing to Receive Notifications . . . . . . . . . . . 42 5.2. Event Streams . . . . . . . . . . . . . . . . . . . . . . 39
5.3.1. NETCONF Event Stream . . . . . . . . . . . . . . . . . 43 5.3. Subscribing to Receive Notifications . . . . . . . . . . . 40
5.4. Receiving Event Notifications . . . . . . . . . . . . . . 43 5.3.1. NETCONF Event Stream . . . . . . . . . . . . . . . . . 41
6. Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 45 5.4. Receiving Event Notifications . . . . . . . . . . . . . . 41
6.1. Error Response Message . . . . . . . . . . . . . . . . . . 46 6. Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 43
7. RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 49 6.1. Error Response Message . . . . . . . . . . . . . . . . . . 44
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 63 7. RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 47
8.1. YANG Module Registry . . . . . . . . . . . . . . . . . . . 63 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 61
8.2. application/yang Media Sub Types . . . . . . . . . . . . . 63 8.1. The "restconf" Relation Type . . . . . . . . . . . . . . . 61
9. Security Considerations . . . . . . . . . . . . . . . . . . . 65 8.2. YANG Module Registry . . . . . . . . . . . . . . . . . . . 61
10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 66 8.3. application/yang Media Sub Types . . . . . . . . . . . . . 61
10.1. Normative References . . . . . . . . . . . . . . . . . . . 66 9. Security Considerations . . . . . . . . . . . . . . . . . . . 63
10.2. Informative References . . . . . . . . . . . . . . . . . . 67 10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 68 10.1. Normative References . . . . . . . . . . . . . . . . . . . 64
A.1. bierman:restconf-04 to ietf:restconf-00 . . . . . . . . . 68 10.2. Informative References . . . . . . . . . . . . . . . . . . 65
Appendix B. Open Issues . . . . . . . . . . . . . . . . . . . . . 69 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 66
B.1. message-id . . . . . . . . . . . . . . . . . . . . . . . . 69 A.1. 00 - 01 . . . . . . . . . . . . . . . . . . . . . . . . . 66
B.2. select parameter . . . . . . . . . . . . . . . . . . . . . 69 A.2. bierman:restconf-04 to ietf:restconf-00 . . . . . . . . . 67
B.3. server support verification . . . . . . . . . . . . . . . 69 Appendix B. Open Issues . . . . . . . . . . . . . . . . . . . . . 68
B.4. error media type . . . . . . . . . . . . . . . . . . . . . 69 B.1. select parameter . . . . . . . . . . . . . . . . . . . . . 68
B.5. additional datastores . . . . . . . . . . . . . . . . . . 69 B.2. netconf-state monitoring support . . . . . . . . . . . . . 68
B.6. PATCH media type discovery . . . . . . . . . . . . . . . . 70 B.3. secure transport . . . . . . . . . . . . . . . . . . . . . 68
B.7. RESTCONF version . . . . . . . . . . . . . . . . . . . . . 70 B.4. Encoding of key leafs in resource URIs . . . . . . . . . . 68
B.8. YANG to resource mapping . . . . . . . . . . . . . . . . . 70 B.5. get-bulk query parameters . . . . . . . . . . . . . . . . 69
B.9. .well-known usage . . . . . . . . . . . . . . . . . . . . 70 B.6. defaults handling . . . . . . . . . . . . . . . . . . . . 69
B.10. _self links for HATEOAS support . . . . . . . . . . . . . 72 B.7. protocol capability URIs . . . . . . . . . . . . . . . . . 69
B.11. netconf-state monitoring support . . . . . . . . . . . . . 72 B.8. target resource list keys required for GET . . . . . . . . 70
B.12. secure transport . . . . . . . . . . . . . . . . . . . . . 72 Appendix C. Example YANG Module . . . . . . . . . . . . . . . . . 71
B.13. Encoding of key leafs in resource URIs . . . . . . . . . . 72 C.1. example-jukebox YANG Module . . . . . . . . . . . . . . . 71
B.14. get-bulk query parameters . . . . . . . . . . . . . . . . 73 Appendix D. RESTCONF Message Examples . . . . . . . . . . . . . . 77
B.15. JSON encoding of meta-data . . . . . . . . . . . . . . . . 73 D.1. Resource Retrieval Examples . . . . . . . . . . . . . . . 77
Appendix C. Example YANG Module . . . . . . . . . . . . . . . . . 74 D.1.1. Retrieve the Top-level API Resource . . . . . . . . . 77
C.1. example-jukebox YANG Module . . . . . . . . . . . . . . . 74 D.1.2. Retrieve The Server Module Information . . . . . . . . 79
Appendix D. RESTCONF Message Examples . . . . . . . . . . . . . . 80 D.2. Edit Resource Examples . . . . . . . . . . . . . . . . . . 81
D.1. Resource Retrieval Examples . . . . . . . . . . . . . . . 80 D.2.1. Create New Data Resources . . . . . . . . . . . . . . 81
D.1.1. Retrieve the Top-level API Resource . . . . . . . . . 80 D.2.2. Detect Resource Entity Tag Change . . . . . . . . . . 82
D.1.2. Retrieve The Server Module Information . . . . . . . . 82 D.3. Query String Parameter Examples . . . . . . . . . . . . . 82
D.2. Edit Resource Examples . . . . . . . . . . . . . . . . . . 84 D.3.1. "content" Parameter . . . . . . . . . . . . . . . . . 82
D.2.1. Create New Data Resources . . . . . . . . . . . . . . 84 D.3.2. "depth" Parameter . . . . . . . . . . . . . . . . . . 85
D.2.2. Detect Resource Entity Tag Change . . . . . . . . . . 85 D.3.3. "filter" Parameter . . . . . . . . . . . . . . . . . . 88
D.3. Query String Parameter Examples . . . . . . . . . . . . . 85 D.3.4. "insert" Parameter . . . . . . . . . . . . . . . . . . 89
D.3.1. "content" Parameter . . . . . . . . . . . . . . . . . 85 D.3.5. "point" Parameter . . . . . . . . . . . . . . . . . . 90
D.3.2. "depth" Parameter . . . . . . . . . . . . . . . . . . 88 D.3.6. "select" Parameter . . . . . . . . . . . . . . . . . . 90
D.3.3. "filter" Parameter . . . . . . . . . . . . . . . . . . 91 D.3.7. "start-time" Parameter . . . . . . . . . . . . . . . . 91
D.3.4. "insert" Parameter . . . . . . . . . . . . . . . . . . 92 D.3.8. "stop-time" Parameter . . . . . . . . . . . . . . . . 91
D.3.5. "point" Parameter . . . . . . . . . . . . . . . . . . 93 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 92
D.3.6. "select" Parameter . . . . . . . . . . . . . . . . . . 93
D.3.7. "start-time" Parameter . . . . . . . . . . . . . . . . 94
D.3.8. "stop-time" Parameter . . . . . . . . . . . . . . . . 94
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 95
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 notification events within a networking
device, in a modular and extensible manner. device, in a modular and extensible manner.
This document describes a REST-like protocol called RESTCONF, running This document describes an HTTP [RFC2616] based protocol called
over HTTP [RFC2616], for accessing data defined in YANG [RFC6020], RESTCONF, for accessing data defined in YANG [RFC6020], using
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. REST-like operations are used operations, and notification events. RESTCONF uses HTTP operations
to access the hierarchical data within a datastore. to provide CRUD operations on a NETCONF datastore containing YANG-
defined data. Since NETCONF protocol operations are not relevant,
A REST-like API can be created that provides CRUD operations on a the user should not need any prior knowledge of NETCONF in order to
NETCONF datastore containing YANG-defined data. This can be done in use RESTCONF.
a simplified manner, compatible with HTTP and REST-like design
principles. Since NETCONF protocol operations are not relevant, the
user should not need any prior knowledge of NETCONF in order to use
the REST-like API.
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 [JSON]. or JSON [JSON].
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 notification events defined with the YANG "notification" statement
can be accessed. can be accessed.
1.1. Simple Subset of NETCONF Functionality 1.1. Secure Transport
The framework and meta-model used for a REST-like API does not need RESTCONF relies on TLS [RFC2246] to provide privacy and data
integrity for its HTTP operations. More specifically, RESTCONF
requires HTTP over TLS (HTTPS) [RFC2818]. To ensure security,
RESTCONF clients MUST verify the RESTCONF server's X.509 certificate
using the path validation algorithm defined in section 6 of
[RFC5280]. Devices that do not support TLS will be unable to
implement RESTCONF.
1.2. Simple Subset of NETCONF Functionality
The framework and meta-model used for an HTTP-based API does not need
to mirror those used by the NETCONF protocol, but it needs to be to mirror those used by the NETCONF protocol, but it needs to be
compatible with NETCONF. A simplified framework and protocol is compatible with NETCONF. A simplified framework and protocol is
needed that utilizes the three NETCONF datastores (candidate, needed that utilizes the three NETCONF datastores (candidate,
running, startup), but hides the complexity of multiple datastores running, startup), but hides the complexity of multiple datastores
from the client. from the client.
A simplified transaction model is needed that allows basic CRUD A simplified transaction model is needed that allows basic CRUD
operations on a hierarchy of conceptual resources. This represents a operations on a hierarchy of conceptual resources. This represents a
limited subset of the transaction capabilities of the NETCONF limited subset of the transaction capabilities of the NETCONF
protocol. protocol.
skipping to change at page 6, line 20 skipping to change at page 6, line 26
o datastore locking (full or partial) o datastore locking (full or partial)
o candidate datastore o candidate datastore
o startup datastore o startup datastore
o validate operation o validate operation
o confirmed-commit procedure o confirmed-commit procedure
The REST-like API is not intended to replace NETCONF, but rather RESTCONF is not intended to replace NETCONF, but rather provide an
provide an additional simplified interface that follows REST-like additional simplified interface that follows REST principles and is
principles and is compatible with a resource-oriented device compatible with a resource-oriented device abstraction.
abstraction.
The following figure shows the system components: The following figure shows the system components:
+-----------+ +-----------------+ +-----------+ +-----------------+
| WEB app | <-------> | | | WEB app | <-------> | |
+-----------+ HTTP | network device | +-----------+ HTTP | network device |
| | | |
+-----------+ | +-----------+ | +-----------+ | +-----------+ |
| NMS app | <-------> | | datastore | | | NMS app | <-------> | | datastore | |
+-----------+ NETCONF | +-----------+ | +-----------+ NETCONF | +-----------+ |
+-----------------+ +-----------------+
1.2. Data Model Driven API 1.3. Data Model Driven API
RESTCONF combines the simplicity of a REST-like API over HTTP with RESTCONF combines the simplicity of the HTTP protocol with the
the predictability and automation potential of a schema-driven API. predictability and automation potential of a schema-driven API.
Using YANG, a client can predict all resource endpoints, much like
using URI Templates [RFC6570], but in a more holistic manner. This
strategy obviates the need for responses provided by the server to
contain HATEOAS links, originally described in Roy Fielding's
doctoral dissertation [rest-dissertation].
A REST-like client using HATEOAS principles would not use any data A REST client using HATEOAS principles would not use any data
modeling language to define the application-specific content of the modeling language to define the application-specific content of the
API. The client would discover each new child resource as it API. The client would discover each new child resource as it
traverses the URIs returned as Location IDs to discover the server traverses the URIs returned as Location IDs to discover the server
capabilities. capabilities. This approach has 3 significant weaknesses with
regards to control of complex networking devices:
This approach has 3 significant weaknesses with regards to control of
complex networking devices:
o inefficient performance: configuration APIs will be quite complex o inefficient performance: configuration APIs will be quite complex
and may require thousands of protocol messages to discover all the and may require thousands of protocol messages to discover all the
schema information. Typically the data type information has to be schema information. Typically the data type information has to be
passed in the protocol messages, which is also wasteful overhead. passed in the protocol messages, which is also wasteful overhead.
o no data model richness: without a data model, the schema-level o no data model richness: without a data model, the schema-level
semantics and validation constraints are not available to the semantics and validation constraints are not available to the
application. application.
skipping to change at page 7, line 36 skipping to change at page 7, line 41
protocol operations and datastore content are predictable, based on protocol operations and datastore content are predictable, based on
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 under "/restconf/modules" in the top-level API resource it supports under "{+restconf}/modules" in the top-level API resource
type, using a structure based on the YANG module capability URI type, using a structure based on the YANG module capability URI
format defined in [RFC6020]. format defined in [RFC6020].
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 module notification events are identified by this set of YANG module
resources. All RESTCONF content identified as either a data resources. All RESTCONF content identified as either a data
resource, operation resource, or event stream resource is defined resource, operation resource, or event stream resource is defined
with the YANG language. 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.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
skipping to change at page 8, line 39 skipping to change at page 8, line 45
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 [RFC2616]: The following terms are defined in [RFC2616]:
o entity tag o entity tag
o fragment o fragment
o header line o header line
o message body o message body
o method o method
o path o path
o query o query
o request
o request URI o request URI
o response body o response body
1.3.3. YANG o resource
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 40 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". API resources can yang.api+xml" or "application/yang.api+json". API resources can
only be edited by the server. only be edited by the server.
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". Data resources yang.data+xml" or "application/yang.data+json". Data resources
can be edited by clients or the server. All YANG data node types can be edited by clients or the server. All YANG data node types
can be data resources. YANG terminal nodes cannot contain sub- can be data resources. YANG terminal nodes cannot contain child
resources. resources.
o datastore resource: a resource with the media type "application/ o datastore resource: a resource with the media type "application/
yang.datastore+xml" or "application/yang.datastore+json". yang.datastore+xml" or "application/yang.datastore+json".
Represents a configuration datastore. Represents a configuration datastore.
o edit operation: a RESTCONF operation on a data resource using the o edit operation: a RESTCONF operation on a data resource using the
POST, PUT, PATCH, or DELETE method. POST, PUT, PATCH, or DELETE method.
o event stream resource: a resource with the media type o event stream resource: a resource with the media type
skipping to change at page 10, line 29 skipping to change at page 10, line 42
contains a conceptual system or data-model specific event that is contains a conceptual system or data-model specific event that is
delivered within a notification event stream. delivered within a notification event stream.
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/
yang.operation+xml" or "application/yang.operation+json". yang.operation+xml" or "application/yang.operation+json".
o patch: a generic PATCH method on the target datastore or data o patch: a generic PATCH request on the target datastore or data
resource. The media type of the message body content will resource. The media type of the message body content will
identify the patch type in use. identify the patch type in use.
o plain patch: a PATCH method where the media type is "application/ o plain patch: a PATCH request where the media type is "application/
yang.data+xml" or "application/yang.data+json". yang.data+xml" or "application/yang.data+json".
o query parameter: a parameter (and its value if any), encoded o query parameter: a parameter (and its value if any), encoded
within the query component of the request URI. within the query component of the request URI.
o requested data nodes: the set of data resources identified by the
target resource, or the "select" query parameter if it is present.
o resource: a conceptual object representing a manageable component
within a device. Refers to the resource itself of the resource
and all its sub-resources.
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 o unified datastore: A conceptual representation of the device
running configuration. The server will hide all NETCONF datastore running configuration. The server will hide all NETCONF datastore
details for edit operations, such as the ":candidate" and details for edit operations, such as the ":candidate" and
":startup" capabilities. ":startup" capabilities.
o YANG 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 YANG terminal node: a YANG node representing a leaf, leaf-list, or o YANG terminal node: a YANG node representing a leaf, leaf-list, or
anyxml definition. anyxml definition.
1.3.5. Tree Diagrams 1.4.5. Tree Diagrams
A simplified graphical representation of the data model is used in A simplified graphical representation of the data model is used in
this document. The meaning of the symbols in these diagrams is as this document. The meaning of the symbols in these diagrams is as
follows: follows:
o Brackets "[" and "]" enclose list keys. o Brackets "[" and "]" enclose list keys.
o Abbreviations before data node names: "rw" means configuration o Abbreviations before data node names: "rw" means configuration
(read-write) and "ro" state data (read-only). data (read-write) and "ro" state data (read-only).
o Symbols after data node names: "?" means an optional node and "*" o Symbols after data node names: "?" means an optional node, "!"
denotes a "list" and "leaf-list". means a presence container, and "*" denotes a list and leaf-list.
o Parentheses enclose choice and case nodes, and case nodes are also o Parentheses enclose choice and case nodes, and case nodes are also
marked with a colon (":"). marked with a colon (":").
o Ellipsis ("...") stands for contents of subtrees that are not o Ellipsis ("...") stands for contents of subtrees that are not
shown. shown.
2. Operations 2. 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. The following table operation requested for a particular resource.
shows how the RESTCONF operations relate to NETCONF protocol
operations: The following table shows how the RESTCONF operations relate to
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="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 for a fail. The PATCH method is equivalent to a "merge" operation for a
plain PATCH method. plain patch.
Access control mechanims may be used to limit what operations can be Access control mechanisms may be used to limit what operations can be
used. In particular, RESTCONF is compatible with the NETCONF Access used. In particular, RESTCONF is compatible with the NETCONF Access
Control Model (NACM) [RFC6536], as there is a specific mapping Control Model (NACM) [RFC6536], as there is a specific mapping
between RESTCONF and NETCONF operations, defined in Table 1. The between RESTCONF and NETCONF operations, defined in Table 1. The
resource path needs to be converted internally by the server to the resource path needs to be converted internally by the server to the
corresponding corresponding YANG instance-identifier. Using this information, the
server can apply the NACM access control rules to RESTCONF messages.
YANG instance-identifier. Using this information,
the server can apply the NACM access control rules to RESTCONF
messages.
The server MUST NOT allow any operation to any resources that the The server MUST NOT allow any operation to any resources that the
client is not authorized to access. client is not authorized to access.
Implementation of all methods (except PATCH) are defined in Implementation of all methods (except PATCH) are defined in
[RFC2616]. This section defines the RESTCONF protocol usage for each [RFC2616]. This section defines the RESTCONF protocol usage for each
HTTP method. HTTP method.
2.1. OPTIONS 2.1. OPTIONS
The OPTIONS method is sent by the client to discover which methods The OPTIONS method is sent by the client to discover which methods
are supported by the server for a specific resource. If supported, are supported by the server for a specific resource. If supported,
it SHOULD be implemented for all media types. The server SHOULD it SHOULD be implemented for all media types.
implement this method, however the same information could be
extracted from the YANG modules and the RESTCONF protocol The server SHOULD implement this method, however the same information
could be extracted from the YANG modules and the RESTCONF protocol
specification. specification.
If the PATCH method is supported, then the "Accept-Patch" header MUST
be supported, as defined in [RFC5789].
2.2. HEAD 2.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 body. It is supported for all resource types, except response body. It is supported for all resource types, except
operation resources. 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 component. The same query parameters supported by the
GET method are supported by the HEAD method. GET method are supported by the HEAD method.
skipping to change at page 13, line 32 skipping to change at page 13, line 35
was GET instead of HEAD, except that no response body is included. was GET instead of HEAD, except that no response body is included.
2.3. GET 2.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 component.
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 any not have read privileges. If the user is not authorized to read the
portion of the target resource, an error response containing a "403 target resource, an error response containing a "403 Forbidden" or
Forbidden" 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+json,
application/yang.errors+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17: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+json
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" : { "album" : [
"name" : "Wasting Light", {
"genre" : "example-jukebox:alternative", "name" : "Wasting Light",
"year" : 2011 "genre" : "example-jukebox:alternative",
} "year" : 2011
}
]
} }
Refer to @ex-create@ for more resource creation examples.
2.4. POST 2.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 |
+-----------+------------------------------------------------+ +-----------+------------------------------------------------+
| Datastore | Create a top-level configuration data resource | | Datastore | Create a top-level configuration data resource |
| Data | Create a configuration data sub-resource | | Data | Create a configuration data child resource |
| Operation | Invoke a protocol operation | | Operation | Invoke a protocol operation |
+-----------+------------------------------------------------+ +-----------+------------------------------------------------+
Resource Types that Support POST Resource Types that Support POST
The request MUST contain a request URI that contains a target
resource which identifies a datastore, data, or operation resource
type.
2.4.1. Create Resource Mode 2.4.1. Create Resource Mode
If the target resource type is a datastore or data resource, then the If the target resource type is a datastore or data resource, then the
POST is treated as a request to create a resource or sub-resource. POST is treated as a request to create a resource or child resource.
The message body is expected to contain the content of a child The message body is expected to contain the content of a child
resource to create within the parent (target resource). resource to create within the parent (target resource).
The "insert" and "point" query parameters are supported by the POST The "insert" and "point" query parameters are supported by the POST
method for datastore and data resource types, as specified in the method for datastore and data resource types, as specified in the
YANG definition in Section 7. YANG definition in Section 7.
If the POST method succeeds, a "201 Created" Status-Line is returned If the POST method succeeds, a "201 Created" Status-Line is returned
and there is no response message body. A "Location" header and there is no response message body. A "Location" header
identifying the child resource that was created MUST be present in identifying the child resource that was created MUST be present in
the response in this case. the response in this case.
If the user is not authorized to create the target resource, an error If the user is not authorized to create the target resource, an error
response containing a "403 Forbidden" Status-Line is returned to the response containing a "403 Forbidden" or "404 Not Found" Status-Line
client. All other error responses are handled according to the is returned to the client. All other error responses are handled
procedures defined in Section 6. according to the procedures defined in Section 6.
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:
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: http://example.com/restconf/data/example-jukebox:jukebox Location: http://example.com/restconf/data/example-jukebox:jukebox
Last-Modified: Mon, 23 Apr 2012 17:01:00 GMT Last-Modified: Mon, 23 Apr 2012 17:01:00 GMT
ETag: b3a3e673be2 ETag: b3a3e673be2
Refer to Appendix D.2.1 for more resource creation examples.
2.4.2. Invoke Operation Mode 2.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 message method is treated as a request to invoke that operation. The message
body (if any) is processed as the operation input parameters. Refer body (if any) is processed as the operation input parameters. Refer
to Section 4.6 for details on operation resources. to Section 4.6 for details on operation resources.
If the POST method succeeds, a "200 OK" Status-Line is returned if If the POST request succeeds, a "200 OK" Status-Line is returned if
there is a response message body, and a "204 No Content" Status-Line there is a response message body, and a "204 No Content" Status-Line
is returned if there is no response message body. is returned if there is no response message body.
If the user is not authorized to invoke the target operation, an If the user is not authorized to invoke the target operation, an
error response containing a "403 Forbidden" Status-Line is returned error response containing a "403 Forbidden" or "404 Not Found"
to the client. All other error responses are handled according to Status-Line is returned to the client. All other error responses are
the procedures defined in Section 6. handled according to the procedures defined in Section 6.
Example: Example:
In this example, the client is invoking the "play" operation defined In this example, the client is invoking the "play" operation defined
in the "example-jukebox" YANG module. in the "example-jukebox" YANG module.
A client might send a "play" request as follows: A client might send a "play" request as follows:
POST /restconf/operations/example-jukebox:play HTTP/1.1 POST /restconf/operations/example-jukebox:play HTTP/1.1
Host: example.com Host: example.com
skipping to change at page 16, line 32 skipping to change at page 16, line 32
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Date: Mon, 23 Apr 2012 17:50:00 GMT Date: Mon, 23 Apr 2012 17:50:00 GMT
Server: example-server Server: example-server
2.5. PUT 2.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 request MUST contain a request URI that contains a target The only target resource media type that supports PUT is the data
resource that identifies the data resource to create or replace. resource. The message body is expected to contain the content used
to create or replace the target resource.
If the resource instance does not exist, and it represents a valid
instance the server could create with a POST request, then the server
SHOULD create it.
The message body is expected to contain the content used to create or
replace the target resource.
The "insert" and "point" query parameters are supported by the PUT The "insert" and "point" query parameters are supported by the PUT
method for data resources, as specified in the YANG definition in method for data resources, as specified in the YANG definition in
Section 7. Section 7.
Consistent with [RFC2616], if the PUT method creates a new resource, Consistent with [RFC2616], 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" Status-Line resource an error response containing a "403 Forbidden" or "404 Not
is returned to the client. All other error responses are handled Found" Status-Line is returned to the client. All other error
according to the procedures defined in Section 6. responses are handled according to the procedures defined in
Section 6.
Example: Example:
An "album" sub-resource defined in the "example-jukebox" YANG module An "album" child resource defined in the "example-jukebox" YANG
is replaced or created if it does not already exist. module is replaced or created if it does not already exist.
To replace the "album" resource contents, the client might send as To replace the "album" resource contents, the client might send as
follows. Note that the request URI header line is wrapped for follows. Note that the request URI header line is wrapped for
display purposes only: display purposes only:
PUT /restconf/data/example-jukebox:jukebox/ PUT /restconf/data/example-jukebox:jukebox/
library/artist/Foo%20Fighters/album/Wasting%20Light HTTP/1.1 library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
Host: example.com Host: example.com
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"example-jukebox:album" : { "example-jukebox:album" : {
"name" : "Wasting Light", "name" : "Wasting Light",
"genre" : "example-jukebox:alternative", "genre" : "example-jukebox:alternative",
"year" : 2011 "year" : 2011
} }
} }
skipping to change at page 17, line 38 skipping to change at page 17, line 33
If the resource is updated, the server might respond: If the resource is updated, the server might respond:
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Date: Mon, 23 Apr 2012 17:04:00 GMT Date: Mon, 23 Apr 2012 17:04:00 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 17:04:00 GMT Last-Modified: Mon, 23 Apr 2012 17:04:00 GMT
ETag: b27480aeda4c ETag: b27480aeda4c
2.6. PATCH 2.6. PATCH
The PATCH method uses the HTTP PATCH method defined in [RFC5789] to RESTCONF uses the HTTP PATCH method defined in [RFC5789] to provide
provide an extensible framework for resource patching mechanisms. It an extensible framework for resource patching mechanisms. It is
is optional to implement by the server. Each patch type needs a optional to implement by the server. Each patch type needs a unique
unique media type. Zero or more PATCH media types MAY be supported media type. Zero or more PATCH media types MAY be supported by the
by the server. server.
The "plain patch" PATCH method is used to create or update a sub- A plain patch is used to create or update a child resource within the
resource within the target resource. If the target resource instance target resource. If the target resource instance does not exist, the
does not exist, the server MUST NOT create it. server MUST NOT create it.
If the PATCH method succeeds, a "200 OK" Status-Line is returned if If the PATCH request succeeds, a "200 OK" Status-Line is returned if
there is a message body, and "204 No Content" is returned if no there is a message body, and "204 No Content" is returned if no
response message body is sent. response message body is sent.
If the user is not authorized to alter the target resource an error If the user is not authorized to alter the target resource an error
response containing a "403 Forbidden" Status-Line is returned to the response containing a "403 Forbidden" or "404 Not Found" Status-Line
client. All other error responses are handled according to the is returned to the client. All other error responses are handled
procedures defined in Section 6. according to the procedures defined in Section 6.
Example: Example:
To replace just the "year" field in the "album" resource (instead of To replace just the "year" field in the "album" resource (instead of
replacing the entire resource with the PUT method), the client might replacing the entire resource with the PUT method), the client might
send a plain patch as follows. Note that the request URI header line send a plain patch as follows. Note that the request URI header line
is wrapped for display purposes only: is wrapped 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
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"example-jukebox:album" : { "example-jukebox:album" : {
"genre" : "example-jukebox:rock", "genre" : "example-jukebox:rock",
"year" : 2011 "year" : 2011
} }
} }
skipping to change at page 18, line 40 skipping to change at page 18, line 35
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: The XML encoding for the same request might be:
PATCH /restconf/data/example-jukebox:jukebox/ PATCH /restconf/data/example-jukebox:jukebox/
library/artist/Foo%20Fighters/album/Wasting%20Light HTTP/1.1 library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
Host: example.com Host: example.com
If-Match: b8389233a4c If-Match: b8389233a4c
Content-Type: application/yang.data+xml Content-Type: application/yang.data+xml
<album xmlns="http://example.com/ns/example-jukebox"> <album xmlns="http://example.com/ns/example-jukebox">
<genre>example-jukebox:rock</genre> <genre>example-jukebox:rock</genre>
<year>2011</year> <year>2011</year>
</album> </album>
2.7. DELETE 2.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 method 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" Status-Line is returned error response containing a "403 Forbidden" or "404 Not Found"
to the client. All other error responses are handled according to Status-Line is returned to the client. All other error responses are
the procedures defined in Section 6. handled according to the procedures defined in Section 6.
Example: Example:
To delete a resource such as the "album" resource, the client might To delete a resource such as the "album" resource, the client might
send: send:
DELETE /restconf/data/example-jukebox:jukebox/ DELETE /restconf/data/example-jukebox:jukebox/
library/artist/Foo%20Fighters/album/Wasting%20Light HTTP/1.1 library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
Host: example.com Host: example.com
If the resource is deleted, the server might respond: If the resource is deleted, the server might respond:
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Date: Mon, 23 Apr 2012 17:49:40 GMT Date: Mon, 23 Apr 2012 17:49:40 GMT
Server: example-server Server: example-server
2.8. Query Parameters 2.8. Query Parameters
skipping to change at page 21, line 21 skipping to change at page 21, line 21
which allows multiple datastore edits within a single message. which allows multiple datastore edits within a single message.
3.1. Request URI Structure 3.1. Request URI Structure
Resources are represented with URIs following the structure for Resources are represented with URIs following the structure for
generic URIs in [RFC3986]. generic URIs in [RFC3986].
A RESTCONF operation is derived from the HTTP method and the request A RESTCONF operation is derived from the HTTP method and the request
URI, using the following conceptual fields: URI, using the following conceptual fields:
<OP> /restconf/<path>?<query>#<fragment> <OP> /<restconf>/<path>?<query>#<fragment>
^ ^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | | | |
method entry resource query fragment method entry resource query fragment
M M O O I M M O O I
M=mandatory, O=optional, I=ignored M=mandatory, O=optional, I=ignored
<text> replaced by client with real values <text> replaced by client with real values
o method: the HTTP method identifying the RESTCONF operation o method: the HTTP method identifying the RESTCONF operation
requested by the client, to act upon the target resource specified requested by the client, to act upon the target resource specified
in the request URI. RESTCONF operation details are described in in the request URI. RESTCONF operation details are described in
Section 2. Section 2.
o entry: the well-known RESTCONF entry point ("/restconf"). o entry: the root of the RESTCONF API configured on this HTTP
server, discovered by getting the ".well-known/host-meta"
resource, as described in Section 3.2. All of the examples in
this document assume "/restconf" as the discovered RESTCONF API
root path. The URI template [RFC6570] syntax "{+restconf}" is
used to refer to the entry point outside of an example.
o resource: the path expression identifying the resource that is o resource: the path expression identifying the resource that is
being accessed by the operation. If this field is not present, being accessed by the operation. If this field is not present,
then the target resource is the API itself, represented by the then the target resource is the API itself, represented by the
media type "application/yang.api". media type "application/yang.api".
o query: the set of parameters associated with the RESTCONF message. o query: the set of parameters associated with the RESTCONF message.
These have the familiar form of "name=value" pairs. There is a These have the familiar form of "name=value" pairs. There is a
specific set of parameters defined, although the server MAY choose specific set of parameters defined, although the server MAY choose
to support additional parameters not defined in this document. to support additional parameters not defined in this document.
skipping to change at page 22, line 17 skipping to change at page 22, line 24
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.
3.2. Message Headers 3.2. RESTCONF Path Resolution
In line the best practices defined by [get-off-my-lawn], RESTCONF
enables deployments to specify where the RESTCONF API is located.
When first connecting to a RESTCONF server, a RESTCONF client MUST
determine the root of the RESTCONF API. The client discovers this by
getting the "/.well-known/host-meta" resource ([RFC6415]) and using
the <Link> element containing the "restconf" attribute :
Request
-------
GET /.well-known/host-meta users HTTP/1.1
Host: example.com
Accept: application/xrd+xml
Response
--------
HTTP/1.1 200 OK
Content-Type: application/xrd+xml
Content-Length: nnn
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
<Link rel='restconf' href='/restconf'/>
</XRD>
Once discovering the RESTCONF API root, the client MUST prepend it to
any subsequent request to a RESTCONF resource. For instance, using
the "/restconf" path discovered above, the client can now determine
the operations supported by the the server:
Request
-------
GET /restconf/operations HTTP/1.1
Host: example.com
Accept: application/yang.api+json,
application/yang.errors+json
Response
--------
HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server
Cache-Control: no-cache
Pragma: no-cache
Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT
Content-Type: application/yang.api+json
{ "operations" : { "play" : [ null ] } }
3.3. Message Headers
There are several HTTP header lines utilized in RESTCONF messages. There are several HTTP header lines utilized in RESTCONF messages.
Messages are not limited to the HTTP headers listed in this section. Messages are not limited to the HTTP headers listed in this section.
HTTP defines which header lines are required for particular HTTP defines which header lines are required for particular
circumstances. Refer to each operation definition section in circumstances. Refer to each operation definition section in
Section 2 for examples on how particular headers are used. Section 2 for examples on how particular headers are used.
There are some request headers that are used within RESTCONF, usually There are some request headers that are used within RESTCONF, usually
applied to data resources. The following tables summarize the applied to data resources. The following tables summarize the
skipping to change at page 23, line 21 skipping to change at page 24, line 25
| Date | The date and time the message was sent | | Date | The date and time the message was sent |
| ETag | An identifier for a specific version of a | | ETag | An identifier for a specific version of a |
| | resource | | | resource |
| Last-Modified | The last modified date and time of a resource | | Last-Modified | The last modified date and time of a resource |
| Location | The resource identifier for a newly created | | Location | The resource identifier for a newly created |
| | resource | | | resource |
+---------------+---------------------------------------------------+ +---------------+---------------------------------------------------+
RESTCONF Response Headers RESTCONF Response Headers
3.3. Message Encoding 3.4. Message Encoding
RESTCONF messages are encoded in HTTP according to RFC 2616. The RESTCONF messages are encoded in HTTP according to RFC 2616. The
"utf-8" character set is used for all messages. RESTCONF message "utf-8" character set is used for all messages. RESTCONF message
content is sent in the HTTP message body. content is sent in the HTTP message body.
Content is encoded in either JSON or XML format. Content is encoded in either JSON or XML format.
XML encoding rules for data nodes are defined in [RFC6020]. The same XML encoding rules for data nodes are defined in [RFC6020]. The same
encoding rules are used for all XML content. encoding rules are used for all XML content.
skipping to change at page 23, line 47 skipping to change at page 25, line 5
Request input content encoding format is identified with the Content- Request input content encoding format is identified with the Content-
Type header. This field MUST be present if a message body is sent by Type header. This field MUST be present if a message body is sent by
the client. the client.
Response output content encoding format is identified with the Accept Response output content encoding format is identified with the Accept
header in the request, or if is not specified, the request input header in the request, or if is not specified, the request input
encoding format is used. If there was no request input, then the encoding format is used. If there was no request input, then the
default output encoding is XML. File extensions encoded in the default output encoding is XML. File extensions encoded in the
request are not used to identify format encoding. request are not used to identify format encoding.
3.4. RESTCONF Meta-Data 3.5. RESTCONF Meta-Data
The RESTCONF protocol needs to retrieve the same meta-data that is The RESTCONF protocol needs to retrieve the same meta-data that is
used in the NETCONF protocol. Information about default leafs, last- used in the NETCONF protocol. Information about default leafs, last-
modified timestamps, etc. are commonly used to annotate modified timestamps, etc. are commonly used to annotate
representations of the datastore contents. This meta-data is not representations of the datastore contents. This meta-data is not
defined in the YANG schema because it applies to the datastore, and defined in the YANG schema because it applies to the datastore, and
is common across all data nodes. is common across all data nodes.
This information is encoded as attributes in XML, but JSON does not This information is encoded as attributes in XML. JSON encoding of
have a standard way of attaching non-schema defined meta-data to a meta-data is defined in [I-D.lhotka-netmod-json].
resource.
3.4.1. JSON Encoding of RESTCONF Meta-Data
The YANG to JSON mapping [I-D.lhotka-netmod-json] does not support
attributes because YANG does not support meta-data in data node
definitions. This section specifies how RESTCONF meta-data is
encoded in JSON.
Only simple meta-data is supported:
o A meta-data instance can appear 0 or 1 times for a particular data
node
o A meta-data instance associated with a resource is encoded as if
it were a YANG leaf of type "string", according to the encoding
rules in [I-D.lhotka-netmod-json], except the identifier is
prepended with a "@" (%40) character.
o A meta-data instance associated with a YANG leaf or leaf-list
within a resource is encoded as if it were a container for the
meta-data values and the resource value in its native encoding.
It is encoded according to the rules in [I-D.lhotka-netmod-json],
except the meta-data identifiers are prepended with a "@" (%40)
character. The resource name/value pair is repeated inside this
container, which contains the actual value of the resource.
Example:
Meta-data:
enabled=<boolean>
owner=<owner-name>
YANG module: example
YANG example:
container top {
leaf A {
type int32;
}
leaf B {
type boolean;
}
}
The client is retrieving the "top" data resource, and the server is
including datastore meta-data. Note that a query parameter to
request or suppress specific meta-data is not provided in RESTCONF.
GET /restconf/data/example:top HTTP/1.1
Host: example.com
Accept: application/yang.data+json
The server might respond as follows:
HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server
Content-Type: application/yang.data+json
{
"example:top": {
"@enabled" : "true",
"@owner" : "fred",
"A" : {
"@enabled" : "true",
"A" : 42
},
"B" : {
"@enabled" : "false",
"B" : true
}
}
}
3.5. Return Status 3.6. Return Status
Each message represents some sort of resource access. An HTTP Each message represents some sort of resource access. An HTTP
"Status-Line" header line is returned for each request. If a 4xx or "Status-Line" header line is returned for each request. If a 4xx or
5xx range status code is returned in the Status-Line, then the error 5xx range status code is returned in the Status-Line, then the error
information will be returned in the response, according to the format information will be returned in the response, according to the format
defined in Section 6.1. defined in Section 6.1.
3.6. Message Caching 3.7. Message Caching
Since the datastore contents change at unpredictable times, responses Since the datastore contents change at unpredictable times, responses
from a RESTCONF server generally SHOULD NOT be cached. from a RESTCONF server generally SHOULD NOT be cached.
The server SHOULD include a "Cache-Control" header in every response The server SHOULD include a "Cache-Control" header in every response
that specifies whether the response should be cached. A "Pragma" that specifies whether the response should be cached. A "Pragma"
header specifying "no-cache" MAY also be sent in case the header specifying "no-cache" MAY also be sent in case the
"Cache-Control" header is not supported. "Cache-Control" header is not supported.
Instead of using HTTP caching, the client SHOULD track the "ETag" Instead of using HTTP caching, the client SHOULD track the "ETag"
skipping to change at page 27, line 12 skipping to change at page 26, line 12
message headers, which SHOULD include the "ETag" and "Last-Modified" message headers, which SHOULD include the "ETag" and "Last-Modified"
headers, if this meta-data is maintained for the target resource. headers, if this meta-data is maintained for the target resource.
4. Resources 4. 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. Each resource represents a with the top-level API resource itself. Each resource represents a
manageable component within the device. manageable component within the device.
A resource can be considered a collection of conceptual data and the A resource can be considered a collection of conceptual data and the
set of allowed methods on that data. It can contain child nodes that set of allowed methods on that data. It can contain nested child
are nested resources. The child resource types and methods allowed resources. The child resource types and methods allowed on them are
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 datastore All RESTCONF resources are defined in this document except datastore
contents, protocol operations, and notification events. The syntax contents, protocol operations, and notification events. The syntax
and semantics for these resource types are defined in YANG modules. and semantics for these resource types are defined in YANG modules.
The RESTCONF resources are accessed via a set of URIs defined in this The RESTCONF resources are accessed via a set of URIs defined in this
document. The set of YANG modules supported by the server will document. The set of YANG modules supported by the server will
determine the additional data model specific operations, top-level determine the data model specific operations, top-level data node
data node resources, and notification event messages supported by the resources, and notification event messages supported by the server.
server.
The resources used in the RESTCONF protocol are identified by the The resources used in the RESTCONF protocol are identified by the
"path" component in the request URI. Each operation is performed on "path" component in the request URI. Each operation is performed on
a target resource. a target resource.
4.1. RESTCONF Resource Types 4.1. RESTCONF Resource Types
The RESTCONF protocol defines some application specific media types The RESTCONF protocol defines a set of application specific media
to identify each of the available resource types. The following types to identify each of the available resource types. The
resource types are defined in RESTCONF: following resource types are defined in RESTCONF:
+-----------+----------------------------+ +-----------+----------------------------+
| Resource | Media Type | | Resource | Media Type |
+-----------+----------------------------+ +-----------+----------------------------+
| API | application/yang.api | | API | application/yang.api |
| Datastore | application/yang.datastore | | Datastore | application/yang.datastore |
| Data | application/yang.data | | Data | application/yang.data |
| Errors | application/yang.errors |
| Operation | application/yang.operation | | Operation | application/yang.operation |
| Schema | application/yang | | Schema | application/yang |
| Stream | application/yang.stream | | Stream | application/yang.stream |
+-----------+----------------------------+ +-----------+----------------------------+
RESTCONF Media Types RESTCONF Media Types
4.2. Resource Discovery 4.2. Resource Discovery
A client SHOULD start by retrieving the top-level API resource, using A client SHOULD start by retrieving the top-level API resource, using
the entry point URI "/restconf". the entry point URI defined in Section 3.2.
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.
The "depth" query parameter can be used to control how many The "depth" query parameter can be used to control how many
descendant levels should be included when retrieving sub-resources. descendant levels should be included when retrieving child resources.
This parameter can be used with the GET method to discover sub- This parameter can be used with the GET method to discover child
resources within a particular resource. resources within a particular resource.
4.3. API Resource (/restconf) 4.3. API Resource
The API resource contains the state and access points for the The API resource contains the state and access points for the
RESTCONF features. It is the top-level resource and has the media RESTCONF features. It is the top-level resource and has the media
type "application/yang.api+xml" or "application/yang.api+json". It type "application/yang.api+xml" or "application/yang.api+json".
is accessible through the well-known URI "/restconf".
YANG Tree Diagram for "application/yang.api" Resource Type: YANG Tree Diagram for "application/yang.api" Resource Type:
+--rw restconf +--rw restconf
+--rw data +--rw data
+--rw modules +--rw modules
| +--rw module [name revision] | +--rw module* [name revision]
| +--rw name yang:yang-identifier | +--rw name yang:yang-identifier
| +--rw revision union | +--rw revision union
| +--rw schema? empty | +--rw schema? empty
| +--rw namespace inet:uri | +--rw namespace inet:uri
| +--rw feature* yang:yang-identifier | +--rw feature* yang:yang-identifier
| +--rw deviation* yang:yang-identifier | +--rw deviation* yang:yang-identifier
| +--rw submodule [name revision] | +--rw submodule* [name revision]
| +--rw name yang:yang-identifier | +--rw name yang:yang-identifier
| +--rw revision union | +--rw revision union
| +--rw schema? empty | +--rw schema? empty
+--rw operations +--rw operations
+--rw streams +--rw streams
| +--rw stream [name] +--rw stream* [name]
| +--rw name string +--rw name string
| +--rw description? string +--rw description? string
| +--rw replay-support? boolean +--rw replay-support? boolean
| +--rw replay-log-creation-time? yang:date-and-time +--rw replay-log-creation-time? yang:date-and-time
| +--rw events? empty +--rw events? empty
+--ro version? enumeration
The "restconf" container definition in the "ietf-restconf" module The "restconf" container definition in the "ietf-restconf" module
defined in Section 7 is used to specify the structure and syntax of defined in Section 7 is used to specify the structure and syntax of
the conceptual sub-resources within the API resource. the conceptual child resources within the API resource.
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 |
| modules | YANG module information | | modules | YANG module information |
| operations | Data-model specific operations | | operations | Data-model specific operations |
| streams | Notification event streams | | streams | Notification event streams |
| version | RESTCONF API version |
+----------------+--------------------------------+ +----------------+--------------------------------+
RESTCONF Resources RESTCONF Resources
4.3.1. /restconf/data 4.3.1. {+restconf}/data
This mandatory resource represents the combined configuration and This mandatory resource represents the combined configuration and
operational data resources that can be accessed by a client. It operational data resources that can be accessed by a client. It
cannot be created or deleted by the client. The datastore resource cannot be created or deleted by the client. The datastore resource
type is defined in Section 4.4. type is defined in Section 4.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. using the "content" query parameter.
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+json,
application/yang.errors+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17: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+json
{ {
"example-jukebox:library" : { "example-jukebox:library" : {
"artist-count" : 42, "artist-count" : 42,
"album-count" : 59, "album-count" : 59,
"song-count" : 374 "song-count" : 374
} }
} }
4.3.2. /restconf/modules 4.3.2. {+restconf}/modules
This mandatory resource contains the identifiers for the YANG data This mandatory resource contains the identifiers for the YANG data
model modules supported by the server. model modules supported by the server.
The server MUST maintain a last-modified timestamp for this resource, The server MUST maintain a last-modified timestamp for this resource,
and return the "Last-Modified" header when this resource is retrieved and return the "Last-Modified" header when this resource is retrieved
with the GET or HEAD methods. with the GET or HEAD methods.
The server SHOULD maintain an entity-tag for this resource, and The server SHOULD maintain an entity-tag for this resource, and
return the "ETag" header when this resource is retrieved with the GET return the "ETag" header when this resource is retrieved with the GET
or HEAD methods. or HEAD methods.
4.3.2.1. /restconf/modules/module 4.3.2.1. {+restconf}/modules/module
This mandatory resource contains one list entry for each YANG data This mandatory resource contains one list entry for each YANG data
model module supported by the server. There MUST be an instance of model module supported by the server. There MUST be an instance of
this resource for every YANG module that is accessible via an this resource for every YANG module that is accessible via an
operation resource or a data resource. operation resource or a data resource.
The contents of the "module" resource are defined in the "module" The contents of the "module" resource are defined in the "module"
YANG list statement in Section 7. YANG list statement in Section 7.
The server MAY maintain a last-modified timestamp for each instance The server MAY maintain a last-modified timestamp for each instance
of this resource, and return the "Last-Modified" header when this of this resource, and return the "Last-Modified" header when this
resource is retrieved with the GET or HEAD methods. If not supported resource is retrieved with the GET or HEAD methods. If not supported
then the timestamp for the parent "modules" resource MAY be used then the timestamp for the parent "modules" resource MAY be used
instead. instead.
The server MAY maintain an entity-tag for each instance of this The server MAY maintain an entity-tag for each instance of this
resource, and return the "ETag" header when this resource is resource, and return the "ETag" header when this resource is
retrieved with the GET or HEAD methods. If not supported then the retrieved with the GET or HEAD methods. If not supported then the
timestamp for the parent "modules" resource MAY be used instead. timestamp for the parent "modules" resource MAY be used instead.
4.3.3. /restconf/operations 4.3.3. {+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 4.6. Operation resources are defined in Section 4.6.
4.3.4. /restconf/streams 4.3.4. {+restconf}/streams
This optional resource is a container that provides access to the This optional resource is a container that provides access to the
notification event streams supported by the server. The server MAY notification event streams supported by the server. The server MAY
omit this resource if no notification event streams are supported. omit this resource if no notification event streams are supported.
The media type for this resource is "application/yang.api". The media type for this resource is "application/yang.api".
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 represents an event stream resource. The media type "events" which represents an event stream resource. The media type
for this resource is "application/yang.stream". for this resource is "application/yang.stream".
Stream resources are defined in Section 4.8. Notifications are Stream resources are defined in Section 4.8. Notifications are
defined in Section 5. defined in Section 5.
4.3.5. /restconf/version
This sub-resource can be used by the client to identify the exact
version of the RESTCONF protocol implemented by the server. The same
server-wide response MUST be returned each time this resource is
retrieved.
The value is assigned by the server when the server is started. The
server MUST return the value "1.0" for this version of the RESTCONF
protocol. This resource is encoded with the rules for an
"enumeration" data type, using the "version" leaf definition in
Section 7.
4.4. Datastore Resource 4.4. Datastore Resource
The /restconf/data subtree represents the datastore resource type, The "{+restconf}/data" subtree represents the datastore resource
which is a collection of configuration and operational data nodes. type, which is a collection of configuration and operational data
nodes.
A "unified datastore" interface is used to simplify resource editing A "unified datastore" interface is used to simplify resource editing
for the client. The RESTCONF unified datastore is a conceptual for the client. The RESTCONF unified datastore is a conceptual
interface to the native configuration datastores that are present on interface to the native configuration datastores that are present on
the device. the device.
The underlying NETCONF datastores (i.e., candidate, running, startup) The underlying NETCONF datastores (i.e., candidate, running, startup)
can be used to implement the unified datastore, but the server design can be used to implement the unified datastore, but the server design
is not limited to the exact datastore procedures defined in NETCONF. is not limited to the exact datastore procedures defined in NETCONF.
The "candidate" and "startup" datastores are not visible in the The "candidate" and "startup" datastores are not visible in the
RESTCONF protocol. 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. Only the configuration data resources within the datastore
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 running
configuration.
4.4.1. Edit Collision Detection 4.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.
4.4.1.1. Timestamp 4.4.1.1. Timestamp
The last change time is maintained and the "Last-Modified" and "Date" The last change time is maintained and the "Last-Modified" and "Date"
headers are returned in the response for a retrieval request. The headers are returned in the response for a retrieval request. The
"If-Unmodified-Since" header can be used in edit operation requests "If-Unmodified-Since" header can be used in edit operation requests
skipping to change at page 32, line 48 skipping to change at page 31, line 47
header can be used in edit operation requests to cause the server to header can be used in edit operation requests to cause the server to
reject the request if the resource entity tag does not match the reject the request if the resource entity tag does not match the
specified value. specified value.
The server MUST maintain a resource entity tag for this resource, and The server MUST maintain a resource entity tag for this resource, and
return the "ETag" header when this resource is retrieved with the GET return the "ETag" header when this resource is retrieved with the GET
or HEAD methods. The resource entity tag MUST be changed to a new or HEAD methods. The resource entity tag MUST be changed to a new
previously unused value if changes to any configuration data previously unused value if changes to any configuration data
resources within the datastore are made. resources within the datastore are made.
A datastore resource can only be written directly with the PATCH
method. Only the configuration data resources within the datastore
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 running
configuration.
4.5. Data Resource 4.5. Data Resource
A data resource represents a YANG data node that is a descendant node A data resource represents a YANG data node that is a descendant node
of a datastore resource. of a datastore resource.
For configuration data resources, the server MAY maintain a last- For configuration data resources, the server MAY maintain a last-
modified timestamp for the resource, and return the "Last-Modified" modified timestamp for the resource, and return the "Last-Modified"
header when it is retrieved with the GET or HEAD methods. If header when it is retrieved with the GET or HEAD methods. If
maintained, the resource timestamp MUST be set to the current time maintained, the resource timestamp MUST be set to the current time
whenever the resource or any configuration resource within the whenever the resource or any configuration resource within the
resource is altered. resource is altered.
For configuration data resources, the server MAY maintain a resource For configuration data resources, the server MAY maintain a resource
entity tag for the resource, and return the "ETag" header when it is entity tag for the resource, and return the "ETag" header when it is
retrieved as the target resource with the GET or HEAD methods. If retrieved as the target resource with the GET or HEAD methods. If
maintained, the resource entity tag MUST be updated whenever the maintained, the resource entity tag MUST be updated whenever the
resource or any configuration resource within the resource is resource or any configuration resource within the resource is
altered. altered.
A data resource can be retrieved with the GET method. Data resources A data resource can be retrieved with the GET method. Data resources
can be accessed via the "/restconf/data" entry point. This sub-tree are accessed via the "{+restconf}/data" entry point. This sub-tree
is used to retrieve and edit data resources. is used to retrieve and edit data resources.
A configuration data resource can be altered by the client with some A configuration data resource can be altered by the client with some
of all of the edit operations, depending on the target resource and or all of the edit operations, depending on the target resource and
the specific operation. Refer to Section 2 for more details on edit the specific operation. Refer to Section 2 for more details on edit
operations. operations.
The resource definition version for a data resource is identified by The resource definition version for a data resource is identified by
the revision date of the YANG module containing the YANG definition the revision date of the YANG module containing the YANG definition
for the data resource, specified in the /restconf/modules sub-tree. for the data resource, specified in the "{+restconf}/modules" sub-
tree.
4.5.1. Encoding YANG Instance Identifiers in the Request URI 4.5.1. Encoding YANG Instance Identifiers in the Request URI
In YANG, data nodes are named with an absolute XPath expression, In YANG, data nodes are named with an absolute XPath expression,
defined in [XPath] , starting from the document root to the target defined in [XPath] , starting from the document root to the target
resource. In RESTCONF, URL encoded Location header expressions are resource. In RESTCONF, URL encoded Location header expressions are
used instead. used instead.
The YANG "instance-identifier" (i-i) data type is represented in The YANG "instance-identifier" (i-i) data type is represented in
RESTCONF with the path expression format defined in this section. RESTCONF with the path expression format defined in this section.
skipping to change at page 34, line 29 skipping to change at page 33, line 17
static naming and defines an absolute path location for all data static naming and defines an absolute path location for all data
nodes. nodes.
A RESTCONF data resource identifier is not an XPath expression. It A RESTCONF data resource identifier is not an XPath expression. It
is encoded from left to right, starting with the top-level data node, is encoded from left to right, starting with the top-level data node,
according to the "api-path" rule in Section 4.5.1.1. The node name according to the "api-path" rule in Section 4.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) are encoded according to the key values for the list (if any) MUST be encoded according to the
"key-value" rule. If the list node is the target resource, then the following rules.
key values MAY be omitted, according to the operation. For example,
the POST method to create a new data resource for a list node does
not require key values to be present in the request URI.
The key leaf values for a data resource representing a YANG list MUST o The key leaf values for a data resource representing a YANG list
be encoded as follows: MUST be encoded using one path segment [RFC3986].
o The value of each leaf identified in the "key" statement is o If there is only one key leaf value, the path segment is
encoded in order. constructed by having the list name followed by an "=" followed by
the single key leaf value.
o If there are multiple key leaf values, the value of each leaf
identified in the "key" statement is encoded in the order
specified in the YANG "key" statement, with a comma separating
them.
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 Each value is encoded using the "key-value" rule in o Quoted strings are supported in the key leaf values. Quoted
Section 4.5.1.1, according to the encoding rules for the data type strings MUST be used to express empty strings. (example:
of the key leaf. list=foo,'',baz).
o An empty string can be a valid key value (e.g., "/top/list/key1//
key3").
o The "/" character MUST be URL-encoded (i.e., "%2F").
o All whitespace MUST be URL-encoded.
o A "null" value is not allowed since the "empty" data type is not
allowed for key leafs.
o The XML encoding is defined in [RFC6020].
o The JSON encoding is defined in [I-D.lhotka-netmod-json].
o The entire "key-value" MUST be properly URL-encoded, according to o The "list-instance" ABNF rule defined in Section 4.5.1.1
the rules defined in [RFC3986]. represents the syntax of a list instance identifier.
o resource URI values returned in Location headers for data o Resource URI values returned in Location headers for data
resources MUST identify the module name, even if there are no resources MUST identify the module name, even if there are no
conflicting local names when the resource is created. This conflicting local names when the resource is created. This
ensures the correct resource will be identified even if the server ensures the correct resource will be identified even if the server
loads a new module that the old client does not know about. loads a new module that the old client does not know about.
Examples: Examples:
[ lines wrapped for display purposes only ] container top {
list list1 {
/restconf/data/example-jukebox:jukebox/library/ key "key1 key2 key3";
artist/Beatles/album ...
list list2 {
/restconf/data/example-list:newlist/17 key "key4 key5";
/nextlist%2Ffoo%2Fbar%2Facme-list-ext%3Aext-leaf ...
leaf X { type string; }
}
}
/restconf/data/example-list:somelist/the%20key For the above YANG definition, URI with key leaf values will be
encoded as follows (line wrapped for display purposes only):
/restconf/data/example-list:somelist/the%20key/address /restconf/data/top/list1=key1val,key2val,key3val3/
list2=key4val,key5val/X
4.5.1.1. ABNF For Data Resource Identifiers 4.5.1.1. ABNF For Data Resource Identifiers
The following ABNF syntax is used to construct RESTCONF path The "api-path" ABNF syntax is used to construct RESTCONF path
identifiers: identifiers:
api-path = "/" | api-path = "/" |
("/" api-identifier ("/" api-identifier
0*("/" (api-identifier | key-value ))) 0*("/" (api-identifier | list-instance )))
api-identifier = [module-name ":"] identifier api-identifier = [module-name ":"] identifier
module-name = identifier module-name = identifier
list-instance = api-identifier "=" key-value ["," key-value]*
key-value = string key-value = string
string = <a quoted or unquoted or empty 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 / "_" / "-" / ".")
string = <an unquoted string>
[FIXME: the syntax for the select string is still TBD]
api-select = api-identifier
0*("/" (api-identifier | key-value ))
4.5.2. Defaults Handling 4.5.2. Defaults Handling
NETCONF has a rather complex model for handling default values for NETCONF has a rather complex model for handling default values for
leafs. RESTCONF attempts to avoid this complexity by restricting the leafs. RESTCONF attempts to avoid this complexity by restricting the
operations that can be applied to a resource. operations that can be applied to a resource. Applications that
require full control of defaults might consider NETCONF instead of
RESTCONF.
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 sub-resources with default values, for container or list that has any child resources with default values,
the sub-resources that have not been given value yet, the server MAY for the child resources that have not been given value yet, the
return the default values that are in use by the server. server MAY return the default values that are in use by the server.
4.6. Operation Resource 4.6. Operation Resource
An operation resource represents an protocol operation defined with An operation resource represents an protocol operation defined with
the YANG "rpc" statement. the YANG "rpc" statement.
All operation resources share the same module namespace as any top- All operation resources share the same module namespace as any top-
level data resources, so the name of an operation resource cannot level data resources, so the name of an operation resource cannot
conflict with the name of a top-level data resource defined within conflict with the name of a top-level data resource defined within
the same module. the same module.
skipping to change at page 38, line 49 skipping to change at page 37, line 20
} }
leaf message { type string; } leaf message { type string; }
leaf language { type string; } leaf language { type string; }
} }
} }
The client might send the following POST request message: The client might send the following POST request message:
POST /restconf/operations/example-ops: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,
application/yang.errors+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 25 Apr 2012 11:10:30 GMT Date: Mon, 25 Apr 2012 11:10:30 GMT
Server: example-server Server: example-server
Content-Type: application/yang.operation+json Content-Type: application/yang.operation+json
{ {
"example-ops:output" : { "example-ops:output" : {
skipping to change at page 39, line 26 skipping to change at page 37, line 46
} }
4.7. Schema Resource 4.7. Schema Resource
If the server supports the "schema" leaf within the API then the If the server supports the "schema" leaf within the API then the
client can retrieve the YANG schema text for the associated YANG client can retrieve the YANG schema text for the associated YANG
module or submodule, using the GET method. module or submodule, using the GET method.
The client might send the following GET request message: The client might send the following GET request message:
GET /restconf/modules/module/example-jukebox/2013-12-21/schema GET /restconf/modules/module=example-jukebox,2014-07-03/schema
HTTP/1.1 HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang Accept: application/yang,
application/yang.errors+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 Content-Type: application/yang
module example-jukebox { module example-jukebox {
namespace "http://example.com/ns/example-jukebox"; namespace "http://example.com/ns/example-jukebox";
prefix "jbox"; prefix "jbox";
// rest of YANG module content deleted... // rest of YANG module content deleted...
} }
4.8. Stream Resource 4.8. Stream Resource
A stream resource represents a source for system generated event A "stream" resource represents a source for system generated event
notifications. Each stream is created and modified by the server notifications. Each stream is created and modified by the server
only. A client can retrieve a stream resource or initiate a long- only. A client can retrieve a stream resource or initiate a long-
poll server sent event stream, using the procedure specified in poll server sent event stream, using the procedure specified in
Section 5.3. Section 5.3.
A notification stream functions according to the NETCONF A notification stream functions according to the NETCONF
Notifications specification [RFC5277]. The "ietf-restconf" YANG Notifications specification [RFC5277]. The "ietf-restconf" YANG
module contains the "stream" list (/restconf/streams/stream) which module contains the "stream" list ("{+restconf}/streams/stream")
specifies the syntax and semantics of a stream resource. which specifies the syntax and semantics of a stream resource.
4.9. Errors Resource
An "errors" resource is a collection of error information that is
sent as the message body in a server response message, if an error
occurs while processing a request message.
The "ietf-restconf" YANG module contains the "errors" grouping which
specifies the syntax and semantics of an errors resource. RESTCONF
error handling behavior is defined in Section 6.
5. Notifications 5. Notifications
The RESTCONF protocol supports YANG-defined event notifications. The The RESTCONF protocol supports YANG-defined event notifications. The
solution preserves aspects of NETCONF Event Notifications [RFC5277] solution preserves aspects of NETCONF Event Notifications [RFC5277]
while utilizing the Server-Sent Events [wd-eventsource] transport while utilizing the Server-Sent Events [wd-eventsource] transport
strategy. strategy.
5.1. Server Support 5.1. Server Support
A RESTCONF server is not required to support RESTCONF notifications. A RESTCONF server is not required to support RESTCONF notifications.
Clients may determine if a server supports RESTCONF notifications by Clients may determine if a server supports RESTCONF notifications by
using the HTTP operation OPTIONS, HEAD, or GET on the "/restconf/ using the HTTP operation OPTIONS, HEAD, or GET on the "{+restconf}/
streams" resource described below. The server does not support streams" resource described below. The server does not support
RESTCONF notifications if an HTTP error code is returned (e.g. 404 RESTCONF notifications if an HTTP error code is returned (e.g., 404
Not Found). Not Found).
5.2. Event Streams 5.2. Event Streams
A RESTCONF server that supports notifications will populate a stream A RESTCONF server that supports notifications will populate a stream
resource for each notification delivery service access point. A resource for each notification delivery service access point. A
RESTCONF client can retrieve the list of supported event streams from RESTCONF client can retrieve the list of supported event streams from
a RESTCONF server using the GET operation on the "/restconf/streams" a RESTCONF server using the GET operation on the "{+restconf}/
resource. streams" resource.
The "/restconf/streams" container definition in the "ietf-restconf" The "{+restconf}/streams" container definition in the "ietf-restconf"
module defined in Section 7 is used to specify the structure and module defined in Section 7 is used to specify the structure and
syntax of the conceptual sub-resources within the "streams" resource. syntax of the conceptual child resources within the "streams"
resource.
For example: For example:
The client might send the following request: The client might send the following request:
GET /restconf/streams HTTP/1.1 GET /restconf/streams HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.api+xml Accept: application/yang.api+xml,
application/yang.errors+xml
The server might send the following response: The server might send the following response:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/yang.api+xml Content-Type: application/yang.api+xml
<streams xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"> <streams xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<stream> <stream>
<name>NETCONF</name> <name>NETCONF</name>
<description>default NETCONF event stream <description>default NETCONF event stream
</description> </description>
skipping to change at page 42, line 36 skipping to change at page 40, line 36
<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>
<events/> <events/>
</stream> </stream>
</streams> </streams>
5.3. Subscribing to Receive Notifications 5.3. Subscribing to Receive Notifications
RESTCONF clients can subscribe to receive notifications by sending an RESTCONF clients can subscribe to receive notifications by sending an
HTTP GET request for the "/restconf/streams/stream/<stream-name>" HTTP GET request for the "{+restconf}/streams/stream/<stream-name>"
resource, with the "Accept" type "text/event-stream". The server resource, with the "Accept" type "text/event-stream". The server
will treat the connection as an event stream, using the Server Sent will treat the connection as an event stream, using the Server Sent
Events [wd-eventsource] transport strategy. Events [wd-eventsource] 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:
GET /restconf/streams/stream/NETCONF/events HTTP/1.1 GET /restconf/streams/stream=NETCONF/events HTTP/1.1
Host: example.com Host: example.com
Accept: text/event-stream Accept: text/event-stream
Cache-Control: no-cache Cache-Control: no-cache
Connection: keep-alive Connection: keep-alive
A RESTCONF client MAY request the server compress the events using A RESTCONF client MAY request the server compress the events using
the HTTP header field "Accept-Encoding". For instance: the HTTP header field "Accept-Encoding". For instance:
GET /restconf/streams/stream/NETCONF/events HTTP/1.1 GET /restconf/streams/stream=NETCONF/events HTTP/1.1
Host: example.com Host: example.com
Accept: text/event-stream Accept: text/event-stream
Cache-Control: no-cache Cache-Control: no-cache
Connection: keep-alive Connection: keep-alive
Accept-Encoding: gzip, deflate Accept-Encoding: gzip, deflate
5.3.1. NETCONF Event Stream 5.3.1. NETCONF Event Stream
The server SHOULD support the "NETCONF" notification stream defined The server SHOULD support the "NETCONF" notification stream defined
in [RFC5277]. For this stream, RESTCONF notification subscription in [RFC5277]. For this stream, RESTCONF notification subscription
skipping to change at page 46, line 35 skipping to change at page 44, line 35
| partial-operation | 500 | | partial-operation | 500 |
| malformed-message | 400 | | malformed-message | 400 |
+-------------------------+-------------+ +-------------------------+-------------+
Mapping from error-tag to status code Mapping from error-tag to status code
6.1. Error Response Message 6.1. Error Response Message
When an error occurs for a request message on a data resource or an When an error occurs for a request message on a data resource or an
operation resource, and a "4xx" class of status codes (except for operation resource, and a "4xx" class of status codes (except for
status code "403"), then the server SHOULD send a response body status code "403 Forbidden"), then the server SHOULD send a response
containing the information described by the "errors" container body containing the information described by the "errors" container
definition within the YANG module Section 7. definition within the YANG module Section 7. The Content-Type of
this response message MUST be application/yang.errors.
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-node)?
| +--:(error-path) | +--:(error-path)
skipping to change at page 47, line 21 skipping to change at page 45, line 22
error on a datastore resource. error on a datastore resource.
POST /restconf/operations/example-ops:lock-datastore HTTP/1.1 POST /restconf/operations/example-ops:lock-datastore HTTP/1.1
Host: example.com Host: example.com
The server might respond: The server might respond:
HTTP/1.1 409 Conflict HTTP/1.1 409 Conflict
Date: Mon, 23 Apr 2012 17:11:00 GMT Date: Mon, 23 Apr 2012 17:11:00 GMT
Server: example-server Server: example-server
Content-Type: application/yang.api+json Content-Type: application/yang.errors+json
{ {
"ietf-restconf:errors": { "ietf-restconf:errors": {
"error": { "error": {
"error-type": "protocol", "error-type": "protocol",
"error-tag": "lock-denied", "error-tag": "lock-denied",
"error-message": "Lock failed, lock already held" "error-message": "Lock failed, lock already held"
} }
} }
} }
skipping to change at page 48, line 8 skipping to change at page 46, line 8
The client might send: The client might send:
POST /restconf/data/example-jukebox:jukebox HTTP/1.1 POST /restconf/data/example-jukebox:jukebox HTTP/1.1
Host: example.com Host: example.com
The server might respond: The server might respond:
HTTP/1.1 409 Conflict HTTP/1.1 409 Conflict
Date: Mon, 23 Apr 2012 17:11:00 GMT Date: Mon, 23 Apr 2012 17:11:00 GMT
Server: example-server Server: example-server
Content-Type: application/yang.api+json Content-Type: application/yang.errors+json
{ {
"ietf-restconf:errors": { "ietf-restconf:errors": {
"error": { "error": {
"error-type": "protocol", "error-type": "protocol",
"error-tag": "data-exists", "error-tag": "data-exists",
"error-urlpath": "http://example.com/restconf/data/ "error-urlpath": "http://example.com/restconf/data/
example-jukebox:jukebox", example-jukebox:jukebox",
"error-message": "error-message":
"Data already exists, cannot create new resource" "Data already exists, cannot create new resource"
} }
} }
} }
7. RESTCONF module 7. RESTCONF module
The "ietf-restconf" module defines conceptual definitions within The "ietf-restconf" module defines conceptual definitions within
groupings, which are not meant to be implemented as datastore groupings, which are not meant to be implemented as datastore
contents by a server. contents by a server.
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@2014-03-22.yang" <CODE BEGINS> file "ietf-restconf@2014-07-03.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";
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 50, line 31 skipping to change at page 48, line 31
Relating to IETF Documents Relating to IETF Documents
(http://trustee.ietf.org/license-info). (http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; see This version of this YANG module is part of RFC XXXX; see
the RFC itself for full legal notices."; the RFC itself for full legal notices.";
// RFC Ed.: replace XXXX with actual RFC number and remove this // RFC Ed.: replace XXXX with actual RFC number and remove this
// note. // note.
// RFC Ed.: remove this note // RFC Ed.: remove this note
// Note: extracted from draft-ietf-netconf-restconf-00.txt // Note: extracted from draft-ietf-netconf-restconf-01.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 2014-03-22 { revision 2014-07-03 {
description description
"Initial revision."; "Initial revision.";
reference reference
"RFC XXXX: RESTCONF Protocol."; "RFC XXXX: RESTCONF Protocol.";
} }
typedef data-resource-identifier { typedef data-resource-identifier {
type string { type string {
length "1 .. max"; length "1 .. max";
} }
skipping to change at page 51, line 39 skipping to change at page 49, line 39
} }
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 {
config false; // needed so list error does not need a key
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.";
list error { list error {
description description
"An entry containing information about one "An entry containing information about one
specific error that occurred while processing specific error that occurred while processing
a RESTCONF request."; a RESTCONF request.";
reference "RFC 6241, Section 4.3"; reference "RFC 6241, Section 4.3";
skipping to change at page 57, line 9 skipping to change at page 55, line 9
leaf events { leaf events {
type empty; type empty;
description description
"Represents the entry point for establishing "Represents the entry point for establishing
notification delivery via server sent events."; notification delivery via server sent events.";
} }
} }
} }
leaf version {
type enumeration {
enum "1.0" {
description
"Version 1.0 of the RESTCONF protocol.";
}
}
config false;
description
"Contains the RESTCONF protocol version.";
}
} }
} // grouping restconf } // grouping restconf
grouping query-parameters { grouping query-parameters {
description description
"Contains conceptual definitions for the query string "Contains conceptual definitions for the query string
parameters used in the RESTCONF protocol."; parameters used in the RESTCONF protocol.";
leaf content { leaf content {
type enumeration { type enumeration {
skipping to change at page 60, line 37 skipping to change at page 58, line 25
This parameter contains the instance identifier of the This parameter contains the instance identifier of the
resource to be used as the insertion point for a resource to be used as the insertion point for a
POST or PUT method."; POST or PUT method.";
} }
leaf select { leaf select {
type string { type string {
length "1 .. max"; length "1 .. max";
} }
description description
"The 'select' query parameter is used to specify an "The 'select' query parameter is used to optionally identify
expression which can represent a subset of all data nodes data nodes within the target resource to be retrieved in a
within the target resource. It contains an expression GET method. The client can use this parameter to retrieve
string, using the target resource as the context node. a subset of all nodes in a resource.
The encoding for the select parameter is still TBD. A value of the 'select' query parameter matches the
following rule:
select-expr = path '(' select-expr / '*' ')' /
path ';' select-expr /
path
path = api-identifier [ '/' path ]
'api-identifier' is defined in section 5.3.1.1.
';' is used to select multiple nodes. For example, to
retreive only the 'genre' and 'year' of an album, use:
'select=genre;year'.
Parentheses are used to specify sub-selectors of a node.
For example, to retreive only the 'label' and
'catalogue-number' of an album, use:
'select=admin(label;catalogue-number)'.
'/' is used in a path to retreive a child node of a node.
For example, to retreive only the 'label' of an album, use:
'select=admin/label'.
This parameter is only allowed for GET methods on api, This parameter is only allowed for GET methods on api,
datastore, and data resources. A 400 Bad Request error datastore, and data resources. A 400 Bad Request error
is returned if used for other methods or resource types. is returned if used for other methods or resource types.";
reference
If XPath: "RFC XXXX: [sec. 5.3.1.1 ABNF For Data Resource Identifiers]";
The string is an XPath expression that will be evaluated
using the target resource instance as the context node
and the document root. It is expected to return a node-set
result representing the descendants within the context
node that should be returned in a GET response.";
} }
leaf start-time { leaf start-time {
type yang:date-and-time; type yang:date-and-time;
description description
"The 'start-time' parameter is used to trigger "The 'start-time' parameter is used to trigger
the notification replay feature and indicate the notification replay feature and indicate
that the replay should start at the time specified. that the replay should start at the time specified.
If the stream does not support replay, per the If the stream does not support replay, per the
'replay-support' attribute returned by 'replay-support' attribute returned by
skipping to change at page 63, line 7 skipping to change at page 61, line 7
*/ */
} }
} // grouping notification } // grouping notification
} }
<CODE ENDS> <CODE ENDS>
8. IANA Considerations 8. IANA Considerations
8.1. YANG Module Registry 8.1. The "restconf" Relation Type
This specification registers the "restconf" relation type in the Link
Relation Type Registry defined by [RFC5988]:
Relation Name: restconf
Description: Identifies the root of RESTCONF API as configured
on this HTTP server. The "restconf" relation
defines the root of the API defined in RFCXXXX.
Subsequent revisions of RESTCONF will use alternate
relation values to support protocol versioning.
Reference: RFC XXXX
`
8.2. YANG Module Registry
This document registers one URI in the IETF XML registry [RFC3688]. This document registers one URI in the IETF XML registry [RFC3688].
Following the format in RFC 3688, the following registration is Following the format in RFC 3688, the following registration is
requested to be made. requested to be made.
URI: urn:ietf:params:xml:ns:yang:ietf-restconf URI: urn:ietf:params:xml:ns:yang:ietf-restconf
Registrant Contact: The NETMOD WG of the IETF. Registrant Contact: The NETMOD WG of the IETF.
XML: N/A, the requested URI is an XML namespace. XML: N/A, the requested URI is an XML namespace.
This document registers one YANG module in the YANG Module Names This document registers one YANG module in the YANG Module Names
registry [RFC6020]. registry [RFC6020].
name: ietf-restconf name: ietf-restconf
namespace: urn:ietf:params:xml:ns:yang:ietf-restconf namespace: urn:ietf:params:xml:ns:yang:ietf-restconf
prefix: rc prefix: rc
// RFC Ed.: replace XXXX with RFC number and remove this note // RFC Ed.: replace XXXX with RFC number and remove this note
reference: RFC XXXX reference: RFC XXXX
8.2. application/yang Media Sub Types 8.3. application/yang Media Sub Types
The parent MIME media type for RESTCONF resources is application/ The parent MIME media type for RESTCONF resources is application/
yang, which is defined in [RFC6020]. This document defines the yang, which is defined in [RFC6020]. This document defines the
following sub-types for this media type. following sub-types for this media type.
- api - api
- data - data
- datastore - datastore
- errors
- operation - operation
- stream - stream
Type name: application Type name: application
Subtype name: yang.xxx Subtype name: yang.xxx
Required parameters: TBD Required parameters: TBD
Optional parameters: TBD Optional parameters: TBD
skipping to change at page 65, line 7 skipping to change at page 63, line 7
Security considerations: TBD Security considerations: TBD
Interoperability considerations: TBD Interoperability considerations: TBD
// 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
9. Security Considerations 9. Security Considerations
TBD This section provides security considerations for the resources
defined by the RESTCONF protocol. Security considerations for HTTPS
are defined in [RFC2818]. Security considerations for the content
manipulated by RESTCONF can be found in the documents defining data
models.
This document does not specify an authentication scheme, but it does
require that an authenticated NETCONF username be associated with
each HTTP request. The authentication scheme MAY be implemented in
the underlying transport layer (e.g., client certificates) or within
the HTTP layer (e.g., Basic Auth, OAuth, etc.). RESTCONF does not
itself define an authentication mechanism, authentication MUST occur
in a lower layer. Implementors SHOULD provide a comprehensive
authorization scheme with RESTCONF and ensure that the resulting
NETCONF username is made available to the RESTCONF server.
Authorization of individual user access to operations and data MAY be
configured via NETCONF Access Control Model (NACM) [RFC6536], as
specified in Section 2. Other authorization models MAY be used, but
are outside of the scope of this document.
Configuration information is by its very nature sensitive. Its
transmission in the clear and without integrity checking leaves
devices open to classic eavesdropping and false data injection
attacks. Configuration information often contains passwords, user
names, service descriptions, and topological information, all of
which are sensitive. Because of this, this protocol SHOULD be
implemented carefully with adequate attention to all manner of attack
one might expect to experience with other management interfaces.
Different environments may well allow different rights prior to and
then after authentication. When an operation is not properly
authorized, the RESTCONF server MUST return HTTP error status code
401 Unauthorized. Note that authorization information can be
exchanged in the form of configuration information, which is all the
more reason to ensure the security of the connection.
10. References 10. References
10.1. Normative References 10.1. Normative References
[I-D.lhotka-netmod-json] [I-D.lhotka-netmod-json]
Lhotka, L., "Modeling JSON Text with YANG", Lhotka, L., "Modeling JSON Text with YANG",
draft-lhotka-netmod-yang-json-02 (work in progress), draft-lhotka-netmod-yang-json-02 (work in progress),
September 2013. September 2013.
[JSON] Bray, T., Ed., "The JSON Data Interchange Format", [JSON] Bray, T., Ed., "The JSON Data Interchange Format",
draft-ietf-json-rfc4627bis-10 (work in progress), draft-ietf-json-rfc4627bis-10 (work in progress),
December 2013. December 2013.
[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.
[RFC2246] Dierks, T. and C. Allen, "The TLS Protocol, Version 1.0",
RFC 2246, January 1999.
[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,
August 1998. August 1998.
[RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
[RFC2818] Rescorla, E., "The IETF XML Registry", RFC 2818, May 2000.
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
January 2004. January 2004.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, Resource Identifier (URI): Generic Syntax", STD 66,
RFC 3986, January 2005. RFC 3986, January 2005.
[RFC5277] Chisholm, S. and H. Trevino, "NETCONF Event [RFC5277] Chisholm, S. and H. Trevino, "NETCONF Event
Notifications", RFC 5277, July 2008. Notifications", RFC 5277, July 2008.
[RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
Housley, R., and T. Polk, "Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation List
(CRL) Profile", RFC 5280, May 2008.
[RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP", [RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP",
RFC 5789, March 2010. RFC 5789, March 2010.
[RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010.
[RFC6020] Bjorklund, M., "YANG - A Data Modeling Language for the [RFC6020] Bjorklund, M., "YANG - A Data Modeling Language for the
Network Configuration Protocol (NETCONF)", RFC 6020, Network Configuration Protocol (NETCONF)", RFC 6020,
October 2010. October 2010.
[RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
and A. Bierman, Ed., "Network Configuration Protocol and A. Bierman, Ed., "Network Configuration Protocol
(NETCONF)", RFC 6241, June 2011. (NETCONF)", RFC 6241, June 2011.
[RFC6415] Hammer-Lahav, E. and B. Cook, "Web Host Metadata",
RFC 6415, October 2011.
[RFC6536] Bierman, A. and M. Bjorklund, "Network Configuration [RFC6536] Bierman, A. and M. Bjorklund, "Network Configuration
Protocol (NETCONF) Access Control Model", RFC 6536, Protocol (NETCONF) Access Control Model", RFC 6536,
March 2012. March 2012.
[RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M.,
and D. Orchard, "URI Template", RFC 6570, March 2012.
[RFC6991] Schoenwaelder, J., "Common YANG Data Types", RFC 6991, [RFC6991] Schoenwaelder, J., "Common YANG Data Types", RFC 6991,
July 2013. July 2013.
[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>.
[get-off-my-lawn]
Nottingham, M., "URI Design and Ownership", Best Current
Practice draft-ietf-appsawg-uri-get-off-my-lawn-05,
May 2014.
[rest-dissertation]
Fielding, R., "Architectural Styles and the Design of
Network-based Software Architectures", 2000.
[wd-eventsource] [wd-eventsource]
Hickson, I., "Server-Sent Events", December 2012. Hickson, I., "Server-Sent Events", December 2012.
10.2. Informative References 10.2. Informative References
[XPath] Clark, J. and S. DeRose, "XML Path Language (XPath) [XPath] Clark, J. and S. DeRose, "XML Path Language (XPath)
Version 1.0", World Wide Web Consortium Version 1.0", World Wide Web Consortium
Recommendation REC-xpath-19991116, November 1999, Recommendation REC-xpath-19991116, November 1999,
<http://www.w3.org/TR/1999/REC-xpath-19991116>. <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.
A.1. bierman:restconf-04 to ietf:restconf-00 A.1. 00 - 01
o updated open issues section
Appendix B. Open Issues
-- RFC Ed.: remove this section before publication.
B.1. message-id
o There is no "message-id" field in a RESTCONF message. Is a
message identifier needed? If so, should either the "Message-ID"
or "Content-ID" header from RFC 2392 be used for this purpose?
Status: open
B.2. select parameter
o What syntax should be used for the "select" query parameter? The
current choices are "XPath" and "path-expr". Perhaps an
additional parameter to identify the select string format is
needed to allow extensibility?
Status: solution proposal pending from Martin
B.3. server support verification
o Are all header lines used by RESTCONF supported by common
application frameworks, such as FastCGI and WSGI? If not, then
should query parameters be used instead, since the QUERY_STRING is
widely available to WEB applications?
Status: closed
Resolution: no concern the methods or headers used by RESTCONF are
not widely supported.
B.4. error media type
o Should the <errors> element returned in error responses be a
separate media type?
Status: closed-update-needed; Consensus is that a new media type for
<errors> is needed.
B.5. additional datastores
o How should additional datastores be supported, which may be added
to the NETCONF/NETMOD framework in the future?
Status: closed
Resolution: Exposing the candidate and startup datastores is not
needed. A single unified datastore can probably be used for future
extensions, depending on how the future extension is designed.
B.6. PATCH media type discovery
o How does a client know which PATCH media types are supported by
the server in addition to application/yang.data and application/
yang.patch?
Status: closed-update-pending
Resolution: the Accept-Patch header defined in RFC 5789 needs to be
implemented by the server to advertise the media types supported for
PATCH.
B.7. RESTCONF version
o Is the /restconf/version field considered meta-data? Should it be
returned as XRD (Extensible Resource Descriptor)? In addition or
instead of the version field? Should this be the ietf-restconf
YANG module revision date, instead of the string 1.0?
Status: open
B.8. YANG to resource mapping o fixed content=nonconfig example (non-config was incorrect)
o Since data resources can only be YANG containers or lists, what o closed open issue 'message-id'. There is no need for a message-id
should be done about top-level YANG data nodes that are not field, and RFC 2392 does not apply.
containers or lists? Are they allowed in RESTCONF?
Status: closed o closed open issue 'server support verification'. The headers used
by RESTCONF are widely supported.
Resolution: top-level terminal nodes can be resources. Current o removed encoding rules from section on RESTCONF Meta-Data. This
definition of all levels are new sub-resources for server is now defined in [I-D.lhotka-netmod-json].
implementation purposes
o Can a choice be a resource? YANG choices are invisible to o added media type application/yang.errors to map to errors YANG
RESTCONF at this time. grouping. Updated error examples to use new media type.
Status: closed o closed open issue 'additional datastores'. Support may be added
in the future to identify new datastores.
Resolution: choices are not resources o closed open issue 'PATCH media type discovery'. The section on
PATCH has an added sentence on the Accept-Patch header.
B.9. .well-known usage o closed open issue 'YANG to resource mapping'. Current mapping of
o Does RESTCONF need to Use a .well-known link relation to to re-map all data nodes to resources will be used in order to allow
API entry point? mandatory DELETE support. The PATCH operation is optional, as
well as the YANG Patch media type.
The client first discovers the server's root for the RESTCONF API. o closed open issue '_self links for HATEOAS support'. It was
In this example, it is "/api/restconf": decided that they are redundant because they can be derived from
the YANG module for the specific data.
Request o added explanatory text for the 'select' parameter.
-------
GET /.well-known/host-meta users HTTP/1.1
Host: example.com
Accept: application/xrd+xml
Response o added RESTCONF Path Resolution section for discovering the root of
-------- the RESTCONF API using the /.well-known/host-meta.
HTTP/1.1 200 OK
Content-Type: application/xrd+xml
Content-Length: nnn
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'> o added an "error" media type to for structured error messages
<Link rel='restconf' href='/api/restconf'/>
</XRD>
Once discovering the RESTCONF API root, the client MUST prepend it to o added Secure Transport section requiring TLS
any access to a RESTCONF resource:
Request o added Security Considerations section
-------
GET /api/restconf/version HTTP/1.1
Host: example.com
Accept: application/yang.api+json
Response o removed all references to "REST-like"
--------
HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server
Cache-Control: no-cache
Pragma: no-cache
Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT
Content-Type: application/yang.api+json
{ "version": "1.0" } A.2. bierman:restconf-04 to ietf:restconf-00
Status: closed o updated open issues section
Resolution: this is not needed in RESTCONF Appendix B. Open Issues
B.10. _self links for HATEOAS support -- RFC Ed.: remove this section before publication.
o Should there be a mode where the client can request that the B.1. select parameter
resource identifier is returned in a GET request?
Status: closed o What syntax should be used for the "select" query parameter? The
current choices are "XPath" and "path-expr". Perhaps an
additional parameter to identify the select string format is
needed to allow extensibility?
Resultion: these links are not needed. RESTCONF is REST-like, not Status: solution proposal added by Martin.
REST-ful.
B.11. netconf-state monitoring support B.2. netconf-state monitoring support
o Should long-term RESTCONF operations (i.e. SSE long-poll) be o Should long-term RESTCONF operations (i.e. SSE long-poll) be
considered sessions with regards to NETCONF monitoring "session" considered sessions with regards to NETCONF monitoring "session"
list? If so, what text is needed in RESTCONF draft to standardize list? If so, what text is needed in RESTCONF draft to standardize
the RESTCONF session entries? the RESTCONF session entries?
Status: closed-update-pending Status: closed-update-pending
Resolution: Resolution:
A new data structure to monitor streams can be added to the netconf- A new data structure to monitor streams can be added to the netconf-
state sub-tree. The session-id in this new data structure is not state sub-tree. The session-id in this new data structure is not
restricted to the NETCONF-only rules for the sessions sub-tree. restricted to the NETCONF-only rules for the sessions sub-tree.
B.12. secure transport B.3. secure transport
o Details to support secure operation over TLS are needed o Details to support secure operation over TLS are needed
Status: open Status: closed
o Security considerations need to be written o Security considerations need to be written
Status: open Status: closed
o Can call-home for RESTCONF be supported o Can call-home for RESTCONF be supported
Status: open Status: open
B.13. Encoding of key leafs in resource URIs B.4. Encoding of key leafs in resource URIs
o The use of a forward slash '/' as the delimiter between key values o The use of a forward slash '/' as the delimiter between key values
in a target resource URI is not not desirable. Only 1 segment per in a target resource URI is not not desirable. Only 1 segment per
YANG data node layer should be used. YANG data node layer should be used.
Status: closed-update-pending Status: open
Resolution: Proposals:
Example: list foo, int8 keys X and Y Example: list foo, int8 keys X and Y
Old: Old:
/restconf/datastore/foo/19/22/foo-leaf /restconf/data/foo/19/22/foo-leaf
New: New:
/restconf/datastore/foo=19,22/foo-leaf /restconf/data/foo=19,22/foo-leaf
B.14. get-bulk query parameters Or:
/restconf/data/foo/19,22/foo-leaf
B.5. get-bulk query parameters
o New query parameters (e.g., offset, limit) are needed to retrieve o New query parameters (e.g., offset, limit) are needed to retrieve
a limited number of list instances. a limited number of list instances.
Status: solution proposal pending Status: solution proposal pending
Resolution: This bulk retrieval mechanism will be added. Resolution: This bulk retrieval mechanism will be added.
B.15. JSON encoding of meta-data B.6. defaults handling
o Should the encoding rules for protocol meta-data be moved to the o The client does not really know what sort of defaults the server
YANG to JSON draft? will return in GET replies. Should the with-defaults query
parameter be added to RESTCONF? If so, should it be mandatory-to-
implement?
Status: open
B.7. protocol capability URIs
o The client does not know what vendor extensions (if any) are
implemented by the server. Should the server provide a read-only
container of capability URIs to identify protocol extensions? The
NETMOD WG may also want to extend the protocol in the future
without updating the core RESTCONF RFC.
Status: open
B.8. target resource list keys required for GET
o Should the client be able to GET all or a subset of all list
instances by issuing a GET without any list keys for the target
resource list?
GET /restconf/data/interfaces/interface
o Should a "collection" resource be required in order for such a
request to be considered valid by the server.
Status: open Status: open
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 label? 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
skipping to change at page 74, line 47 skipping to change at page 72, line 4
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; } 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 "2013-12-21" { revision "2014-07-03" {
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 {
skipping to change at page 76, line 47 skipping to change at page 74, line 4
"The genre identifying the type of music on "The genre identifying the type of music on
the album."; the album.";
} }
leaf year { leaf year {
type uint16 { type uint16 {
range "1900 .. max"; range "1900 .. max";
} }
description "The year the album was released"; description "The year the album was released";
} }
container admin {
description
"Administrative information for the album.";
leaf label {
type string;
description "The label that released the album.";
}
leaf catalogue-number {
type string;
description "The album's catalogue number.";
}
}
list song { list song {
key name; key name;
description description
"Represents one song resource within one "Represents one song resource within one
album resource, within the jukebox library."; album resource, within the jukebox library.";
leaf name { leaf name {
type string { type string {
skipping to change at page 80, line 18 skipping to change at page 77, line 18
defined in Section 7 and the non-normative example YANG module defined in Section 7 and the non-normative example YANG module
defined in Appendix C.1. defined in Appendix C.1.
This section shows some typical RESTCONF message exchanges. This section shows some typical RESTCONF message exchanges.
D.1. Resource Retrieval Examples D.1. Resource Retrieval Examples
D.1.1. Retrieve the Top-level API Resource D.1.1. Retrieve the Top-level API Resource
The client may start by retrieving the top-level API resource, using The client may start by retrieving the top-level API resource, using
the entry point URI "/restconf". the entry point URI "{+restconf}".
GET /restconf HTTP/1.1 GET /restconf HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.api+json Accept: application/yang.api+json,
application/yang.errors+json
The server might respond as follows: The server might respond as follows:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server Server: example-server
Content-Type: application/yang.api+json Content-Type: application/yang.api+json
{ {
"ietf-restconf:restconf": { "ietf-restconf:restconf": {
"data" : [ null ], "data" : [ null ],
"modules": { "modules": {
"module": [ "module": [
{ {
"name" : "example-jukebox", "name" : "example-jukebox",
"revision" : "2013-12-21", "revision" : "2014-07-03",
"namespace" : "http://example.com/ns/example-jukebox", "namespace" : "http://example.com/ns/example-jukebox",
"schema" : [ null ] "schema" : [ null ]
} }
] ]
}, },
"operations" : { "operations" : {
"play" : [ null ] "play" : [ null ]
}, },
"streams" : { "streams" : {
"stream" : [ "stream" : [
{ {
"name" : "NETCONF", "name" : "NETCONF",
"description" : "default NETCONF event stream", "description" : "default NETCONF event stream",
"replay-support" : true, "replay-support" : true,
"replay-log-creation-time:" : "2007-07-08T00:00:00Z", "replay-log-creation-time:" : "2007-07-08T00:00:00Z",
"events" : [ null ] "events" : [ null ]
} }
] ]
}, }
"version": "1.0"
} }
} }
To request that the response content to be encoded in XML, the To request that the response content to be encoded in XML, the
"Accept" header can be used, as in this example request: "Accept" header can be used, as in this example request:
GET /restconf HTTP/1.1 GET /restconf HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.api+xml Accept: application/yang.api+xml,
application/yang.errors+xml
The server will return the same response either way, which might be The server will return the same response either way, which might be
as follows : as follows :
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Content-Type: application/yang.api+xml Content-Type: application/yang.api+xml
<restconf xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"> <restconf xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<data/> <data/>
<modules> <modules>
<module> <module>
<name>example-jukebox</name> <name>example-jukebox</name>
<revision>2013-12-21</revision> <revision>2014-07-03</revision>
<namespace> <namespace>
http://example.com/ns/example-jukebox http://example.com/ns/example-jukebox
</namespace> </namespace>
<schema /> <schema />
</module> </module>
</modules> </modules>
<operations> <operations>
<play xmlns="http://example.com/ns/example-jukebox"/> <play xmlns="http://example.com/ns/example-jukebox"/>
</operations> </operations>
<streams> <streams>
skipping to change at page 82, line 39 skipping to change at page 79, line 39
<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>
<events/> <events/>
</stream> </stream>
</streams> </streams>
<version>1.0</version>
</restconf> </restconf>
D.1.2. Retrieve The Server Module Information D.1.2. Retrieve The Server Module Information
In this example the client is retrieving the modules resource from In this example the client is retrieving the modules resource from
the server in JSON format: the server in JSON format:
GET /restconf/modules HTTP/1.1 GET /restconf/modules HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.api+json Accept: application/yang.api+json,
application/yang.errors+json
The server might respond as follows. The server might respond as follows.
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT
Content-Type: application/yang.api+json Content-Type: application/yang.api+json
skipping to change at page 84, line 29 skipping to change at page 81, line 29
} }
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: http://example.com/restconf/data/ Location: http://example.com/restconf/data/
example-jukebox:jukebox/library/artist/Foo%20Fighters example-jukebox:jukebox/library/artist=Foo%20Fighters
Last-Modified: Mon, 23 Apr 2012 17:02:00 GMT Last-Modified: Mon, 23 Apr 2012 17:02:00 GMT
ETag: b3830f23a4c ETag: b3830f23a4c
To create a new "album" resource for this artist within the "jukebox" To create a new "album" resource for this artist within the "jukebox"
resource, the client might send the following request. Note that the resource, the client might send the following request. Note that the
request URI header line is wrapped for display purposes only: request URI header line is wrapped for display purposes only:
POST /restconf/data/example-jukebox:jukebox/ POST /restconf/data/example-jukebox:jukebox/
library/artist/Foo%20Fighters HTTP/1.1 library/artist=Foo%20Fighters HTTP/1.1
Host: example.com Host: example.com
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"example-jukebox:album" : { "example-jukebox:album" : {
"name" : "Wasting Light", "name" : "Wasting Light",
"genre" : "example-jukebox:alternative", "genre" : "example-jukebox:alternative",
"year" : 2012 # note this is the wrong date "year" : 2012 # note this is the wrong date
} }
} }
If the resource is created, the server might respond as follows. If the resource is created, the server might respond as follows.
Note that the "Location" header line is wrapped for display purposes Note that the "Location" header line is wrapped for display purposes
only: only:
HTTP/1.1 201 Created HTTP/1.1 201 Created
Date: Mon, 23 Apr 2012 17:03:00 GMT Date: Mon, 23 Apr 2012 17:03:00 GMT
Server: example-server Server: example-server
Location: http://example.com/restconf/data/ Location: http://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 Accept: application/yang.data+json,
application/yang.errors+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.3. Query String Parameter Examples D.3. Query String Parameter Examples
D.3.1. "content" Parameter D.3.1. "content" Parameter
The "content" parameter is used to select the type of data sub- 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 sub-resources. configuration child resources.
container events container events
list event { list event {
key name; key name;
leaf name { type string; } leaf name { type string; }
leaf description { type string; } leaf description { type string; }
leaf event-count { leaf event-count {
type uint32; type uint32;
config false; config false;
} }
} }
} }
Example 1: content=all Example 1: content=all
To retrieve all the sub-resources, the "content" parameter is set to To retrieve all the child resources, the "content" parameter is set
"all". The client might send: to "all". The client might send:
GET /restconf/data/example-events:events?content=all GET /restconf/data/example-events:events?content=all
HTTP/1.1 HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+json Accept: application/yang.data+json,
application/yang.errors+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:11:30 GMT Date: Mon, 23 Apr 2012 17:11:30 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
skipping to change at page 87, line 7 skipping to change at page 84, line 7
"name" : "interface-down", "name" : "interface-down",
"description" : "Interface down notification count", "description" : "Interface down notification count",
"event-count" : 4 "event-count" : 4
} }
] ]
} }
} }
Example 2: content=config Example 2: content=config
To retrieve only the configuration sub-resources, the "content" To retrieve only the configuration child resources, the "content"
parameter is set to "config" or omitted since this is the default parameter is set to "config" or omitted since this is the default
value. Note that the "ETag" and "Last-Modified" headers are only value. Note that the "ETag" and "Last-Modified" headers are only
returned if the content parameter value is "config". returned if the content parameter value is "config".
GET /restconf/data/example-events:events?content=config GET /restconf/data/example-events:events?content=config
HTTP/1.1 HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+json Accept: application/yang.data+json,
application/yang.errors+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:11:30 GMT Date: Mon, 23 Apr 2012 17:11:30 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT
ETag: eeeada438af ETag: eeeada438af
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
skipping to change at page 87, line 43 skipping to change at page 84, line 44
"description" : "Interface up notification count" "description" : "Interface up notification count"
}, },
{ {
"name" : "interface-down", "name" : "interface-down",
"description" : "Interface down notification count" "description" : "Interface down notification count"
} }
] ]
} }
} }
Example 3: content=non-config Example 3: content=nonconfig
To retrieve only the non-configuration sub-resources, the "content" To retrieve only the non-configuration child resources, the "content"
parameter is set to "non-config". Note that configuration ancestors parameter is set to "nonconfig". Note that configuration ancestors
(if any) and list key leafs (if any) are also returned. The client (if any) and list key leafs (if any) are also returned. The client
might send: might send:
GET /restconf/data/example-events:events?content=non-config GET /restconf/data/example-events:events?content=nonconfig
HTTP/1.1 HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+json Accept: application/yang.data+json,
application/yang.errors+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:11:30 GMT Date: Mon, 23 Apr 2012 17:11:30 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
skipping to change at page 88, line 32 skipping to change at page 85, line 37
{ {
"name" : "interface-down", "name" : "interface-down",
"event-count" : 4 "event-count" : 4
} }
] ]
} }
} }
D.3.2. "depth" Parameter D.3.2. "depth" Parameter
The "depth" parameter is used to limit the number of levels of sub- 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.
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 sub-resources, the "depth" parameter is not To retrieve all the child resources, the "depth" parameter is not
present or set to the default value "unbounded". Note that some present or set to the default value "unbounded". Note that some
strings are wrapped for display purposes only. strings are wrapped for display purposes only.
GET /restconf/data/example-jukebox:jukebox?depth=unbounded GET /restconf/data/example-jukebox:jukebox?depth=unbounded
HTTP/1.1 HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+json Accept: application/yang.data+json,
application/yang.errors+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:11:30 GMT Date: Mon, 23 Apr 2012 17:11:30 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
skipping to change at page 90, line 29 skipping to change at page 87, line 37
} }
} }
Example 2: depth=1 Example 2: depth=1
To determine if 1 or more resource instances exist for a given target To determine if 1 or more resource instances exist for a given target
resource, the value "1" is used. resource, the value "1" is used.
GET /restconf/data/example-jukebox:jukebox?depth=1 HTTP/1.1 GET /restconf/data/example-jukebox:jukebox?depth=1 HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+json Accept: application/yang.data+json,
application/yang.errors+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:11:30 GMT Date: Mon, 23 Apr 2012 17:11:30 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"example-jukebox:jukebox" : [null] "example-jukebox:jukebox" : [null]
} }
Example 3: depth=3 Example 3: depth=3
To limit the depth level to the target resource plus 2 sub-resource To limit the depth level to the target resource plus 2 child resource
layers the value "3" is used. layers the value "3" is used.
GET /restconf/data/example-jukebox:jukebox?depth=3 HTTP/1.1 GET /restconf/data/example-jukebox:jukebox?depth=3 HTTP/1.1
Host: example.com Host: example.com
Accept: application/yang.data+json Accept: application/yang.data+json,
application/yang.errors+json
The server might respond: The server might respond:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:11:30 GMT Date: Mon, 23 Apr 2012 17:11:30 GMT
Server: example-server Server: example-server
Cache-Control: no-cache Cache-Control: no-cache
Pragma: no-cache Pragma: no-cache
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
skipping to change at page 92, line 6 skipping to change at page 89, line 6
} }
} }
} }
D.3.3. "filter" Parameter D.3.3. "filter" Parameter
The following URIs show some examples of notification filter The following URIs show some examples of notification filter
specifications (lines wrapped for display purposes only): specifications (lines wrapped for display purposes only):
// filter = /event/eventClass='fault' // filter = /event/eventClass='fault'
GET /restconf/streams/stream/NETCONF/events? GET /restconf/streams/stream=NETCONF/events?
filter=%2Fevent%2FeventClass%3D'fault' filter=%2Fevent%2FeventClass%3D'fault'
// filter = /event/severityCode<=4 // filter = /event/severityCode<=4
GET /restconf/streams/stream/NETCONF/events? GET /restconf/streams/stream=NETCONF/events?
filter=%2Fevent%2FseverityCode%3C%3D4 filter=%2Fevent%2FseverityCode%3C%3D4
// filter = /linkUp|/linkDown // filter = /linkUp|/linkDown
GET /restconf/streams/stream/SNMP/events? GET /restconf/streams/stream=SNMP/events?
filter=%2FlinkUp%7C%2FlinkDown filter=%2FlinkUp%7C%2FlinkDown
// filter = /*/reportingEntity/card!='Ethernet0' // filter = /*/reportingEntity/card!='Ethernet0'
GET /restconf/streams/stream/NETCONF/events? GET /restconf/streams/stream=NETCONF/events?
filter=%2F*%2FreportingEntity%2Fcard%21%3D'Ethernet0' filter=%2F*%2FreportingEntity%2Fcard%21%3D'Ethernet0'
// filter = /*/email-addr[contains(.,'company.com')] // filter = /*/email-addr[contains(.,'company.com')]
GET /restconf/streams/stream/critical-syslog/events? GET /restconf/streams/stream=critical-syslog/events?
filter=%2F*%2Femail-addr[contains(.%2C'company.com')] filter=%2F*%2Femail-addr[contains(.%2C'company.com')]
// Note: the module name is used as prefix. // Note: the module name is used as prefix.
// filter = (/example-mod:event1/name='joe' and // filter = (/example-mod:event1/name='joe' and
// /example-mod:event1/status='online') // /example-mod:event1/status='online')
GET /restconf/streams/stream/NETCONF/events? GET /restconf/streams/stream=NETCONF/events?
filter=(%2Fexample-mod%3Aevent1%2Fname%3D'joe'%20and filter=(%2Fexample-mod%3Aevent1%2Fname%3D'joe'%20and
%20%2Fexample-mod%3Aevent1%2Fstatus%3D'online') %20%2Fexample-mod%3Aevent1%2Fstatus%3D'online')
D.3.4. "insert" Parameter D.3.4. "insert" Parameter
In this example, a new first entry in the "Foo-One" playlist is being In this example, a new first entry in the "Foo-One" playlist is being
created. created.
Request from client: Request from client:
POST /restconf/data/example-jukebox:jukebox/ POST /restconf/data/example-jukebox:jukebox/
playlist/Foo-One?insert=first HTTP/1.1 playlist=Foo-One?insert=first HTTP/1.1
Host: example.com Host: example.com
Content-Type: application/yang.data+json Content-Type: application/yang.data+json
{ {
"example-jukebox:song" : { "example-jukebox:song" : {
"index" : 1, "index" : 1,
"id" : "/example-jukebox:jukebox/library/artist/ "id" : "/example-jukebox:jukebox/library/artist/
Foo%20Fighters/album/Wasting%20Light/song/Rope" Foo%20Fighters/album/Wasting%20Light/song/Rope"
} }
} }
Response from server: Response from server:
HTTP/1.1 201 Created HTTP/1.1 201 Created
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Mon, 23 Apr 2012 13:01:20 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT
Location: http://example.com/restconf/data/ Location: http://example.com/restconf/data/
example-jukebox:jukebox/playlist/Foo-One/song/1 example-jukebox:jukebox/playlist=Foo-One/song=1
ETag: eeeada438af ETag: eeeada438af
D.3.5. "point" Parameter D.3.5. "point" Parameter
Example: Example:
In this example, the client is inserting a new "song" resource within In this example, the client is inserting a new "song" resource within
an "album" resource after another song. The request URI is split for an "album" resource after another song. The request URI is split for
display purposes only. display purposes only.
skipping to change at page 93, line 50 skipping to change at page 90, line 50
Response from server: Response from server:
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Date: Mon, 23 Apr 2012 13:01:20 GMT Date: Mon, 23 Apr 2012 13:01:20 GMT
Server: example-server Server: example-server
Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT
ETag: abcada438af ETag: abcada438af
D.3.6. "select" Parameter D.3.6. "select" Parameter
TBD In this example the client is retrieving the API resource, but
selecting only the "name" and "revision" nodes from each module, in
JSON format:
GET /restconf?select=modules/module(name;revision) HTTP/1.1
Host: example.com
Accept: application/yang.api+json,
application/yang.errors+json
The server might respond as follows.
HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server
Content-Type: application/yang.api+json
{
"ietf-restconf:restconf": {
"modules": {
"module": [
{
"name" : "example-jukebox",
"revision" : "2014-07-03"
}
]
}
}
}
D.3.7. "start-time" Parameter D.3.7. "start-time" Parameter
TBD TBD
D.3.8. "stop-time" Parameter D.3.8. "stop-time" Parameter
TBD TBD
Authors' Addresses Authors' Addresses
 End of changes. 232 change blocks. 
648 lines changed or deleted 693 lines changed or added

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