Internet-Draft RESTCONF Pagination Support November 2020
Watsen, et al. Expires 6 May 2021 [Page]
Workgroup:
NETCONF Working Group
Internet-Draft:
draft-wwlh-netconf-list-pagination-rc-00
Published:
Intended Status:
Standards Track
Expires:
Authors:
K. Watsen
Watsen Network
Q. Wu
Huawei
O. Hagsand
H. Li
HPE

RESTCONF Extensions to Support List Pagination

Abstract

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.

Status of This Memo

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.

Table of Contents

1. Introduction

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.

1.1. Terminology

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:

  • server
  • startup configuration datastore
  • candidate configuration datastore
  • running configuration datastore
  • intended configuration datastore
  • operational state datastore
  • conventional configuration datastore
  • datastore schema
  • RPC operation

The following terms are defined in this document as follows:

2. RESTCONF Extensions

This section describes the RESTCONF extensions needed to support the Pagination mechanism.

2.1. RESTCONF Media Type

The following resource type is defined in this document:

               +-----------------+-----------------------------+
               | Resource        | Media Type                  |
               +-----------------+-----------------------------+
               | YANG-Collection | application/yang-collection |
               +-----------------+-----------------------------+
                           RESTCONF Media Type

2.2. New Resource Target

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.

3. YANG Module for List Pagination

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>

4. IANA Considerations

4.1. Registrations for New URI and YANG Module

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

4.2. Media Types

4.2.1. Media Type "application/yang-collection+xml"

   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

4.2.2. Media Type "application/yang-collection+json"

   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

5. Security Considerations

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.

6. Contributors

Per Andersson
perander@cisco.com

David Cornejo
dcornejo@gmail.com

7. Acknowledgements

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

8. References

8.1. Normative References

[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
[RFC3688]
Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, DOI 10.17487/RFC3688, , <https://www.rfc-editor.org/info/rfc3688>.
[RFC6020]
Bjorklund, M., Ed., "YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)", RFC 6020, DOI 10.17487/RFC6020, , <https://www.rfc-editor.org/info/rfc6020>.
[RFC6241]
Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., and A. Bierman, Ed., "Network Configuration Protocol (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, , <https://www.rfc-editor.org/info/rfc6241>.
[RFC6242]
Wasserman, M., "Using the NETCONF Protocol over Secure Shell (SSH)", RFC 6242, DOI 10.17487/RFC6242, , <https://www.rfc-editor.org/info/rfc6242>.
[RFC6243]
Bierman, A. and B. Lengyel, "With-defaults Capability for NETCONF", RFC 6243, DOI 10.17487/RFC6243, , <https://www.rfc-editor.org/info/rfc6243>.
[RFC6991]
Schoenwaelder, J., Ed., "Common YANG Data Types", RFC 6991, DOI 10.17487/RFC6991, , <https://www.rfc-editor.org/info/rfc6991>.
[RFC7950]
Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10.17487/RFC7950, , <https://www.rfc-editor.org/info/rfc7950>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/info/rfc8174>.
[RFC8341]
Bierman, A. and M. Bjorklund, "Network Configuration Access Control Model", STD 91, RFC 8341, DOI 10.17487/RFC8341, , <https://www.rfc-editor.org/info/rfc8341>.
[RFC8342]
Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., and R. Wilton, "Network Management Datastore Architecture (NMDA)", RFC 8342, DOI 10.17487/RFC8342, , <https://www.rfc-editor.org/info/rfc8342>.
[RFC8525]
Bierman, A., Bjorklund, M., Schoenwaelder, J., Watsen, K., and R. Wilton, "YANG Library", RFC 8525, DOI 10.17487/RFC8525, , <https://www.rfc-editor.org/info/rfc8525>.

8.2. Informative References

[RFC8340]
Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams", BCP 215, RFC 8340, DOI 10.17487/RFC8340, , <https://www.rfc-editor.org/info/rfc8340>.

Appendix A. RESTCONF YANG Collection Examples

The examples within this document use the "example-module" YANG module defined in Appendix A of [I-D.wwlh-netconf-list-pagination-nc].

A.1. "count" Parameter

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>

A.2. "skip" Parameter

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>

A.3. "direction" Parameter

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>

A.4. "sort" Parameter

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>

A.5. Combination of "where" and "count" Parameters

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>

A.6. Combination of "where", "count" and "skip" Parameters

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>

A.7. Combination of "where", "count","skip" and "sort" Parameters

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>

Authors' Addresses

Kent Watsen
Watsen Network
Qin Wu
Huawei
101 Software Avenue, Yuhua District
Nanjing
Jiangsu, 210012
China
Olof Hagsand
Hongwei Li
HPE