Internet-Draft | RESTCONF Pagination Support | November 2020 |
Watsen, et al. | Expires 6 May 2021 | [Page] |
In some circumstance, a server may contain many instances of a particular YANG list or leaf-list. Retrieval of the entire list or leaf-list at once can be extremely inefficient.¶
Pagination mechanisms are needed to allow a client to iterate through a large list, in a manner that is most efficient for the application.¶
This document Updates RFC 8040 to declare "list" and "leaf-list" as resource targets for the RESTCONF operations such as GET, POST operations.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
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 https://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 6 May 2021.¶
Copyright (c) 2020 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 (https://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.¶
There is a need for standard mechanisms to control the filtering, sorting, and retrieval of data from the server. A server may contain many instances of a particular YANG list. Retrieval of the entire list or leaf-list at once can be extremely inefficient.¶
Pagination mechanisms are needed to allow a client to iterate through a large list, in a manner that is most efficient for the application. The RPC operation defined in [I-D.wwlh-netconf-list-pagination-nc] can be used by the RESTCONF protocol [RFC8040] if the RESTCONF server implements the "ietf-yang-list-pagination" module [I-D.wwlh-netconf-list-pagination-nc].¶
This document Updates RFC 8040 to declare "list" and "leaf-list" as resource targets for the RESTCONF operations such as GET, POST operations.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
The following terms are defined in [RFC8342] [RFC7950] and are not redefined here:¶
The following terms are defined in this document as follows:¶
This section describes the RESTCONF extensions needed to support the Pagination mechanism.¶
The following resource type is defined in this document:¶
+-----------------+-----------------------------+ | Resource | Media Type | +-----------------+-----------------------------+ | YANG-Collection | application/yang-collection | +-----------------+-----------------------------+ RESTCONF Media Type¶
The "get-list-pagination" RPC operation defined in "ietf-yang-list-pagination" module [I-D.wwlh-netconf-list-pagination-nc] can use the RESTCONF target resource URI to identify the resource that will be filtered and returned. A collection resource contains a set of data resources. It is used to represent all instances or a subset of all instances in a YANG list or leaf-list. A collection resource can be used as target resource and retrieved with the GET method or POST method. The "ietf-restconf-list-pagination" YANG module contains the "yang-collection" yang data template with the "yang-data"extension which specifies the syntax and semantics of a "yang-collection" media type.¶
The "ietf-restconf-list-pagination" module defines conceptual definitions within groupings, which are not meant to be implemented as datastore contents by a server.¶
<CODE BEGINS> file "ietf-restconf-list-pagination@2020-010-30.yang" module ietf-restconf-list-pagination { namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"; prefix rlpg; import ietf-restconf { prefix rc; } organization "IETF NETCONF (Network Configuration) Working Group"; contact "WG Web: <http://tools.ietf.org/wg/netconf/> WG List: <mailto:netconf@ietf.org> Editor: Editor: Editor: "; description "This module contains conceptual YANG specifications for the RESTCONF Collection resource type. Note that the YANG definitions within this module do not represent configuration data of any kind. The YANG grouping statements provide a normative syntax for XML and JSON message encoding purposes. Copyright (c) 2015 IETF Trust and the persons identified as authors of the code. All rights reserved. Redistribution and use in source and binary forms, with or without modification, is permitted pursuant to, and subject to the license terms contained in, the Simplified BSD License set forth in Section 4.c of the IETF Trust's Legal Provisions 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."; revision 2015-01-30 { description "Initial revision."; reference "RFC XXXX: RESTCONF Collection Resource."; } rc:yang-data yang-collection { uses collection; } grouping collection { description "Conceptual container representing the yang-collection resource type."; container yang-collection { description "Container representing the yang-collection resource type."; } } } <CODE ENDS>¶
This document registers one URI in the IETF XML Registry [RFC3688]. The following registration has been made:¶
URI: urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination Registrant Contact: The IESG. XML: N/A, the requested URI is an XML namespace.¶
This document registers one YANG module in the YANG Module Names Registry [RFC6020]. The following registration has been made:¶
name: ietf-restconf-list-pagination namespace: urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination prefix: rlpg RFC: xxxx¶
Type name: application Subtype name: yang-collection+xml Required parameters: None Optional parameters: None Encoding considerations: 8-bit The "utf-8" charset is always used for this type. Each conceptual YANG data node is encoded according to the XML Encoding Rules and Canonical Format for the specific YANG data node type defined in [RFC7950]. Security considerations: Security considerations related to the generation and consumption of RESTCONF messages are discussed in Section 5 of RFC 8072. Additional security considerations are specific to the semantics of particular YANG data models. Each YANG module is expected to specify security considerations for the YANG data defined in that module. Interoperability considerations: RFC 8072 specifies the format of conforming messages and the interpretation thereof. Published specification: RFC 8072 Applications that use this media type: Instance document data parsers used within a protocol or automation tool that utilize the YANG Patch data structure. Fragment identifier considerations: The syntax and semantics of fragment identifiers are the same as the syntax and semantics specified for the "application/xml" media type. Additional information: Deprecated alias names for this type: N/A Magic number(s): N/A File extension(s): None Macintosh file type code(s): "TEXT" Person & email address to contact for further information: See the Authors' Addresses section of RFC 8072. Intended usage: COMMON Restrictions on usage: N/A Author: See the Authors' Addresses section of RFC 8072. Change controller: Internet Engineering Task Force (mailto:iesg@ietf.org). Provisional registration? (standards tree only): no¶
Type name: application Subtype name: yang-collection+json Required parameters: None Optional parameters: None Encoding considerations: 8-bit The "utf-8" charset is always used for this type. Each conceptual YANG data node is encoded according to the XML Encoding Rules and Canonical Format for the specific YANG data node type defined in [RFC7950]. Security considerations: Security considerations related to the generation and consumption of RESTCONF messages are discussed in Section 5 of RFC 8072. Additional security considerations are specific to the semantics of particular YANG data models. Each YANG module is expected to specify security considerations for the YANG data defined in that module. Interoperability considerations: RFC 8072 specifies the format of conforming messages and the interpretation thereof. Published specification: RFC 8072 Applications that use this media type: Instance document data parsers used within a protocol or automation tool that utilize the YANG Patch data structure. Fragment identifier considerations: The syntax and semantics of fragment identifiers are the same as the syntax and semantics specified for the "application/xml" media type. Additional information: Deprecated alias names for this type: N/A Magic number(s): N/A File extension(s): None Macintosh file type code(s): "TEXT" Person & email address to contact for further information: See the Authors' Addresses section of RFC 8072. Intended usage: COMMON Restrictions on usage: N/A Author: See the Authors' Addresses section of RFC 8072. Change controller: Internet Engineering Task Force (mailto:iesg@ietf.org). Provisional registration? (standards tree only): no¶
The YANG module defined in this document extends the base operations for NETCONF [RFC6241] and RESTCONF [RFC8040]. The lowest NETCONF layer is the secure transport layer, and the mandatory-to-implement secure transport is Secure Shell (SSH) [RFC6242]. The lowest RESTCONF layer is HTTPS, and the mandatory-to-implement secure transport is TLS [RFC8446].¶
The security constraints for the base RESTCONF protocol (see Section 12 of [RFC8040]) apply to the new RESTCONF target resources defined in this document.¶
Per Andersson perander@cisco.com David Cornejo dcornejo@gmail.com¶
This work has benefited from the discussions of restconf resource collection over the years, in particular, [I-D.ietf-netconf-restconf-collection] which provides enhanced filtering features for the retrieval of data nodes with the GET method. The authors would like to thank the following for lively discussions on list:¶
Andy Bierman Martin Björklund Robert Varga¶
The examples within this document use the "example-module" YANG module defined in Appendix A of [I-D.wwlh-netconf-list-pagination-nc].¶
In this example, the client requests the first two "skill" resources for a given admin resource:¶
Request from the RESTCONF client: GET /restconf/data/example-module:get-list-pagination HTTP/1.1 Host: example.com Accept: application/yang-collection+xml <yang-collection xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <datastore>running</datastore> <list-target>admins/admin[name=Bob]/skill</list-target> <count>2</count> </yang-collection> </netconf:rpc> Response from the RESTCONF server: HTTP/1.1 200 OK Date: Thu, 26 Jan 2017 20:56:30 GMT Server: example-server Last-Modified: Thu, 26 Jan 2017 20:55:30 GMT Content-Type: application/yang-collection+xml <pageable-list xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <skill xmlns="http://example.com/ns/example-module"> <name>Problem Solving</name> <rank>98</rank> ... </skill> <skill xmlns="http://example.com/ns/example-module"> <name>Conflict Resolution</name> <rank>93</rank> ... </skill> </pageable-list> </netconf:rpc-reply>¶
In this example, the client requests the next two skills resource, i.e., two skills resource starting from two.¶
GET /restconf/data/example-module:get-list-pagination HTTP/1.1 Host: example.com Accept: application/yang-collection+xml <yang-collection xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <datastore>running</datastore> <list-target>admins/admin[name=Bob]/skill</list-target> <count>2</count> <skip>2</skip> </yang-collection> </netconf:rpc> Response from the RESTCONF server: HTTP/1.1 200 OK Date: Thu, 26 Jan 2017 20:56:30 GMT Server: example-server Last-Modified: Thu, 26 Jan 2017 20:55:30 GMT Content-Type: application/yang-collection+xml <pageable-list xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <skill xmlns="http://example.com/ns/example-module"> <name>Problem Solving</name> <rank>98</rank> ... </skill> <skill xmlns="http://example.com/ns/example-module"> <name>Conflict Resolution</name> <rank>93</rank> ... </skill> </pageable-list> </netconf:rpc-reply>¶
In this example, the client requests the first two "skill" resources in the 'forwad' direction for a given admin:¶
GET /restconf/data/example-module:get-list-pagination HTTP/1.1 Host: example.com Accept: application/yang-collection+xml <yang-collection xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <datastore>running</datastore> <list-target>admins/admin[name=Bob]/skill </list-target> <count>2</count> <direction>forward</direction> </yang-collection> </netconf:rpc> Response from the RESTCONF server: HTTP/1.1 200 OK Date: Thu, 26 Jan 2017 20:56:30 GMT Server: example-server Last-Modified: Thu, 26 Jan 2017 20:55:30 GMT Content-Type: application/yang-collection+xml <pageable-list xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <skill xmlns="http://example.com/ns/example-module"> <name>Problem Solving</name> <rank>98</rank> ... </skill> <skill xmlns="http://example.com/ns/example-module"> <name>Conflict Resolution</name> <rank>93</rank> ... </skill> </pageable-list> </netconf:rpc-reply>¶
In this example, the client requests the first 2 "skill" resources sorted by name for a given admin:¶
GET /restconf/data/example-module:get-list-pagination HTTP/1.1 Host: example.com Accept: application/yang-collection+xml <yang-collection xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <datastore>running</datastore> <list-target>admins/admin[name=Bob]/skill </list-target> <count>2</count> <sort>name</sort> </yang-collection> </netconf:rpc> Response from the RESTCONF server: HTTP/1.1 200 OK Date: Thu, 26 Jan 2017 20:56:30 GMT Server: example-server Last-Modified: Thu, 26 Jan 2017 20:55:30 GMT Content-Type: application/yang-collection+xml <pageable-list xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <skill xmlns="http://example.com/ns/example-module"> <name>Problem Solving</name> <rank>98</rank> ... </skill> <skill xmlns="http://example.com/ns/example-module"> <name>Conflict Resolution</name> <rank>93</rank> ... </skill> </pageable-list> </netconf:rpc-reply>¶
In this example, the client requests the first 2 "skill" resources from the selected skill resource list for a given admin:¶
GET /restconf/data/example-module:get-list-pagination HTTP/1.1 Host: example.com Accept: application/yang-collection+xml <yang-collection xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <datastore>running</datastore> <list-target>admins/admin[name=Bob]/skill</list-target> <count>2</count> <where>[position>=2 and position<=9]</where> </yang-collection> </netconf:rpc> Response from the RESTCONF server: HTTP/1.1 200 OK Date: Thu, 26 Jan 2017 20:56:30 GMT Server: example-server Last-Modified: Thu, 26 Jan 2017 20:55:30 GMT Content-Type: application/yang-collection+xml <pageable-list xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <skill xmlns="http://example.com/ns/example-module"> <name>Problem Solving</name> <rank>98</rank> ... </skill> <skill xmlns="http://example.com/ns/example-module"> <name>Conflict Resolution</name> <rank>93</rank> ... </skill> </pageable-list> </netconf:rpc-reply>¶
In this example, the client requests the first 2 "skill" resources from the selected "skill" resource list for a given admin:¶
GET /restconf/data/example-module:get-list-pagination HTTP/1.1 Host: example.com Accept: application/yang-collection+xml <yang-collection xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <datastore>running</datastore> <list-target> admins/admin[name=Bob]/skill </list-target> <count>2</count> <skip>2</skip> <where>position>=2 and position<=9</where> </yang-collection> </netconf:rpc> Response from the RESTCONF server: HTTP/1.1 200 OK Date: Thu, 26 Jan 2017 20:56:30 GMT Server: example-server Last-Modified: Thu, 26 Jan 2017 20:55:30 GMT Content-Type: application/yang-collection+xml <pageable-list xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <skill xmlns="http://example.com/ns/example-module"> <name>Problem Solving</name> <rank>98</rank> ... </skill> <skill xmlns="http://example.com/ns/example-module"> <name>Conflict Resolution</name> <rank>93</rank> ... </skill> </pageable-list> </netconf:rpc-reply>¶
In this example, the client requests the first 2 "skill" resources from the selected skill resources list for a given admin:¶
GET /restconf/data/example-module:get-list-pagination HTTP/1.1 Host: example.com Accept: application/yang-collection+xml <yang-collection xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <datastore>running</datastore> <list-target> admins/admin[name=Bob]/skill </list-target> <count>2</count> <skip>2</skip> <sort>name</sort> <where>position>=2 and position<=9</where> </yang-collection> </netconf:rpc> Response from the RESTCONF server: HTTP/1.1 200 OK Date: Thu, 26 Jan 2017 20:56:30 GMT Server: example-server Last-Modified: Thu, 26 Jan 2017 20:55:30 GMT Content-Type: application/yang-collection+xml <pageable-list xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"> <skill xmlns="http://example.com/ns/example-module"> <name>Problem Solving</name> <rank>98</rank> ... </skill> <skill xmlns="http://example.com/ns/example-module"> <name>Conflict Resolution</name> <rank>93</rank> ... </skill> </pageable-list> </netconf:rpc-reply>¶