[netmod] CRUD operations on Leaf-list in RFC8040

Qin Wu <bill.wu@huawei.com> Wed, 25 September 2019 11:54 UTC

Return-Path: <bill.wu@huawei.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 920B3120122 for <netmod@ietfa.amsl.com>; Wed, 25 Sep 2019 04:54:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.19
X-Spam-Level:
X-Spam-Status: No, score=-4.19 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_MIME_MALF=0.01] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aDhbADF12zb2 for <netmod@ietfa.amsl.com>; Wed, 25 Sep 2019 04:54:31 -0700 (PDT)
Received: from huawei.com (lhrrgout.huawei.com [185.176.76.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2309D1201AA for <netmod@ietf.org>; Wed, 25 Sep 2019 04:54:31 -0700 (PDT)
Received: from lhreml707-cah.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 18F4835B61134AC3FA65 for <netmod@ietf.org>; Wed, 25 Sep 2019 12:54:29 +0100 (IST)
Received: from lhreml703-chm.china.huawei.com (10.201.108.52) by lhreml707-cah.china.huawei.com (10.201.108.48) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 25 Sep 2019 12:54:29 +0100
Received: from lhreml703-chm.china.huawei.com (10.201.108.52) by lhreml703-chm.china.huawei.com (10.201.108.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:54:28 +0100
Received: from DGGEML421-HUB.china.huawei.com (10.1.199.38) by lhreml703-chm.china.huawei.com (10.201.108.52) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:54:28 +0100
Received: from DGGEML511-MBS.china.huawei.com ([169.254.4.185]) by dggeml421-hub.china.huawei.com ([10.1.199.38]) with mapi id 14.03.0439.000; Wed, 25 Sep 2019 19:54:15 +0800
From: Qin Wu <bill.wu@huawei.com>
To: "netmod@ietf.org" <netmod@ietf.org>
CC: Zengjuan <annette.zeng@huawei.com>
Thread-Topic: CRUD operations on Leaf-list in RFC8040
Thread-Index: AdVzlF1slQHq13wqRTm4LDQAl58axQ==
Date: Wed, 25 Sep 2019 11:54:15 +0000
Message-ID: <B8F9A780D330094D99AF023C5877DABAA9322BD1@dggeml511-mbs.china.huawei.com>
Accept-Language: zh-CN, en-US
Content-Language: zh-CN
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [10.134.31.203]
Content-Type: multipart/alternative; boundary="_000_B8F9A780D330094D99AF023C5877DABAA9322BD1dggeml511mbschi_"
MIME-Version: 1.0
X-CFilter-Loop: Reflected
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/FZg5cSEf3t48tmCXQlgG8_NKTHI>
Subject: [netmod] CRUD operations on Leaf-list in RFC8040
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Sep 2019 11:54:34 -0000

Hi, All:
During implementing RFC8040, we face a few problems related to leaf-list usage.
I am wondering how do we create multiple instance of leaf-list data resource?
Suppose we have example-foo.yang model as follows:
example-top.yang

   container top {
    list list1 {
        key "key1 key2 key3";
         ...
         list list2 {
             key "key4 key5";
             ...
             leaf X { type string; }
         }
     }
     leaf-list Y {
       type uint32;
     }
}
To create a new "Y" resource within the "top" resource, can we make
the client send the following request:
POST /restconf/data/example-top:top HTTP/1.1
Host: example.com
Content-Type: application/yang-data+json

{
  "example-top:Y" : [value1,value2]
}

response:
HTTP/1.1 201 Created
Date: Thu, 26 Jan 2017 20:56:30 GMT
Server: example-server
Location: https://example.com/restconf/data/example-top:top/Y=value1&value2
Last-Modified: Thu, 26 Jan 2017 20:56:30 GMT
ETag: "b3830f23a4c"

Also I don’t understand why we add limitation to PUT method and plain patch method on leaf-list and don’t allow
The value of leaf-list instance to be changed by these two methods
see section 4.5 and section 4.6.1
“
4.5.  PUT
   If the target resource represents a YANG leaf-list, then the PUT
   method MUST NOT change the value of the leaf-list instance.
4.6.1.  Plain Patch
   If the target resource represents a YANG leaf-list, then the PATCH
   method MUST NOT change the value of the leaf-list instance.
“
Suppose I want to delete all leaf-list instance values associated with leaf-list "Y",
Can I send the following request:
DELETE /restconf/data/example-top:top/Y  HTTP/1.1
Host: example.com

Quoted section 4.7:
“
4.7.  DELETE
   If the target resource represents a configuration leaf-list or list
   data node, then it MUST represent a single YANG leaf-list or list
   instance.  The server MUST NOT use the DELETE method to delete more
   than one such instance.
”
It seems obvious that DELETE method can not delete more than one instances. But I don’t know why?


Also I don’t know we add constraint on XML encoding in the Get request, only allow one single element be
returned for XML encoding, see section 4.3 of RFC8040 as follows:
“
4.3.  GET
   If a retrieval request for a data resource representing a YANG
   leaf-list or list object identifies more than one instance and XML
   encoding is used in the response, then an error response containing a
   "400 Bad Request" status-line MUST be returned by the server.
“
Suppose I want to retrieve/delete/modify multiple leaf-list instance data resource, can I wrap leaf-list "Y" within container "top",
create/delete/modify container "top" data resource?
“
Comments?

-Qin