--- 1/draft-ietf-netconf-restconf-07.txt 2015-10-18 13:16:22.004336488 -0700
+++ 2/draft-ietf-netconf-restconf-08.txt 2015-10-18 13:16:22.368345365 -0700
@@ -1,21 +1,21 @@
Network Working Group A. Bierman
Internet-Draft YumaWorks
Intended status: Standards Track M. Bjorklund
-Expires: January 7, 2016 Tail-f Systems
+Expires: April 20, 2016 Tail-f Systems
K. Watsen
Juniper Networks
- July 6, 2015
+ October 18, 2015
RESTCONF Protocol
- draft-ietf-netconf-restconf-07
+ draft-ietf-netconf-restconf-08
Abstract
This document describes an HTTP-based protocol that provides a
programmatic interface for accessing data defined in YANG, using the
datastores defined in NETCONF.
Status of This Memo
This Internet-Draft is submitted in full conformance with the
@@ -24,195 +24,198 @@
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
- This Internet-Draft will expire on January 7, 2016.
+ This Internet-Draft will expire on April 20, 2016.
Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Table of Contents
- 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4
+ 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1. Simple Subset of NETCONF Functionality . . . . . . . . . 5
1.2. Data Model Driven API . . . . . . . . . . . . . . . . . . 6
1.3. Coexistence with NETCONF . . . . . . . . . . . . . . . . 7
1.4. Terminology . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.1. NETCONF . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.2. HTTP . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.3. YANG . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4.4. Terms . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4.5. URI Template . . . . . . . . . . . . . . . . . . . . 11
1.4.6. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 11
2. Transport Protocol Requirements . . . . . . . . . . . . . . . 12
2.1. Integrity and Confidentiality . . . . . . . . . . . . . . 12
2.2. HTTPS with X.509v3 Certificates . . . . . . . . . . . . . 12
2.3. Certificate Validation . . . . . . . . . . . . . . . . . 12
- 2.4. Authenticated Server Identity . . . . . . . . . . . . . . 12
- 2.5. Authenticated Client Identity . . . . . . . . . . . . . . 12
+ 2.4. Authenticated Server Identity . . . . . . . . . . . . . . 13
+ 2.5. Authenticated Client Identity . . . . . . . . . . . . . . 13
3. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.1. Root Resource Discovery . . . . . . . . . . . . . . . . . 14
3.2. RESTCONF Resource Types . . . . . . . . . . . . . . . . . 15
- 3.3. API Resource . . . . . . . . . . . . . . . . . . . . . . 15
+ 3.3. API Resource . . . . . . . . . . . . . . . . . . . . . . 16
3.3.1. {+restconf}/data . . . . . . . . . . . . . . . . . . 16
3.3.2. {+restconf}/operations . . . . . . . . . . . . . . . 17
3.4. Datastore Resource . . . . . . . . . . . . . . . . . . . 17
3.4.1. Edit Collision Detection . . . . . . . . . . . . . . 18
3.5. Data Resource . . . . . . . . . . . . . . . . . . . . . . 18
3.5.1. Encoding Data Resource Identifiers in the Request URI 19
3.5.2. Defaults Handling . . . . . . . . . . . . . . . . . . 22
3.6. Operation Resource . . . . . . . . . . . . . . . . . . . 22
3.6.1. Encoding Operation Input Parameters . . . . . . . . . 23
3.6.2. Encoding Operation Output Parameters . . . . . . . . 24
3.6.3. Encoding Operation Errors . . . . . . . . . . . . . . 25
- 3.7. Schema Resource . . . . . . . . . . . . . . . . . . . . . 25
- 3.8. Event Stream Resource . . . . . . . . . . . . . . . . . . 26
+ 3.7. Schema Resource . . . . . . . . . . . . . . . . . . . . . 26
+ 3.8. Event Stream Resource . . . . . . . . . . . . . . . . . . 27
3.9. Errors Media Type . . . . . . . . . . . . . . . . . . . . 27
4. Operations . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.1. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . 28
- 4.3. GET . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
- 4.4. POST . . . . . . . . . . . . . . . . . . . . . . . . . . 29
+ 4.3. GET . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
+ 4.4. POST . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.4.1. Create Resource Mode . . . . . . . . . . . . . . . . 30
4.4.2. Invoke Operation Mode . . . . . . . . . . . . . . . . 31
- 4.5. PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
- 4.6. PATCH . . . . . . . . . . . . . . . . . . . . . . . . . . 32
+ 4.5. PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
+ 4.6. PATCH . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.6.1. Plain Patch . . . . . . . . . . . . . . . . . . . . . 33
4.7. DELETE . . . . . . . . . . . . . . . . . . . . . . . . . 34
- 4.8. Query Parameters . . . . . . . . . . . . . . . . . . . . 34
- 4.8.1. The "content" Query Parameter . . . . . . . . . . . . 35
+ 4.8. Query Parameters . . . . . . . . . . . . . . . . . . . . 35
+ 4.8.1. The "content" Query Parameter . . . . . . . . . . . . 36
4.8.2. The "depth" Query Parameter . . . . . . . . . . . . . 36
- 4.8.3. The "fields" Query Parameter . . . . . . . . . . . . 36
- 4.8.4. The "insert" Query Parameter . . . . . . . . . . . . 37
+ 4.8.3. The "fields" Query Parameter . . . . . . . . . . . . 37
+ 4.8.4. The "insert" Query Parameter . . . . . . . . . . . . 38
4.8.5. The "point" Query Parameter . . . . . . . . . . . . . 38
- 4.8.6. The "filter" Query Parameter . . . . . . . . . . . . 38
+ 4.8.6. The "filter" Query Parameter . . . . . . . . . . . . 39
4.8.7. The "start-time" Query Parameter . . . . . . . . . . 39
4.8.8. The "stop-time" Query Parameter . . . . . . . . . . . 40
- 4.8.9. The "with-defaults" Query Parameter . . . . . . . . . 40
- 5. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 41
- 5.1. Request URI Structure . . . . . . . . . . . . . . . . . . 41
+ 4.8.9. The "with-defaults" Query Parameter . . . . . . . . . 41
+ 5. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 42
+ 5.1. Request URI Structure . . . . . . . . . . . . . . . . . . 42
5.2. Message Headers . . . . . . . . . . . . . . . . . . . . . 43
5.3. Message Encoding . . . . . . . . . . . . . . . . . . . . 44
5.4. RESTCONF Meta-Data . . . . . . . . . . . . . . . . . . . 44
- 5.5. Return Status . . . . . . . . . . . . . . . . . . . . . . 44
- 5.6. Message Caching . . . . . . . . . . . . . . . . . . . . . 45
- 6. Notifications . . . . . . . . . . . . . . . . . . . . . . . . 45
- 6.1. Server Support . . . . . . . . . . . . . . . . . . . . . 45
- 6.2. Event Streams . . . . . . . . . . . . . . . . . . . . . . 45
+ 5.4.1. XML MetaData Encoding Example . . . . . . . . . . . . 45
+ 5.4.2. JSON MetaData Encoding Example . . . . . . . . . . . 45
+ 5.5. Return Status . . . . . . . . . . . . . . . . . . . . . . 46
+ 5.6. Message Caching . . . . . . . . . . . . . . . . . . . . . 46
+ 6. Notifications . . . . . . . . . . . . . . . . . . . . . . . . 47
+ 6.1. Server Support . . . . . . . . . . . . . . . . . . . . . 47
+ 6.2. Event Streams . . . . . . . . . . . . . . . . . . . . . . 47
6.3. Subscribing to Receive Notifications . . . . . . . . . . 48
- 6.3.1. NETCONF Event Stream . . . . . . . . . . . . . . . . 49
- 6.4. Receiving Event Notifications . . . . . . . . . . . . . . 49
- 7. Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 51
- 7.1. Error Response Message . . . . . . . . . . . . . . . . . 53
- 8. RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 55
- 9. RESTCONF Monitoring . . . . . . . . . . . . . . . . . . . . . 61
- 9.1. restconf-state/capabilities . . . . . . . . . . . . . . . 61
- 9.1.1. Query Parameter URIs . . . . . . . . . . . . . . . . 62
- 9.1.2. The "defaults" Protocol Capability URI . . . . . . . 62
- 9.2. restconf-state/streams . . . . . . . . . . . . . . . . . 63
- 9.3. RESTCONF Monitoring Module . . . . . . . . . . . . . . . 63
- 10. YANG Module Library . . . . . . . . . . . . . . . . . . . . . 67
- 10.1. modules . . . . . . . . . . . . . . . . . . . . . . . . 67
- 10.1.1. modules/module . . . . . . . . . . . . . . . . . . . 68
- 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 68
- 11.1. The "restconf" Relation Type . . . . . . . . . . . . . . 68
- 11.2. YANG Module Registry . . . . . . . . . . . . . . . . . . 68
- 11.3. application/yang Media Sub Types . . . . . . . . . . . . 69
- 11.4. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 70
+ 6.3.1. NETCONF Event Stream . . . . . . . . . . . . . . . . 50
+ 6.4. Receiving Event Notifications . . . . . . . . . . . . . . 50
+ 7. Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 52
+ 7.1. Error Response Message . . . . . . . . . . . . . . . . . 54
+ 8. RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 56
+ 9. RESTCONF Monitoring . . . . . . . . . . . . . . . . . . . . . 62
+ 9.1. restconf-state/capabilities . . . . . . . . . . . . . . . 62
+ 9.1.1. Query Parameter URIs . . . . . . . . . . . . . . . . 63
+ 9.1.2. The "defaults" Protocol Capability URI . . . . . . . 63
+ 9.2. restconf-state/streams . . . . . . . . . . . . . . . . . 64
+ 9.3. RESTCONF Monitoring Module . . . . . . . . . . . . . . . 64
+ 10. YANG Module Library . . . . . . . . . . . . . . . . . . . . . 68
+ 10.1. modules . . . . . . . . . . . . . . . . . . . . . . . . 68
+ 10.1.1. modules/module . . . . . . . . . . . . . . . . . . . 69
+ 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 69
+ 11.1. The "restconf" Relation Type . . . . . . . . . . . . . . 69
+ 11.2. YANG Module Registry . . . . . . . . . . . . . . . . . . 69
+ 11.3. application/yang Media Sub Types . . . . . . . . . . . . 70
+ 11.4. RESTCONF Capability URNs . . . . . . . . . . . . . . . . 71
12. Security Considerations . . . . . . . . . . . . . . . . . . . 71
13. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 72
- 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 72
- 14.1. Normative References . . . . . . . . . . . . . . . . . . 72
- 14.2. Informative References . . . . . . . . . . . . . . . . . 75
-
- Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 75
- A.1. 06 - 07 . . . . . . . . . . . . . . . . . . . . . . . . . 75
- A.2. 05 - 06 . . . . . . . . . . . . . . . . . . . . . . . . . 76
- A.3. 04 - 05 . . . . . . . . . . . . . . . . . . . . . . . . . 76
- A.4. 03 - 04 . . . . . . . . . . . . . . . . . . . . . . . . . 76
- A.5. 02 - 03 . . . . . . . . . . . . . . . . . . . . . . . . . 77
- A.6. 01 - 02 . . . . . . . . . . . . . . . . . . . . . . . . . 78
- A.7. 00 - 01 . . . . . . . . . . . . . . . . . . . . . . . . . 78
- A.8. bierman:restconf-04 to ietf:restconf-00 . . . . . . . . . 79
- Appendix B. Open Issues . . . . . . . . . . . . . . . . . . . . 79
- Appendix C. Example YANG Module . . . . . . . . . . . . . . . . 80
- C.1. example-jukebox YANG Module . . . . . . . . . . . . . . . 80
- Appendix D. RESTCONF Message Examples . . . . . . . . . . . . . 86
- D.1. Resource Retrieval Examples . . . . . . . . . . . . . . . 86
- D.1.1. Retrieve the Top-level API Resource . . . . . . . . . 86
- D.1.2. Retrieve The Server Module Information . . . . . . . 87
- D.1.3. Retrieve The Server Capability Information . . . . . 88
- D.2. Edit Resource Examples . . . . . . . . . . . . . . . . . 89
- D.2.1. Create New Data Resources . . . . . . . . . . . . . . 89
- D.2.2. Detect Resource Entity Tag Change . . . . . . . . . . 90
- D.2.3. Edit a Datastore Resource . . . . . . . . . . . . . . 91
- D.3. Query Parameter Examples . . . . . . . . . . . . . . . . 92
- D.3.1. "content" Parameter . . . . . . . . . . . . . . . . . 92
- D.3.2. "depth" Parameter . . . . . . . . . . . . . . . . . . 95
- D.3.3. "fields" Parameter . . . . . . . . . . . . . . . . . 98
- D.3.4. "insert" Parameter . . . . . . . . . . . . . . . . . 99
+ 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 73
+ 14.1. Normative References . . . . . . . . . . . . . . . . . . 73
+ 14.2. Informative References . . . . . . . . . . . . . . . . . 76
+ Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 76
+ A.1. 07 - 08 . . . . . . . . . . . . . . . . . . . . . . . . . 76
+ A.2. 06 - 07 . . . . . . . . . . . . . . . . . . . . . . . . . 76
+ A.3. 05 - 06 . . . . . . . . . . . . . . . . . . . . . . . . . 77
+ A.4. 04 - 05 . . . . . . . . . . . . . . . . . . . . . . . . . 77
+ A.5. 03 - 04 . . . . . . . . . . . . . . . . . . . . . . . . . 78
+ A.6. 02 - 03 . . . . . . . . . . . . . . . . . . . . . . . . . 78
+ A.7. 01 - 02 . . . . . . . . . . . . . . . . . . . . . . . . . 79
+ A.8. 00 - 01 . . . . . . . . . . . . . . . . . . . . . . . . . 80
+ A.9. bierman:restconf-04 to ietf:restconf-00 . . . . . . . . . 80
+ Appendix B. Open Issues . . . . . . . . . . . . . . . . . . . . 81
+ Appendix C. Example YANG Module . . . . . . . . . . . . . . . . 81
+ C.1. example-jukebox YANG Module . . . . . . . . . . . . . . . 82
+ Appendix D. RESTCONF Message Examples . . . . . . . . . . . . . 87
+ D.1. Resource Retrieval Examples . . . . . . . . . . . . . . . 87
+ D.1.1. Retrieve the Top-level API Resource . . . . . . . . . 87
+ D.1.2. Retrieve The Server Module Information . . . . . . . 88
+ D.1.3. Retrieve The Server Capability Information . . . . . 89
+ D.2. Edit Resource Examples . . . . . . . . . . . . . . . . . 90
+ D.2.1. Create New Data Resources . . . . . . . . . . . . . . 90
+ D.2.2. Detect Resource Entity Tag Change . . . . . . . . . . 91
+ D.2.3. Edit a Datastore Resource . . . . . . . . . . . . . . 92
+ D.3. Query Parameter Examples . . . . . . . . . . . . . . . . 93
+ D.3.1. "content" Parameter . . . . . . . . . . . . . . . . . 93
+ D.3.2. "depth" Parameter . . . . . . . . . . . . . . . . . . 96
+ D.3.3. "fields" Parameter . . . . . . . . . . . . . . . . . 99
+ D.3.4. "insert" Parameter . . . . . . . . . . . . . . . . . 100
D.3.5. "point" Parameter . . . . . . . . . . . . . . . . . . 100
D.3.6. "filter" Parameter . . . . . . . . . . . . . . . . . 101
- D.3.7. "start-time" Parameter . . . . . . . . . . . . . . . 101
- D.3.8. "stop-time" Parameter . . . . . . . . . . . . . . . . 101
+ D.3.7. "start-time" Parameter . . . . . . . . . . . . . . . 102
+ D.3.8. "stop-time" Parameter . . . . . . . . . . . . . . . . 102
D.3.9. "with-defaults" Parameter . . . . . . . . . . . . . . 102
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 103
1. Introduction
There is a need for standard mechanisms to allow Web applications to
access the configuration data, operational data, data-model specific
protocol operations, and event notifications within a networking
device, in a modular and extensible manner.
This document describes an HTTP [RFC7230] based protocol called
- RESTCONF, for accessing data defined in YANG [RFC6020], using
- datastores defined in NETCONF [RFC6241].
+ RESTCONF, for accessing data defined in YANG version 1 [RFC6020] or
+ YANG version 1.1 [I-D.ietf-netmod-rfc6020bis], using datastores
+ defined in NETCONF [RFC6241].
The NETCONF protocol defines configuration datastores and a set of
Create, Retrieve, Update, Delete (CRUD) operations that can be used
to access these datastores. The YANG language defines the syntax and
semantics of datastore content, operational data, protocol
operations, and event notifications. RESTCONF uses HTTP operations
to provide CRUD operations on a NETCONF datastore containing YANG-
defined data. Since NETCONF protocol operations are not relevant,
the user should not need any prior knowledge of NETCONF in order to
use RESTCONF.
Configuration data and state data are exposed as resources that can
be retrieved with the GET method. Resources representing
configuration data can be modified with the DELETE, PATCH, POST, and
PUT methods. Data is encoded with either XML [W3C.REC-xml-20081126]
or JSON [RFC7158].
Data-model specific protocol operations defined with the YANG "rpc"
- statement can be invoked with the POST method. Data-model specific
- event notifications defined with the YANG "notification" statement
- can be accessed.
+ or "action" statements can be invoked with the POST method. Data-
+ model specific event notifications defined with the YANG
+ "notification" statement can be accessed.
1.1. Simple Subset of NETCONF Functionality
An HTTP-based management protocol does not need to mirror the
functionality of the NETCONF protocol, but it needs to be compatible
with NETCONF. A simplified transaction model is needed that allows
basic CRUD operations on a hierarchy of conceptual resources. This
represents a limited subset of the transaction capabilities of the
NETCONF protocol.
@@ -393,21 +395,23 @@
o request
o resource
The following terms are defined in [RFC7232]:
o entity tag
1.4.3. YANG
- The following terms are defined in [RFC6020]:
+ The following terms are defined in [I-D.ietf-netmod-rfc6020bis]:
+
+ o action
o container
o data node
o key leaf
o leaf
o leaf-list
@@ -404,43 +408,43 @@
o container
o data node
o key leaf
o leaf
o leaf-list
-
o list
- o presence container (or P-container)
-
- o RPC operation (now called protocol operation)
-
o non-presence container (or NP-container)
o ordered-by system
o ordered-by user
+ o presence container (or P-container)
+
+ o RPC operation (now called protocol operation)
+
1.4.4. Terms
The following terms are used within this document:
o API resource: a resource with the media type "application/
yang.api+xml" or "application/yang.api+json".
o data resource: a resource with the media type "application/
yang.data+xml" or "application/yang.data+json". Containers,
- leafs, list entries and anyxml nodes can be data resources.
+ leafs, list entries, anydata and anyxml nodes can be data
+ resources.
o datastore resource: a resource with the media type "application/
yang.datastore+xml" or "application/yang.datastore+json".
Represents a datastore.
o edit operation: a RESTCONF operation on a data resource using
either a POST, PUT, PATCH, or DELETE method.
o event stream resource: This resource represents an SSE (Server-
Sent Events) event stream. The content consists of text using the
@@ -492,25 +496,24 @@
"{+restconf}/data/ietf-restconf-monitoring:restconf-state/streams/
stream". The stream list contains information about each stream,
such as the URL to retrieve the event stream data.
1.4.5. URI Template
Throughout this document, the URI template [RFC6570] syntax
"{+restconf}" is used to refer to the RESTCONF API entry point
outside of an example. See Section 3.1 for details.
- For simplicity, all of the examples in this document assume
- "/restconf" as the discovered RESTCONF API root path.
+ For simplicity, all of the examples in this document assume "/
+ restconf" as the discovered RESTCONF API root path.
1.4.6. Tree Diagrams
-
A simplified graphical representation of the data model is used in
this document. The meaning of the symbols in these diagrams is as
follows:
o Brackets "[" and "]" enclose list keys.
o Abbreviations before data node names: "rw" means configuration
data (read-write) and "ro" state data (read-only).
o Symbols after data node names: "?" means an optional node, "!"
@@ -572,22 +575,22 @@
number of authentication schemes but, in order to ensure
interoperability, the RESTCONF server MUST advertise at least one of
the following authentication schemes:
o Basic [draft-ietf-httpauth-basicauth-update-03]
o Digest [draft-ietf-httpauth-digest-09]
o ClientCertificate [draft-thomson-httpbis-cant-01]
- These authentication schemes are selected for to their similarity to
- the authentication schemes supported by NETCONF. In particular, the
+ These authentication schemes are selected for their similarity to the
+ authentication schemes supported by NETCONF. In particular, the
Basic and Digest authentication schemes both directly provide an
identity and verification of a shared secret, much like NETCONF over
SSH, when using the SSH "password" authentication method [RFC4252].
Similarly, the ClientCertificate authentication scheme is much like
NETCONF over TLS's use of X.509 client-certificates. When using the
ClientCertificate authentication scheme, the RESTCONF server MUST
derive the identity of the RESTCONF client using the algorithm
defined in Section 7 of [draft-ietf-netconf-rfc5539bis-10].
The RESTCONF client identity determined from any HTTP authentication
@@ -666,21 +669,21 @@
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 ] } }
+ { "operations" : { "example-jukebox:play" : [ null ] } }
3.2. RESTCONF Resource Types
The RESTCONF protocol defines a set of application specific media
types to identify each of the available resource types. The
following resource types are defined in RESTCONF:
+-----------+---------------------------------+
| Resource | Media Type |
+-----------+---------------------------------+
@@ -763,44 +766,43 @@
374
3.3.2. {+restconf}/operations
This optional resource is a container that provides access to the
data-model specific protocol operations supported by the server. The
server MAY omit this resource if no data-model specific operations
are advertised.
- Any data-model specific operations defined in the YANG modules
- advertised by the server MAY be available as child nodes of this
- resource.
+ Any data-model specific protocol operations defined in the YANG
+ modules advertised by the server MAY be available as child nodes of
+ this resource.
Operation resources are defined in Section 3.6.
3.4. Datastore Resource
The "{+restconf}/data" subtree represents the datastore resource
type, which is a collection of configuration and operational data
nodes.
This resource type is an abstraction of the system's underlying
datastore implementation. It is used to simplify resource editing
for the client. The RESTCONF datastore resource is a conceptual
collection of all configuration and operational data that is present
on the device.
Configuration edit transaction management and configuration
persistence are handled by the server and not controlled by the
client. A datastore resource can only be written directly with the
PATCH method. Each RESTCONF edit of a datastore resource is saved to
- non-volatile storage in an implementation-specific matter by the
- server.
+ non-volatile storage by the server.
3.4.1. Edit Collision Detection
Two "edit collision detection" mechanisms are provided in RESTCONF,
for datastore and data resources.
3.4.1.1. Timestamp
The last change time is maintained and the "Last-Modified"
([RFC7232], Section 2.2) header is returned in the response for a
@@ -819,36 +821,36 @@
resources within the datastore affect the timestamp.
3.4.1.2. Entity tag
A unique opaque string is maintained and the "ETag" ([RFC7232],
Section 2.3) header is returned in the response for a retrieval
request. The "If-Match" 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 specified value.
- The server MUST maintain an entity tag for the top-level
- {+restconf}/data resource and SHOULD maintain entity tags for
- descendant resources. For all resources, the server MUST return the
- "ETag" header when the resource is retrieved with the GET or HEAD
- methods. If the server does not maintain an entity tag for a
- resource, it MUST return the entity tag of the resource's ancestor, a
- process that may recurse up to the top-level {+restconf}/data
- resource. Only changes to configuration data resources within the
- datastore affect the entity tag.
+ The server MUST maintain an entity tag for the top-level {+restconf}/
+ data resource and SHOULD maintain entity tags for descendant
+ resources. For all resources, the server MUST return the "ETag"
+ header when the resource is retrieved with the GET or HEAD methods.
+ If the server does not maintain an entity tag for a resource, it MUST
+ return the entity tag of the resource's ancestor, a process that may
+ recurse up to the top-level {+restconf}/data resource. Only changes
+ to configuration data resources within the datastore affect the
+ entity tag.
3.5. Data Resource
A data resource represents a YANG data node that is a descendant node
of a datastore resource. Each YANG-defined data node can be uniquely
targeted by the request-line of an HTTP operation. Containers,
- leafs, list entries and anyxml nodes are data resources.
+ leafs, list entries, anydata and anyxml nodes are data resources.
The representation maintained for each data resource is the YANG
defined subtree for that node. HTTP operations on a data resource
affect both the targeted data node and all its descendants, if any.
For configuration data resources, the server MAY maintain a last-
modified timestamp for the resource, and return the "Last-Modified"
header when it is retrieved with the GET or HEAD methods. If
maintained, the resource timestamp MUST be set to the current time
whenever the resource or any configuration resource within the
@@ -883,49 +885,51 @@
A predictable location for a data resource is important, since
applications will code to the YANG data model module, which uses
static naming and defines an absolute path location for all data
nodes.
A RESTCONF data resource identifier is not an XPath expression. It
is encoded from left to right, starting with the top-level data node,
according to the "api-path" rule in Section 3.5.1.1. The node name
of each ancestor of the target resource node is encoded in order,
- ending with the node name for the target resource.
+ ending with the node name for the target resource. If a node in the
+ path is defined in another module than its parent node, then module
+ name followed by a colon character (":") is prepended to the node
+ name in the resource identifier. See Section 3.5.1.1 for details.
If a data node in the path expression is a YANG list node, then the
key values for the list (if any) MUST be encoded according to the
following rules:
o The key leaf values for a data resource representing a YANG list
MUST be encoded using one path segment [RFC3986].
o If there is only one key leaf value, the path segment is
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 The key value is specified as a string, using the canonical
representation for the YANG data type. Any reserved characters
- MUST be encoded with escape sequences, according to [RFC2396],
- Section 2.4.
+ MUST be percent-encoded, according to [RFC3986], section 2.1.
o All the components in the "key" statement MUST be encoded.
Partial instance identifiers are not supported.
- o Quoted strings are supported in the key leaf values. Quoted
- strings MUST be used to express empty strings. (example:
- list=foo,'',baz).
+ o Quoted strings are not allowed in the key leaf values. A missing
+ key value is interpreted a zero-length string. (example:
+ list=foo,,baz).
o The "list-instance" ABNF rule defined in Section 3.5.1.1
represents the syntax of a list instance identifier.
o Resource URI values returned in Location headers for data
resources MUST identify the module name, even if there are no
conflicting local names when the resource is created. This
ensures the correct resource will be identified even if the server
loads a new module that the old client does not know about.
@@ -942,20 +946,32 @@
}
}
}
For the above YANG definition, URI with key leaf values will be
encoded as follows (line wrapped for display purposes only):
/restconf/data/example-top:top/list1=key1val,key2val,key3val3/
list2=key4val,key5val/X
+ The following example shows how reserved characters are percent-
+ encoded within a key value. The value of 'key1' contains a comma,
+ single-quote, double-quote, colon, space, and forward slash. (,'": /
+ ). Note that the angle brackets ('<', '>'), and double-quote ('"')
+ are not reserved characters and do not need to be percent-encoded.
+
+ Example URL:
+
+ /restconf/data/example-top:top/list2=key1/X
+
+ /restconf/data/example-top:top/list2=%2C%27"%3A%20%2F/X
+
3.5.1.1. ABNF For Data Resource Identifiers
The "api-path" ABNF syntax is used to construct RESTCONF path
identifiers:
api-path = "/" |
("/" api-identifier
0*("/" (api-identifier | list-instance )))
api-identifier = [module-name ":"] identifier ;; note 1
@@ -992,53 +1008,69 @@
If the target of a GET method is a data node that represents a
container or list that has any child resources with default values,
for the child resources that have not been given value yet, the
server MAY return the default values that are in use by the server,
in accordance with its reported default handing mode and query
parameters passed by the client.
3.6. Operation Resource
An operation resource represents a protocol operation defined with
- the YANG "rpc" statement. It is invoked using a POST method on the
- operation resource.
+ one of the YANG "action" or "rpc" statements. It is invoked using a
+ POST method on the operation resource.
+
+ An RPC operation is invoked as:
POST {+restconf}/operations/
The field identifies the module name and rpc identifier
string for the desired operation.
- For example, if "module-A" defined a "reset" operation, then invoking
- the operation from "module-A" would be requested as follows:
+ For example, if "module-A" defined a "reset" rpc operation, then
+ invoking the operation from "module-A" would be requested as follows:
POST /restconf/operations/module-A:reset HTTP/1.1
Server example.com
- If the "rpc" statement has an "input" section, then a message-body
- MAY be sent by the client in the request, otherwise the request
- message MUST NOT include a message-body.
+ An action is invoked as:
- If the operation is successfully invoked, and if the "rpc" statement
- has an "output" section, then a message-body MAY be sent by the
- server in the response, otherwise the response message MUST NOT
- include a message-body in the response message, and MUST send a "204
- No Content" status-line instead.
+ POST {+restconf}/data//
+ where contains the path to the data node
+ where the action is defined, and is the name of the
+ action.
+
+ For example, if "module-A" defined a "reset-all" action in the
+ container "interfaces", then invoking this action would be requested
+ as follows:
+
+ POST /restconf/data/module-A:interfaces/reset-all HTTP/1.1
+ Server example.com
+
+ If the "action" or "rpc" statement has an "input" section, then a
+ message-body MAY be sent by the client in the request, otherwise the
+ request message MUST NOT include a message-body.
+
+ If the operation is successfully invoked, and if the "action" or
+ "rpc" statement has an "output" section, then a message-body MAY be
+ sent by the server in the response, otherwise the response message
+ MUST NOT include a message-body in the response message, and MUST
+ send a "204 No Content" status-line instead.
If the operation is not successfully invoked, then a message-body
SHOULD be sent by the server, containing an "errors" resource, as
defined in Section 3.9.
3.6.1. Encoding Operation Input Parameters
- If the "rpc" statement has an "input" section, then the "input" node
- is provided in the message-body, corresponding to the YANG data
- definition statements within the "input" section.
+ If the "action" or "rpc" statement has an "input" section, then the
+ "input" node is provided in the message-body, corresponding to the
+ YANG data definition statements within the "input" section.
Example:
The following YANG definition is used for the examples in this
section.
module example-ops {
namespace "https://example.com/ns/example-ops";
prefix "ops";
@@ -1078,23 +1111,23 @@
The server might respond:
HTTP/1.1 204 No Content
Date: Mon, 25 Apr 2012 11:01:00 GMT
Server: example-server
3.6.2. Encoding Operation Output Parameters
- If the "rpc" statement has an "output" section, then the "output"
- node is provided in the message-body, corresponding to the YANG data
- definition statements within the "output" section.
+ If the "action" or "rpc" statement has an "output" section, then the
+ "output" node is provided in the message-body, corresponding to the
+ YANG data definition statements within the "output" section.
Example:
The "example-ops" YANG module defined in Section 3.6.1 is used for
the examples in this section.
The client might send the following POST request message:
POST /restconf/operations/example-ops:get-reboot-info HTTP/1.1
Host: example.com
@@ -1584,41 +1616,42 @@
Date: Mon, 23 Apr 2012 17:49:40 GMT
Server: example-server
4.8. Query Parameters
Each RESTCONF operation allows zero or more query parameters to be
present in the request URI. The specific parameters that are allowed
depends on the resource type, and sometimes the specific target
resource used, in the request.
- +---------------+---------+-----------------------------------------+
+ +-------------------+-------------+---------------------------------+
| Name | Methods | Description |
- +---------------+---------+-----------------------------------------+
- | content | GET | Select config and/or non-config data |
- | | | resources |
- | depth | GET | Request limited sub-tree depth in the |
- | | | reply content |
- | fields | GET | Request a subset of the target resource |
- | | | contents |
- | filter | GET | Boolean notification filter for event |
- | | | stream resources |
- | insert | POST, | Insertion mode for user-ordered data |
- | | PUT | resources |
- | point | POST, | Insertion point for user-ordered data |
- | | PUT | resources |
- | start-time | GET | Replay buffer start time for event |
- | | | stream resources |
- | stop-time | GET | Replay buffer stop time for event |
- | | | stream resources |
- | with-defaults | GET | Control retrieval of default values |
- +---------------+---------+-----------------------------------------+
+ +-------------------+-------------+---------------------------------+
+ | content | GET | Select config and/or non-config |
+ | | | data resources |
+ | depth | GET | Request limited sub-tree depth |
+ | | | in the reply content |
+ | fields | GET | Request a subset of the target |
+ | | | resource contents |
+ | filter | GET | Boolean notification filter for |
+ | | | event stream resources |
+ | insert | POST, PUT | Insertion mode for user-ordered |
+ | | | data resources |
+ | point | POST, PUT | Insertion point for user- |
+ | | | ordered data resources |
+ | start-time | GET | Replay buffer start time for |
+ | | | event stream resources |
+ | stop-time | GET | Replay buffer stop time for |
+ | | | event stream resources |
+ | with-defaults | GET | Control retrieval of default |
+ | | | values |
+ +-------------------+-------------+---------------------------------+
RESTCONF Query Parameters
Query parameters can be given in any order. Each parameter can
appear at most once in a request URI. A default value may apply if
the parameter is missing.
Refer to Appendix D.3 for examples of query parameter usage.
If vendors define additional query parameters, they SHOULD use a
@@ -1648,23 +1681,25 @@
the requested data nodes. If the "config" value is "false", then the
default for the "content" parameter is "nonconfig". If "config" is
"true" then the default for the "content" parameter is "config".
This query parameter MUST be supported by the server.
4.8.2. The "depth" Query Parameter
The "depth" parameter is used to specify the number of nest levels
returned in a response for a GET method. The first nest-level
- consists of the requested data node itself. Any child nodes which
- are contained within a parent node have a depth value that is 1
- greater than its parent.
+ consists of the requested data node itself. If the "fields"
+ parameter (Section 4.8.3) is used to select descendant data nodes,
+ these nodes all have a depth value of 1. Any child nodes which are
+ contained within a parent node have a depth value that is 1 greater
+ than its parent.
The value of the "depth" parameter is either an integer between 1 and
65535, or the string "unbounded". "unbounded" is the default.
This parameter is only allowed for GET methods on API, datastore, and
data resources. A 400 Bad Request error is returned if it used for
other methods or resource types.
By default, the server will include all sub-resources within a
retrieved resource, which have the same resource type as the
@@ -1677,63 +1712,66 @@
4.8.3. The "fields" Query Parameter
The "fields" query parameter is used to optionally identify data
nodes within the target resource to be retrieved in a GET method.
The client can use this parameter to retrieve a subset of all nodes
in a resource.
A value of the "fields" query parameter matches the following rule:
- fields-expr = path '(' fields-expr / '*' ')' /
+ fields-expr = path '(' fields-expr ')' /
path ';' fields-expr /
path
path = api-identifier [ '/' path ]
"api-identifier" is defined in Section 3.5.1.1.
";" is used to select multiple nodes. For example, to retrieve only
the "genre" and "year" of an album, use: "fields=genre;year".
- Parentheses are used to specify sub-selectors of a node. For
- example, to retrieve only the "label" and "catalogue-number" of an
- album, use: "fields=admin(label;catalogue-number)".
+ Parentheses are used to specify sub-selectors of a node.
+
+ For example, assume the target resource is the 'album' list. To
+ retrieve only the "label" and "catalogue-number" of the "admin"
+ container within an album, use:
+ "fields=admin(label;catalogue-number)".
"/" is used in a path to retrieve a child node of a node. For
- example, to retrieve only the "label" of an album, use:
- "fields=admin/label".
+ example, to retrieve only the "label" of an album, use: "fields=admin
+ /label".
This parameter is only allowed for GET methods on api, datastore, and
data resources. A 400 Bad Request error is returned if used for
other methods or resource types.
If the "fields" query parameter URI is listed in the "capability"
leaf-list in Section 9.3, then the server supports the "fields"
parameter.
4.8.4. The "insert" Query Parameter
The "insert" parameter is used to specify how a resource should be
inserted within a user-ordered list.
The allowed values are:
- +--------+----------------------------------------------------------+
+ +-----------+-------------------------------------------------------+
| Value | Description |
- +--------+----------------------------------------------------------+
+ +-----------+-------------------------------------------------------+
| first | Insert the new data as the new first entry. |
| last | Insert the new data as the new last entry. |
| before | Insert the new data before the insertion point, as |
| | specified by the value of the "point" parameter. |
| after | Insert the new data after the insertion point, as |
| | specified by the value of the "point" parameter. |
- +--------+----------------------------------------------------------+
+ +-----------+-------------------------------------------------------+
The default value is "last".
This parameter is only supported for the POST and PUT methods. It is
also only supported if the target resource is a data resource, and
that data represents a YANG list or leaf-list that is ordered by the
user.
If the values "before" or "after" are used, then a "point" query
parameter for the insertion parameter MUST also be present, or a 400
@@ -1858,30 +1896,32 @@
4.8.9. The "with-defaults" Query Parameter
The "with-defaults" parameter is used to specify how information
about default data nodes should be returned in response to GET
requests on data resources.
If the server supports this capability, then it MUST implement the
behavior in Section 4.5.1 of [RFC6243], except applied to the
RESTCONF GET operation, instead of the NETCONF operations.
- +-------------------+-----------------------------------------------+
+ +---------------------------+---------------------------------------+
| Value | Description |
- +-------------------+-----------------------------------------------+
+ +---------------------------+---------------------------------------+
| report-all | All data nodes are reported |
- | trim | Data nodes set to the YANG default are not |
+ | trim | Data nodes set to the YANG default |
+ | | are not reported |
+ | explicit | Data nodes set by the client are not |
| | reported |
- | explicit | Data nodes set by the client are not reported |
- | report-all-tagged | All data nodes are reported and defaults are |
- | | tagged |
- +-------------------+-----------------------------------------------+
+ | report-all-tagged | All data nodes are reported and |
+ | | defaults are tagged |
+ +---------------------------+---------------------------------------+
+
If the "with-defaults" parameter is set to "report-all" then the
server MUST adhere to the defaults reporting behavior defined in
Section 3.1 of [RFC6243].
If the "with-defaults" parameter is set to "trim" then the server
MUST adhere to the defaults reporting behavior defined in Section 3.2
of [RFC6243].
If the "with-defaults" parameter is set to "explicit" then the server
MUST adhere to the defaults reporting behavior defined in Section 3.3
@@ -1944,22 +1985,22 @@
o query: the set of parameters associated with the RESTCONF message.
These have the familiar form of "name=value" pairs. Most query
parameters are optional to implement by the server and optional to
use by the client. Each optional query parameter is identified by
a URI. The server MUST list the optional query parameter URIs it
supports in the "capabilities" list defined in Section 9.3.
There is a specific set of parameters defined, although the server
MAY choose to support query parameters not defined in this document.
The contents of the any query parameter value MUST be encoded
- according to [RFC2396], Section 3.4. Any reserved characters MUST be
- encoded with escape sequences, according to [RFC2396], Section 2.4.
+ according to [RFC3986], Section 3.4. Any reserved characters MUST be
+ percent-encoded, according to [RFC3986], section 2.1.
o fragment: This field is not used by the RESTCONF protocol.
When new resources are created by the client, a "Location" header is
returned, which identifies the path of the newly created resource.
The client MUST use this exact path identifier to access the resource
once it has been created.
The "target" of an operation is a resource. The "path" field in the
request URI represents the target resource for the operation.
@@ -1970,81 +2011,87 @@
Messages are not limited to the HTTP headers listed in this section.
HTTP defines which header lines are required for particular
circumstances. Refer to each operation definition section in
Section 4 for examples on how particular headers are used.
There are some request headers that are used within RESTCONF, usually
applied to data resources. The following tables summarize the
headers most relevant in RESTCONF message requests:
- +---------------------+---------------------------------------------+
+ +-----------------------------+-------------------------------------+
| Name | Description |
- +---------------------+---------------------------------------------+
- | Accept | Response Content-Types that are acceptable |
+ +-----------------------------+-------------------------------------+
+ | Accept | Response Content-Types that are |
+ | | acceptable |
| Content-Type | The media type of the request body |
| Host | The host address of the server |
- | If-Match | Only perform the action if the entity |
- | | matches ETag |
- | If-Modified-Since | Only perform the action if modified since |
- | | time |
- | If-Unmodified-Since | Only perform the action if un-modified |
+ | If-Match | Only perform the action if the |
+ | | entity matches ETag |
+ | If-Modified-Since | Only perform the action if modified |
| | since time |
- +---------------------+---------------------------------------------+
+ | If-Unmodified-Since | Only perform the action if un- |
+ | | modified since time |
+ +-----------------------------+-------------------------------------+
RESTCONF Request Headers
The following tables summarize the headers most relevant in RESTCONF
message responses:
- +---------------+---------------------------------------------------+
+ +-----------------------+-------------------------------------------+
| Name | Description |
- +---------------+---------------------------------------------------+
+ +-----------------------+-------------------------------------------+
| Allow | Valid actions when 405 error returned |
- | Cache-Control | The cache control parameters for the response |
- | Content-Type | The media type of the response message-body |
+ | Cache-Control | The cache control parameters for the |
+ | | response |
+ | Content-Type | The media type of the response message- |
+ | | body |
| Date | The date and time the message was sent |
| ETag | An identifier for a specific version of a |
| | resource |
- | Last-Modified | The last modified date and time of a resource |
- | Location | The resource identifier for a newly created |
+ | Last-Modified | The last modified date and time of a |
| | resource |
- +---------------+---------------------------------------------------+
+ | Location | The resource identifier for a newly |
+ | | created resource |
+ +-----------------------+-------------------------------------------+
RESTCONF Response Headers
5.3. Message Encoding
RESTCONF messages are encoded in HTTP according to [RFC7230]. The
"utf-8" character set is used for all messages. RESTCONF message
content is sent in the HTTP message-body.
Content is encoded in either JSON or XML format. A server MUST
- support XML encoding and MAY support JSON encoding. XML encoding
- rules for data nodes are defined in [RFC6020]. The same encoding
- rules are used for all XML content. JSON encoding rules are defined
- in [I-D.ietf-netmod-yang-json]. This encoding is valid JSON, but
+ support XML or JSON encoding. XML encoding rules for data nodes are
+ defined in [I-D.ietf-netmod-rfc6020bis]. The same encoding rules are
+ used for all XML content. JSON encoding rules are defined in
+ [I-D.ietf-netmod-yang-json]. JSON encoding of meta-data is defined
+ in [I-D.ietf-netmod-yang-metadata]. This encoding is valid JSON, but
also has special encoding rules to identify module namespaces and
provide consistent type processing of YANG data.
Request input content encoding format is identified with the Content-
Type header. This field MUST be present if a message-body is sent by
the client.
- Response output content encoding format is identified with the Accept
- header in the request, or if is not specified, the request input
- encoding format is used. If there was no request input, then the
- default output encoding is XML. File extensions encoded in the
- request are not used to identify format encoding.
+ The server MUST support the "Accept" header and "406 Not Acceptable"
+ status code, as defined in [RFC7231]. Response output content
+ encoding format is identified with the Accept header in the request.
+ If is not specified, the request input encoding format is used. If
+ there was no request input, then the default output encoding is XML
+ or JSON, depending or server preference. File extensions encoded in
+ the request are not used to identify format encoding.
5.4. RESTCONF Meta-Data
-
The RESTCONF protocol needs to retrieve the same meta-data that is
used in the NETCONF protocol. Information about default leafs, last-
modified timestamps, etc. are commonly used to annotate
representations of the datastore contents. This meta-data is not
defined in the YANG schema because it applies to the datastore, and
is common across all data nodes.
This information is encoded as attributes in XML. JSON encoding of
meta-data is defined in [I-D.ietf-netmod-yang-metadata].
@@ -2041,47 +2088,104 @@
The RESTCONF protocol needs to retrieve the same meta-data that is
used in the NETCONF protocol. Information about default leafs, last-
modified timestamps, etc. are commonly used to annotate
representations of the datastore contents. This meta-data is not
defined in the YANG schema because it applies to the datastore, and
is common across all data nodes.
This information is encoded as attributes in XML. JSON encoding of
meta-data is defined in [I-D.ietf-netmod-yang-metadata].
+ The following examples are based on the example in Appendix D.3.9.
+ The "report-all-tagged" mode for the "with-defaults" query parameter
+ requires that a "default" attribute be returned for default nodes.
+ This example shows that attribute for the "mtu" leaf .
+
+5.4.1. XML MetaData Encoding Example
+
+ GET /restconf/data/interfaces/interface=eth1
+ ?with-defaults=report-all-tagged HTTP/1.1
+ Host: example.com
+ Accept: application/yang.data+xml
+
+ The server might respond as follows.
+
+ HTTP/1.1 200 OK
+ Date: Mon, 23 Apr 2012 17:01:00 GMT
+ Server: example-server
+ Content-Type: application/yang.data+xml
+
+
+ eth1
+ 1500
+ up
+
+
+5.4.2. JSON MetaData Encoding Example
+
+ Note that RFC 6243 defines the "default" attribute with XSD, not
+ YANG, so the YANG module name has to be assigned manually. The value
+ "ietf-netconf-with-defaults" is assigned for JSON meta-data encoding.
+
+ GET /restconf/data/interfaces/interface=eth1
+ ?with-defaults=report-all-tagged HTTP/1.1
+ Host: example.com
+ Accept: application/yang.data+json
+ The server might respond as follows.
+
+ HTTP/1.1 200 OK
+ Date: Mon, 23 Apr 2012 17:01:00 GMT
+ Server: example-server
+ Content-Type: application/yang.data+json
+
+ {
+ "example:interface": [
+ {
+ "name" : "eth1",
+ "mtu" : 1500,
+ "@mtu": {
+ "ietf-netconf-with-defaults:default" : true
+ },
+ "status" : "up"
+ }
+ ]
+ }
+
5.5. Return Status
Each message represents some sort of resource access. An HTTP
"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
information will be returned in the response, according to the format
defined in Section 7.1.
5.6. Message Caching
Since the datastore contents change at unpredictable times, responses
from a RESTCONF server generally SHOULD NOT be cached.
The server SHOULD include a "Cache-Control" header in every response
that specifies whether the response should be cached. A "Pragma"
header specifying "no-cache" MAY also be sent in case the
"Cache-Control" header is not supported.
- Instead of using HTTP caching, the client SHOULD track the "ETag"
- and/or "Last-Modified" headers returned by the server for the
- datastore resource (or data resource if the server supports it). A
- retrieval request for a resource can include the "If-None-Match" and/
- or "If-Modified-Since" headers, which will cause the server to return
- a "304 Not Modified" status-line if the resource has not changed.
- The client MAY use the HEAD method to retrieve just the message
- headers, which SHOULD include the "ETag" and "Last-Modified" headers,
- if this meta-data is maintained for the target resource.
+ Instead of using HTTP caching, the client SHOULD track the "ETag" and
+ /or "Last-Modified" headers returned by the server for the datastore
+ resource (or data resource if the server supports it). A retrieval
+ request for a resource can include the "If-None-Match" and/or
+ "If-Modified-Since" headers, which will cause the server to return a
+ "304 Not Modified" status-line if the resource has not changed. The
+ client MAY use the HEAD method to retrieve just the message headers,
+ which SHOULD include the "ETag" and "Last-Modified" headers, if this
+ meta-data is maintained for the target resource.
6. Notifications
The RESTCONF protocol supports YANG-defined event notifications. The
solution preserves aspects of NETCONF Event Notifications [RFC5277]
while utilizing the Server-Sent Events [W3C.CR-eventsource-20121211]
transport strategy.
6.1. Server Support
@@ -2339,57 +2444,58 @@
HTTP status-lines are used to report success or failure for RESTCONF
operations. The element returned in NETCONF error
responses contains some useful information. This error information
is adapted for use in RESTCONF, and error information is returned for
"4xx" class of status codes.
The following table summarizes the return status codes used
specifically by RESTCONF operations:
- +---------------------------+---------------------------------------+
+ +----------------------------+--------------------------------------+
| Status-Line | Description |
- +---------------------------+---------------------------------------+
+ +----------------------------+--------------------------------------+
| 100 Continue | POST accepted, 201 should follow |
| 200 OK | Success with response message-body |
| 201 Created | POST to create a resource success |
| 202 Accepted | POST to create a resource accepted |
- | 204 No Content | Success without response message-body |
+ | 204 No Content | Success without response message- |
+ | | body |
| 304 Not Modified | Conditional operation not done |
| 400 Bad Request | Invalid request message |
| 403 Forbidden | Access to resource denied |
| 404 Not Found | Resource target or resource node not |
| | found |
| 405 Method Not Allowed | Method not allowed for target |
| | resource |
| 409 Conflict | Resource or lock in use |
| 412 Precondition Failed | Conditional method is false |
| 413 Request Entity Too | too-big error |
| Large | |
| 414 Request-URI Too Large | too-big error |
- | 415 Unsupported Media | non RESTCONF media type |
- | Type | |
+ | 415 Unsupported Media Type | non RESTCONF media type |
| 500 Internal Server Error | operation-failed |
| 501 Not Implemented | unknown-operation |
| 503 Service Unavailable | Recoverable server error |
- +---------------------------+---------------------------------------+
+ +----------------------------+--------------------------------------+
HTTP Status Codes used in RESTCONF
- Since an operation resource is defined with a YANG "rpc" statement, a
- mapping between the NETCONF value and the HTTP status
- code is needed. The specific error condition and response code to
- use are data-model specific and might be contained in the YANG
- "description" statement for the "rpc" statement.
+ Since an operation resource is defined with a YANG "action" or "rpc"
+ statement, a mapping between the NETCONF value and the
+ HTTP status code is needed. The specific error condition and
+ response code to use are data-model specific and might be contained
+ in the YANG "description" statement for the "action" or "rpc"
+ statement.
+-------------------------+-------------+
- | | status code |
+ | | status code |
+-------------------------+-------------+
| in-use | 409 |
| invalid-value | 400 |
| too-big | 413 |
| missing-attribute | 400 |
| bad-attribute | 400 |
| unknown-attribute | 400 |
| bad-element | 400 |
| unknown-element | 400 |
| unknown-namespace | 400 |
@@ -2412,29 +2518,31 @@
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
status code "403 Forbidden"), then the server SHOULD send a response
message-body containing the information described by the "errors"
container definition within the YANG module Section 8. The Content-
Type of this response message MUST be application/yang.errors (see
example below).
The client MAY specify the desired encoding for error messages by
specifying the appropriate media-type in the Accept header. If no
- error media is specified, the server MUST assume that "application/
- yang.errors+xml" was specified. All of the examples in this
- document, except for the one below, assume the default XML encoding
- will be returned if there is an error.
+ error media is specified, then the media type of the request message
+ is used. If there is no request message the server MUST select
+ "application/yang.errors+xml" or "application/yang.errors+json",
+ depending on server preference. All of the examples in this
+ document, except for the one below, assume that XML encoding will be
+ returned if there is an error.
- YANG Tree Diagram for Data:
+ YANG Tree Diagram for data:
+--ro errors
- +--ro error
+ +--ro error*
+--ro error-type enumeration
+--ro error-tag string
+--ro error-app-tag? string
+--ro error-path? instance-identifier
+--ro error-message? string
+--ro error-info
The semantics and syntax for RESTCONF error messages are defined in
the "application/yang.errors" restconf-media-type extension in
Section 8.
@@ -2446,35 +2554,36 @@
RESTCONF client is attempting to delete a data resource. Note that
an Accept header is used to specify the desired encoding for the
error message. This example's use of the Accept header is especially
notable since the DELETE method typically doesn't return a message-
body and hence Accept headers are typically not passed.
DELETE /restconf/data/example-jukebox:jukebox/
library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
Host: example.com
Accept: application/yang.errors+json
-
The server might respond:
HTTP/1.1 409 Conflict
Date: Mon, 23 Apr 2012 17:11:00 GMT
Server: example-server
Content-Type: application/yang.errors+json
{
"ietf-restconf:errors": {
- "error": {
+ "error": [
+ {
"error-type": "protocol",
"error-tag": "lock-denied",
"error-message": "Lock failed, lock already held"
}
+ ]
}
}
The following example shows an error returned for a "data-exists"
error on a data resource. The "jukebox" resource already exists so
it cannot be created.
The client might send:
POST /restconf/data/example-jukebox:jukebox HTTP/1.1
@@ -2500,27 +2608,27 @@
Data already exists, cannot create new resource
8. RESTCONF module
The "ietf-restconf" module defines conceptual definitions within an
extension and two groupings, which are not meant to be implemented as
datastore contents by a server. E.g., the "restconf" container is
- not intended to be implemented as a top-level data node (under the
- "/restconf/data" entry point).
+ not intended to be implemented as a top-level data node (under the "/
+ restconf/data" entry point).
RFC Ed.: update the date below with the date of RFC publication and
remove this note.
- file "ietf-restconf@2015-06-04.yang"
+ file "ietf-restconf@2015-10-18.yang"
module ietf-restconf {
namespace "urn:ietf:params:xml:ns:yang:ietf-restconf";
prefix "rc";
organization
"IETF NETCONF (Network Configuration) Working Group";
contact
"WG Web:
@@ -2562,33 +2670,35 @@
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; see
the RFC itself for full legal notices.";
// RFC Ed.: replace XXXX with actual RFC number and remove this
// note.
// RFC Ed.: remove this note
- // Note: extracted from draft-ietf-netconf-restconf-06.txt
+ // Note: extracted from draft-ietf-netconf-restconf-08.txt
+
// RFC Ed.: update the date below with the date of RFC publication
// and remove this note.
- revision 2015-06-04 {
+ revision 2015-10-18 {
description
"Initial revision.";
reference
"RFC XXXX: RESTCONF Protocol.";
}
extension restconf-media-type {
argument media-type-id {
yin-element true;
+
}
// RFC Ed.: replace draft-ietf-netmod-yang-json with RFC number
// in the description below, and remove this note.
description
"This extension is used to specify a YANG data structure which
represents a conceptual RESTCONF media type.
Data definition statements within this extension specify
the generic syntax for the specific media type.
YANG is mapped to specific encoding formats outside the
@@ -2713,25 +2823,27 @@
}
leaf error-message {
type string;
description
"A message describing the error.";
}
anyxml error-info {
description
- "Arbitrary XML that represents a container
- of additional information for the error report.";
+ "This anyxml value MUST represent a container with
+ zero or more data nodes representing additional
+ error information.";
}
}
}
+
}
grouping restconf {
description
"Conceptual container representing the
application/yang.api resource type.";
container restconf {
description
"Conceptual container representing the
@@ -2770,35 +2882,35 @@
}
}
9. RESTCONF Monitoring
The "ietf-restconf-monitoring" module provides information about the
RESTCONF protocol capabilities and event notification streams
- available from the server. A RESTCONF server MUST implement the
- "/restconf-state/capabilities" container in this module.
+ available from the server. A RESTCONF server MUST implement the "/
+ restconf-state/capabilities" container in this module.
YANG Tree Diagram for "ietf-restconf-monitoring" module:
+--ro restconf-state
+--ro capabilities
| +--ro capability* inet:uri
+--ro streams
+--ro stream* [name]
+--ro name string
+--ro description? string
+--ro replay-support? boolean
+--ro replay-log-creation-time? yang:date-and-time
- +--ro access* [type]
+ +--ro access* [encoding]
+--ro encoding string
+--ro location inet:uri
9.1. restconf-state/capabilities
This mandatory container holds the RESTCONF protocol capability URIs
supported by the server.
The server MUST maintain a last-modified timestamp for this
container, and return the "Last-Modified" header when this data node
@@ -2818,35 +2930,35 @@
9.1.1. Query Parameter URIs
A new set of RESTCONF Capability URIs are defined to identify the
specific query parameters (defined in Section 4.8) supported by the
server.
The server MUST include a "capability" leaf-list entry for each
optional query parameter that it supports.
- +------------+--------+---------------------------------------------+
- | Name | Sectio | URI |
- | | n | |
- +------------+--------+---------------------------------------------+
+ +-------------+-------+---------------------------------------------+
+ | Name | Secti | URI |
+ | | on | |
+ +-------------+-------+---------------------------------------------+
| depth | 4.8.2 | urn:ietf:params:restconf:capability:depth:1 |
| | | .0 |
| fields | 4.8.3 | urn:ietf:params:restconf:capability:fields: |
| | | 1.0 |
| filter | 4.8.6 | urn:ietf:params:restconf:capability:filter: |
| | | 1.0 |
| replay | 4.8.7 | urn:ietf:params:restconf:capability:replay: |
| | 4.8.8 | 1.0 |
| with- | 4.8.9 | urn:ietf:params:restconf:capability:with- |
| defaults | | defaults:1.0 |
- +------------+--------+---------------------------------------------+
+ +-------------+-------+---------------------------------------------+
RESTCONF Query Parameter URIs
9.1.2. The "defaults" Protocol Capability URI
This URI identifies the defaults handling mode that is used by the
server for processing default leafs in requests for data resources.
A parameter named "basic-mode" is required for this capability URI.
The "basic-mode" definitions are specified in the "With-Defaults
Capability for NETCONF" [RFC6243].
@@ -2855,29 +2967,29 @@
| Name | URI |
+----------+--------------------------------------------------+
| defaults | urn:ietf:params:restconf:capability:defaults:1.0 |
+----------+--------------------------------------------------+
RESTCONF defaults capability URI
This protocol capability URI MUST be supported by the server, and
MUST be listed in the "capability" leaf-list in Section 9.3.
- +------------+------------------------------------------------------+
+ +------------------+------------------------------------------------+
| Value | Description |
- +------------+------------------------------------------------------+
+ +------------------+------------------------------------------------+
| report-all | No data nodes are considered default |
| trim | Values set to the YANG default-stmt value are |
| | default |
| explicit | Values set by the client are never considered |
| | default |
- +------------+------------------------------------------------------+
+ +------------------+------------------------------------------------+
If the "basic-mode" is set to "report-all" then the server MUST
adhere to the defaults handling behavior defined in Section 2.1 of
[RFC6243].
If the "basic-mode" is set to "trim" then the server MUST adhere to
the defaults handling behavior defined in Section 2.2 of [RFC6243].
If the "basic-mode" is set to "explicit" then the server MUST adhere
to the defaults handling behavior defined in Section 2.3 of
@@ -2958,21 +3070,21 @@
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; see
the RFC itself for full legal notices.";
// RFC Ed.: replace XXXX with actual RFC number and remove this
// note.
// RFC Ed.: remove this note
- // Note: extracted from draft-ietf-netconf-restconf-06.txt
+ // Note: extracted from draft-ietf-netconf-restconf-08.txt
// RFC Ed.: update the date below with the date of RFC publication
// and remove this note.
revision 2015-06-19 {
description
"Initial revision.";
reference
"RFC XXXX: RESTCONF Protocol.";
}
@@ -3277,50 +3388,58 @@
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.
13. Acknowledgements
The authors would like to thank the following people for their
contributions to this document: Ladislav Lhotka, Juergen
Schoenwaelder, Rex Fernando, Robert Wilton, and Jonathan Hansford.
+ Contributions to this material by Andy Bierman are based upon work
+ supported by the The Space & Terrestrial Communications Directorate
+ (S&TCD) under Contract No. W15P7T-13-C-A616. Any opinions, findings
+ and conclusions or recommendations expressed in this material are
+ those of the author(s) and do not necessarily reflect the views of
+ The Space & Terrestrial Communications Directorate (S&TCD).
+
14. References
14.1. Normative References
[I-D.ietf-netconf-yang-library]
Bierman, A., Bjorklund, M., and K. Watsen, "YANG Module
Library", draft-ietf-netconf-yang-library-01 (work in
progress), July 2015.
+ [I-D.ietf-netmod-rfc6020bis]
+ Bjorklund, M., "The YANG 1.1 Data Modeling Language",
+ draft-ietf-netmod-rfc6020bis-07 (work in progress),
+ September 2015.
+
[I-D.ietf-netmod-yang-json]
Lhotka, L., "JSON Encoding of Data Modeled with YANG",
- draft-ietf-netmod-yang-json-04 (work in progress), June
+ draft-ietf-netmod-yang-json-06 (work in progress), October
2015.
[I-D.ietf-netmod-yang-metadata]
Lhotka, L., "Defining and Using Metadata with YANG",
- draft-ietf-netmod-yang-metadata-01 (work in progress),
- June 2015.
+ draft-ietf-netmod-yang-metadata-02 (work in progress),
+ September 2015.
[RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part Two: Media Types", RFC 2046,
November 1996.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
- [RFC2396] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
- Resource Identifiers (URI): Generic Syntax", RFC 2396,
- August 1998.
-
[RFC2818] Rescorla, E., "The IETF XML Registry", RFC 2818, May 2000.
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
January 2004.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, RFC
3986, January 2005.
[RFC4252] Ylonen, T. and C. Lonvick, "The Secure Shell (SSH)
@@ -3426,49 +3545,72 @@
[draft-thomson-httpbis-cant-01]
Thomson, M., "Client Authentication over New TLS
Connection", draft-thomson-httpbis-cant-01 (work in
progress), Jul 2014.
14.2. Informative References
[I-D.ietf-netconf-yang-patch]
Bierman, A., Bjorklund, M., and K. Watsen, "YANG Patch
- Media Type", draft-ietf-netconf-yang-patch-05 (work in
- progress), July 2015.
+ Media Type", draft-ietf-netconf-yang-patch-06 (work in
+ progress), October 2015.
[rest-dissertation]
Fielding, R., "Architectural Styles and the Design of
Network-based Software Architectures", 2000.
Appendix A. Change Log
-- RFC Ed.: remove this section before publication.
The RESTCONF issue tracker can be found here: https://github.com/
netconf-wg/restconf/issues
-A.1. 06 - 07
+A.1. 07 - 08
+
+ o add support for YANG 1.1 action statement
+
+ o changed mandatory encoding from XML to XML or JSON
+
+ o fix syntax in fields parameter definition
+
+ o add meta-data encoding examples for XML and JSON
+
+ o remove RFC 2396 references and update with 3986
+
+ o change encoding of a key so quoted string are not used, since they
+ are already percent-encoded. A zero-length string is not encoded
+ (/list=foo,,baz)
+
+ o Add example of percent-encoded key value
+
+A.2. 06 - 07
o fixed all issues identified in email from Jernej Tuljak in netconf
email 2015-06-22
o fixed error example bug where error-urlpath was still used.
Changed to error-path.
o added mention of YANG Patch and informative reference
-A.2. 05 - 06
+ o added support for YANG 1.1, specifically support for anydata and
+ actions
+
+ o removed the special field value "*", since it is no longer needed
+
+A.3. 05 - 06
o fixed RESTCONF issue #23 (ietf-restconf-monitoring bug)
-A.3. 04 - 05
+A.4. 04 - 05
o changed term 'notification event' to 'event notification'
o removed intro text about framework and meta-model
o removed early mention of API resources
o removed term unified datastore and cleaned up text about NETCONF
datastores
@@ -3491,21 +3633,21 @@
o renamed stream/encoding/events to stream/access/location
o changed XPath from informative to normative reference
o changed rest-dissertation from normative to informative reference
o changed example-jukebox playlist 'id' from a data-resource-
identifier to a leafref pointing at the song name
-A.4. 03 - 04
+A.5. 03 - 04
o renamed 'select' to 'fields' (#1)
o moved collection resource and page capability to draft-ietf-
netconf-restconf-collection-00 (#3)
o added mandatory "defaults" protocol capability URI (#4)
o added optional "with-defaults" query parameter URI (#4)
@@ -3526,21 +3668,21 @@
o changed lock-denied error example
o added with-defaults query parameter example
o added term "RESTCONF Capability"
o changed NETCONF Capability URI registry usage to new RESTCONF
Capability URI Registry usage
-A.5. 02 - 03
+A.6. 02 - 03
o added collection resource
o added "page" query parameter capability
o added "limit" and "offset" query parameters, which are available
if the "page" capability is supported
o added "stream list" term
@@ -3538,30 +3680,30 @@
o added collection resource
o added "page" query parameter capability
o added "limit" and "offset" query parameters, which are available
if the "page" capability is supported
o added "stream list" term
o fixed bugs in some examples
-
o added "encoding" list within the "stream" list to allow different
URLs for XML and JSON encoding.
o made XML MUST implement and JSON MAY implement for servers
o re-add JSON notification examples (previously removed)
+
o updated JSON references
-A.6. 01 - 02
+A.7. 01 - 02
o moved query parameter definitions from the YANG module back to the
plain text sections
o made all query parameters optional to implement
o defined query parameter capability URI
o moved 'streams' to new YANG module (ietf-restconf-monitoring)
@@ -3585,21 +3727,21 @@
information is no longer in this resource
o closed issue #1 'select parameter' since no objections to the
proposed syntax
o closed "encoding of list keys" issue since no objection to new
encoding of list keys in a target resource URI.
o moved open issues list to the issue tracker on github
-A.7. 00 - 01
+A.8. 00 - 01
o fixed content=nonconfig example (non-config was incorrect)
o closed open issue 'message-id'. There is no need for a message-id
field, and RFC 2392 does not apply.
o closed open issue 'server support verification'. The headers used
by RESTCONF are widely supported.
o removed encoding rules from section on RESTCONF Meta-Data. This
@@ -3629,21 +3771,21 @@
the RESTCONF API using the /.well-known/host-meta.
o added an "error" media type to for structured error messages
o added Secure Transport section requiring TLS
o added Security Considerations section
o removed all references to "REST-like"
-A.8. bierman:restconf-04 to ietf:restconf-00
+A.9. bierman:restconf-04 to ietf:restconf-00
o updated open issues section
Appendix B. Open Issues
-- RFC Ed.: remove this section before publication.
The RESTCONF issues are tracked on github.com:
https://github.com/netconf-wg/restconf/issues
@@ -3954,23 +4100,21 @@
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": {
"data" : [ null ],
- "operations" : {
- "play" : [ null ]
- }
+ "operations" : [ null ]
}
}
To request that the response content to be encoded in XML, the
"Accept" header can be used, as in this example request:
GET /restconf HTTP/1.1
Host: example.com
Accept: application/yang.api+xml
@@ -3979,23 +4123,21 @@
HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 17:01:00 GMT
Server: example-server
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/yang.api+xml
-
-
-
+
D.1.2. Retrieve The Server Module Information
In this example the client is retrieving the modules information from
the server in JSON format:
GET /restconf/data/ietf-yang-library:modules HTTP/1.1
Host: example.com
Accept: application/yang.data+json
@@ -4009,54 +4151,54 @@
Pragma: no-cache
Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT
Content-Type: application/yang.data+json
{
"ietf-yang-library:modules": {
"module": [
{
"name" : "foo",
"revision" : "2012-01-02",
- "schema" : "https://example.com/mymodules/foo/2012-01-02",
+ "schema" : "https://example.com/modules/foo/2012-01-02",
"namespace" : "http://example.com/ns/foo",
"feature" : [ "feature1", "feature2" ],
"conformance" : "implement"
+
},
{
"name" : "foo-types",
"revision" : "2012-01-05",
"schema" :
-
- "https://example.com/mymodules/foo-types/2012-01-05",
+ "https://example.com/modules/foo-types/2012-01-05",
"schema" : [null],
"namespace" : "http://example.com/ns/foo-types",
"conformance" : "import"
},
{
"name" : "bar",
"revision" : "2012-11-05",
- "schema" : "https://example.com/mymodules/bar/2012-11-05",
+ "schema" : "https://example.com/modules/bar/2012-11-05",
"namespace" : "http://example.com/ns/bar",
"feature" : [ "bar-ext" ],
"conformance" : "implement",
"submodule" : [
{
"name" : "bar-submod1",
"revision" : "2012-11-05",
"schema" :
- "https://example.com/mymodules/bar-submod1/2012-11-05"
+ "https://example.com/modules/bar-submod1/2012-11-05"
},
{
"name" : "bar-submod2",
"revision" : "2012-11-05",
"schema" :
- "https://example.com/mymodules/bar-submod2/2012-11-05"
+ "https://example.com/modules/bar-submod2/2012-11-05"
}
]
}
]
}
}
D.1.3. Retrieve The Server Capability Information
In this example the client is retrieving the capability information
@@ -4187,22 +4327,23 @@
ETag: b34aed893a4c
D.2.3. Edit a Datastore Resource
In this example, the client modifies two different data nodes by
sending a PATCH to the datastore resource:
PATCH /restconf/data HTTP/1.1
Host: example.com
Content-Type: application/yang.datastore+xml
+
-
+
Foo Fighters
Wasting Light
2011
Nick Cave
@@ -4498,21 +4638,22 @@
}
}
}
D.3.3. "fields" Parameter
In this example the client is retrieving the API resource, but
retrieving only the "name" and "revision" nodes from each module, in
JSON format:
- GET /restconf/data?fields=modules/module(name;revision) HTTP/1.1
+ GET /restconf/data?fields=ietf-yang-library:modules/
+ module(name;revision) 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
@@ -4640,28 +4782,51 @@
// start-time = 2014-10-25T10:02:00Z
GET /mystreams/NETCONF?start-time=2014-10-25T10%3A02%3A00Z
D.3.8. "stop-time" Parameter
// stop-time = 2014-10-25T12:31:00Z
GET /mystreams/NETCONF?stop-time=2014-10-25T12%3A31%3A00Z
D.3.9. "with-defaults" Parameter
+ The following YANG module is assumed for this example.
+
+ module example-interface {
+ prefix "exif";
+ namespace "urn:example.com:params:xml:ns:yang:example-interface";
+
+ container interfaces {
+ list interface {
+ key name;
+ leaf name { type string; }
+ leaf mtu { type uint32; }
+ leaf status {
+ config false;
+ type enumeration {
+ enum up;
+ enum down;
+ enum testing;
+ }
+ }
+ }
+ }
+ }
+
Assume the same data model as defined in Appendix A.1 of [RFC6243].
Assume the same data set as defined in Appendix A.2 of [RFC6243]. If
the server defaults-uri basic-mode is "trim", the the following
request for interface "eth1" might be as follows:
Without query parameter:
- GET /restconf/data/interfaces/interface=eth1 HTTP/1.1
+ GET /restconf/data/example:interfaces/interface=eth1 HTTP/1.1
Host: example.com
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
@@ -4672,21 +4837,21 @@
"status" : "up"
}
]
}
Note that the "mtu" leaf is missing because it is set to the default
"1500", and the server defaults handling basic-mode is "trim".
With query parameter:
- GET /restconf/data/interfaces/interface=eth1
+ GET /restconf/data/example:interfaces/interface=eth1
?with-defaults=report-all 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