Re: [netmod] Please clarify implementation about ‘when’

"Rob Wilton (rwilton)" <rwilton@cisco.com> Mon, 09 September 2019 13:41 UTC

Return-Path: <rwilton@cisco.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 E52B812025D for <netmod@ietfa.amsl.com>; Mon, 9 Sep 2019 06:41:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.499
X-Spam-Level:
X-Spam-Status: No, score=-14.499 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com header.b=mu49HWo9; dkim=pass (1024-bit key) header.d=cisco.onmicrosoft.com header.b=o330Ycsh
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 t8FVPVBfX71Y for <netmod@ietfa.amsl.com>; Mon, 9 Sep 2019 06:41:10 -0700 (PDT)
Received: from rcdn-iport-9.cisco.com (rcdn-iport-9.cisco.com [173.37.86.80]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2DF8D120047 for <netmod@ietf.org>; Mon, 9 Sep 2019 06:41:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=28585; q=dns/txt; s=iport; t=1568036470; x=1569246070; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=llg1ben/10Ny9G0clkhqtuWYzFQbh7aOGZz/N7g+b5o=; b=mu49HWo9QfjwO0a3YZ4TNg1OEbic1/TvXMevf0DbWODG6UsFFUc2y5mA vwmIWY/PR4sqMGxb3TFUfMZtQzNDMWUFv1+ALwfp/yDEOWzo2zgMuIERo raS000iexQut0qXO5TYgKQkLh0qGnKtx8BFyxKBwndMk0bjq+vE6GHnA1 4=;
IronPort-PHdr: 9a23:ieSRThBX/5vgVP0wVyD/UyQJPHJ1sqjoPgMT9pssgq5PdaLm5Zn5IUjD/qs13kTRU9Dd7PRJw6rNvqbsVHZIwK7JsWtKMfkuHwQAld1QmgUhBMCfDkiuNuHrazA9GuxJVURu+DewNk0GUMs=
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0AeAAAlVnZd/40NJK1lGQEBAQEBAQEBAQEBAQcBAQEBAQGBVgEBAQEBAQsBgRUvUANtViAECyoKhBeDRwOKdIJcfpZyglIDVAkBAQEMAQEjCgIBAYQ/AoI4IzcGDgIDCQEBBAEBAQIBBgRthS4MhUoBAQEBAxIPAQsTAQE3AQ8CAQgRBAEBEBEBCAMCMhoDAQcBAQQBDQUIGluCJoEdTQMdAQIMigaQYQKBOIhhbgGBNoE6gUMBAQWFERiCFgmBNAGLdxiBQD+BEUaCFzU+gmEBAQIBgUgYKxGCSjWCJoxrGGiGc4IzlTMKgiGGf44QgjSHPI8SjX6IApBpAgQCBAUCDgEBBYFoIoFYcBWDJwmCOYNyhRSFP3MBAYEnjHCBMQGBIgEB
X-IronPort-AV: E=Sophos;i="5.64,484,1559520000"; d="scan'208,217";a="540850862"
Received: from alln-core-8.cisco.com ([173.36.13.141]) by rcdn-iport-9.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 09 Sep 2019 13:41:02 +0000
Received: from xch-rcd-011.cisco.com (xch-rcd-011.cisco.com [173.37.102.21]) by alln-core-8.cisco.com (8.15.2/8.15.2) with ESMTPS id x89Df2RW023995 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 9 Sep 2019 13:41:02 GMT
Received: from xhs-rcd-002.cisco.com (173.37.227.247) by XCH-RCD-011.cisco.com (173.37.102.21) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 9 Sep 2019 08:41:02 -0500
Received: from xhs-aln-001.cisco.com (173.37.135.118) by xhs-rcd-002.cisco.com (173.37.227.247) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 9 Sep 2019 08:41:01 -0500
Received: from NAM03-DM3-obe.outbound.protection.outlook.com (173.37.151.57) by xhs-aln-001.cisco.com (173.37.135.118) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 9 Sep 2019 08:41:01 -0500
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YZh/yKmlwKPUXCHlvm9a1EwZapV0+VcJug3A3yHS8/eLI7kIusKqm9xpw78MRkP8obLdKz35quskmV81nXW4QmH/9sw3J5I2Bam7bVu3Sl6P8FIbgCk4NJSedrvHrjq2PA0Xsh+uoaBGbbQAlfv594Frsfw21+tp+o/2PLMOrEHhAto3ZnAsBBhDXhquldj1QaJd2LNJzxP6E6hTzXtEAW+t3NhM5d8FKst4/I1mi3ky1NFHGXi+Ok5/NY7hJrMD3x04FCrO4k0TA9/8rELRZT+CWIg8aO2vNwSQI7AznS4SWucky/Zo+IBmnThD802G2bDzCabxF6ziv3YZOiVIhA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YB4iNjxJ1A0MDlLFmDuAcq4YaH8Vy4lYXLkEG4HUrZU=; b=OzumGpF3NJoqhd2fb0XAwT7UF4JfmqFyrgvWoeUMCKv6MWBQjF73poBxmyXH88D1z0H6Krstt3Nu/db7F3k1qZn2ZX9h4PlzK+TrVZCxwxqJ9UKuA3yrqcCVI9dFqgbu7gdlqsw6ylo4cyXOubxbk0Cn4TA1LmFVTXuY280e6zhxKzjhArOQYlwlzz0ACVX9+rZFLxHkHedGHBlWQJ9sDtChwYgTpgAMzvB4naWYN/2XKA6IAU6HhOqJr/0BC5M54PWl+/uj3PwS3FD2VN7aDZObaYJsWSiyQaloSMTq+nOZw2Z4a7a0q2frHSu14KUEbSvRlv7H6ejW962pQZiwZQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cisco.com; dmarc=pass action=none header.from=cisco.com; dkim=pass header.d=cisco.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.onmicrosoft.com; s=selector2-cisco-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YB4iNjxJ1A0MDlLFmDuAcq4YaH8Vy4lYXLkEG4HUrZU=; b=o330YcshhzhJ7s43ALnzk5op/xV+lo5278Dl2Nda3IpCllvPOcWtI11zYliFCQM9/Qk48Annf3fSgy8bnwAQIQy+GqeaJUnoJkfpx+nCTX8ceRYnWSC3wmg4UAkheblGIIXYQuROQoK48s9jcloMaUAYWN3Vz1s7hFwie6hjPMk=
Received: from MN2PR11MB4366.namprd11.prod.outlook.com (52.135.38.209) by MN2PR11MB4494.namprd11.prod.outlook.com (52.135.39.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.18; Mon, 9 Sep 2019 13:40:57 +0000
Received: from MN2PR11MB4366.namprd11.prod.outlook.com ([fe80::6db3:f4c:467b:30f6]) by MN2PR11MB4366.namprd11.prod.outlook.com ([fe80::6db3:f4c:467b:30f6%7]) with mapi id 15.20.2241.018; Mon, 9 Sep 2019 13:40:57 +0000
From: "Rob Wilton (rwilton)" <rwilton@cisco.com>
To: "Fengchong (frank)" <frank.fengchong@huawei.com>, "netmod@ietf.org" <netmod@ietf.org>
CC: Yangang <yangang@huawei.com>
Thread-Topic: [netmod] Please clarify implementation about ‘when’
Thread-Index: AdVkgxkxStdW26xJTo+kz8dBb3TuVgCj2fBA
Date: Mon, 09 Sep 2019 13:40:56 +0000
Message-ID: <MN2PR11MB4366224F81AD9884FA130B37B5B70@MN2PR11MB4366.namprd11.prod.outlook.com>
References: <5756FB984666AD4BB8E1D63E2E3AA3D001F20F2C@dggemm513-mbs.china.huawei.com>
In-Reply-To: <5756FB984666AD4BB8E1D63E2E3AA3D001F20F2C@dggemm513-mbs.china.huawei.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=rwilton@cisco.com;
x-originating-ip: [173.38.220.40]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 3a76ee3d-bcf7-4a58-b971-08d7352b57da
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR11MB4494;
x-ms-traffictypediagnostic: MN2PR11MB4494:
x-ms-exchange-purlcount: 6
x-microsoft-antispam-prvs: <MN2PR11MB4494CCAB01FD687B316DB237B5B70@MN2PR11MB4494.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-forefront-prvs: 01559F388D
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(39860400002)(136003)(396003)(376002)(366004)(189003)(199004)(53754006)(9326002)(53936002)(9686003)(54896002)(7736002)(81156014)(6306002)(81166006)(64756008)(52536014)(102836004)(3846002)(790700001)(6116002)(256004)(14444005)(486006)(2906002)(66476007)(66446008)(446003)(236005)(66946007)(11346002)(55016002)(66066001)(476003)(74316002)(86362001)(53386004)(71190400001)(8936002)(4326008)(6246003)(71200400001)(110136005)(229853002)(316002)(76116006)(6506007)(53546011)(33656002)(66556008)(606006)(186003)(14454004)(5660300002)(25786009)(6436002)(26005)(478600001)(99286004)(2501003)(76176011)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR11MB4494; H:MN2PR11MB4366.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1;
received-spf: None (protection.outlook.com: cisco.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: Lj04t7FVir2pW6Alcbitvx/EqSGe8Fv54Q1Wqtq0OEoIIj1MGzxgpobRaHWOfOBiZ4VxDEHyXOS8b+8Q+qQfiDWERib1EX8s9rezeyRFLtfgbtEa1P6AHrNrJBwP09h9+jLAL0X3kdmpn9K4c4tdmCjovYMerFNFcyQ7yRcs3cKympJLX4QgOaIjAjVzztb6COijowNilzEEa/qMshaQeixIr6fHeyRicoPWfxRGYUO7C7WLV7ElZCTUzmB+HyfnBe/Z9GLDenCHcvVMx/9SN3fnOHmO7APvqf4yMToVRazbLTW9EhtEDtCB8EaGqyMGmhaUzcTlJiGB9mAUGHnzeD7rzdofjISvhCCaI4pYRgcWo7O7rXogR1uB9P4I3g10km51xW/CU3C9Nf7OwXX0D4L9HFwylsD7zKjIasaV9iw=
x-ms-exchange-transport-forked: True
Content-Type: multipart/alternative; boundary="_000_MN2PR11MB4366224F81AD9884FA130B37B5B70MN2PR11MB4366namp_"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: 3a76ee3d-bcf7-4a58-b971-08d7352b57da
X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Sep 2019 13:40:56.8133 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: /eEUMjUuH+Bdhh/ER4qdv0BMteJxK/w1/Q6TbykPEa6XKi1A8QSyEVu6tVFWR8xydkNFhpXxg8ZYJ4jxtHO+TQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4494
X-OriginatorOrg: cisco.com
X-Outbound-SMTP-Client: 173.37.102.21, xch-rcd-011.cisco.com
X-Outbound-Node: alln-core-8.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/kTg6PmDZ8wy7VhTB-e5eofwhva0>
Subject: Re: [netmod] Please clarify implementation about ‘when’
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: Mon, 09 Sep 2019 13:41:13 -0000

Hi Frank,

My interpretation of what the expected behaviour is as follows.

For “scene 1”, the config change is accepted because the result of the config datastore after the edit-config has been applied is valid.

For “scene 2”, the config change is rejected because the result of the config datastore after the edit-config has been applied is invalid.

My interpretation is that the block of text in 8.3.1 payload parsing is primary intended to refer to RFC input.  E.g. if the RPC was defined something like below, then the ‘when’ rule in 8.3.1 would enforce that a zip-code can only be provided if the country is the USA.

       rpc rock-the-house {
         input {
           leaf country {
             type string;
           }
           leaf zip-code {
             when “../country = ‘usa’”;
             type string;
           }
         }
       }

Thanks,
Rob



From: netmod <netmod-bounces@ietf.org> On Behalf Of Fengchong (frank)
Sent: 06 September 2019 08:19
To: netmod@ietf.org
Cc: Yangang <yangang@huawei.com>
Subject: [netmod] Please clarify implementation about ‘when’

Hi all,

In RFC7950 secton 8, several description about when:
In section 8.2<https://tools.ietf.org/html/rfc7950#section-8.2>.  Configuration Data Modifications
   o  If a request modifies a configuration data node such that any
      node's "when" expression becomes false, then the node in the data
      tree with the "when" expression is deleted by the server.
In 8.3.1<https://tools.ietf.org/html/rfc7950#section-8.3.1>.  Payload Parsing

   o  If data for a node tagged with "when" is present and the "when"

      condition evaluates to "false", the server MUST reply with an

      "unknown-element" <error-tag> in the <rpc-error>.

In 8.3.2<https://tools.ietf.org/html/rfc7950#section-8.3.2>.  NETCONF <edit-config> Processing

Modification requests for nodes tagged with "when", and the "when"

      condition evaluates to "false".  In this case, the server MUST

      reply with an "unknown-element" <error-tag> in the <rpc-error>.

YANG module:
module foo {
   namespace “http://foo.com”;
   prefix “foo”;
Leaf a {…}
Leaf b {
  When “a = 10”;
}
}
Scene 1:
The first edit-config request:
<edit-config>
   <target>
      <candidate/>
   </target>
   <config>
      <a xmlns= “http://foo.com”>3</a>
   </config>
</edit-config>
This request will set a = 3.

The second request:
<edit-config>
   <target>
      <candidate/>
   </target>
   <config>
      <a xmlns= “http://foo.com”>10</a>
      <b xmlns= “http://foo.com”>5</b>
   </config>
</edit-config>

According 8.3.1, in rpc payload parsing phase, the a’s value in candidate datastore is 3,so leaf b’s when condition is evaluated to false, server will report ‘unknown-element’ error.
Is it expected by user?
Scene 2:
The first edit-config request:
<edit-config>
   <target>
      <candidate/>
   </target>
   <config>
      <a xmlns= “http://foo.com”>10</a>
   </config>
</edit-config>
This request will set a = 10.

The second request:
<edit-config>
   <target>
      <candidate/>
   </target>
   <config>
      <a xmlns= “http://foo.com”>3</a>
      <b xmlns= “http://foo.com”>5</b>
   </config>
</edit-config>
According 8.3.1, in rpc payload parsing phase, the a’s value in candidate datastore is 10, so leaf b’s when condition is evaluated to true, server will accept this request in payload parsing phase.

In edit-config request processing phase, if leaf a’s modification is processed firstly, the a’s value will be changed to 3, so the b’s when condition will be false, when server process b’s modification, b will be treated as unknown-element, the edit-config request will fail.
If leaf b’s modification is processed firstly, server will accept this modification ,because b’s when condition is true, and when server process a’s modification , this modification will be accepted, and b’s when condition will be evaluated to false, leaf b will be deleted automatically, the edit-config request will be OK.

How server should process this situation?