Re: [netmod] a question about 'when'

Andy Bierman <andy@yumaworks.com> Tue, 06 August 2019 15:10 UTC

Return-Path: <andy@yumaworks.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 C7C99120321 for <netmod@ietfa.amsl.com>; Tue, 6 Aug 2019 08:10:31 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.com
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 YVG_VsFspyzn for <netmod@ietfa.amsl.com>; Tue, 6 Aug 2019 08:10:29 -0700 (PDT)
Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 26A2E1200B9 for <netmod@ietf.org>; Tue, 6 Aug 2019 08:10:29 -0700 (PDT)
Received: by mail-lf1-x131.google.com with SMTP id p197so61407640lfa.2 for <netmod@ietf.org>; Tue, 06 Aug 2019 08:10:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=cYCx5v/0Z0ZkBOzEuLf07FY/a7zOgnrt3JtuddTZWLc=; b=sgMerl8RSDUpqOLgT0BhL2WsgccDC7C3gAPLbkuDFQcnmpmZaxJPwmCGeYdP4FEFk4 PXvBEN3U8NqvtENgyVH8QQbg5o7njWr/Jy+LRTCMXIdmT4qevzXb4JkcX3Tol+bdqQYV 1eSDNml9BsHYD2xRF8au2sJpR1ev0GoQkp5n8/VQaT79y78I8oKh7JEjlyRnbsQ+oCiF Ld3BTvDz/EOikLc+9mDs90G4hSqkhBNOj22CAThaGWvgszPOE9tibtGtQMZQLrwqbRYf 32smSch235WuKonFB70/2uqgK4szv9fngWTl0WHJX8g8nDXYy50+0jfarCwPLRCD1Pul Kaug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=cYCx5v/0Z0ZkBOzEuLf07FY/a7zOgnrt3JtuddTZWLc=; b=N+mMJtu6h+0yzrLbGoaEiEEB5tlktrTnh60QCWBx7vbgQE8agOtV8XsHWxSdFDzlug lN9v3oQtVtjlp+qZPt2Lw7ZhdVYlzDOpfmjDzjMWm/4ChHWraJZqdLkJpnul7f9QgRZx fQJvA46xNHTKX/0q2uRRwb/oUBIuZJIf+Xxx94Hf5Ga/Fm/0zdPTZaLGOUrI0VynN0vE /T6i4J4lT+qGztycBQ8TTALCwEtZpIEzYCkZpzr6HXlGWhWZvY39bdqz0YuEolq/0ssF n/V/8PKQRGjyHLYRvyP5QVmKoEaGjjxgfsgjSeK84OmjD1nDbQ5d1XQgOEYEWszt8Ea3 Dg6g==
X-Gm-Message-State: APjAAAWUQJQZQUl03oEpFoScKX+6L2m4sybnFbnwXC0CZN+R1FykKdW2 nvH6aEgR58vsVgQl2Zy5ItvRgV7yKcZjldg3GMf12rp6
X-Google-Smtp-Source: APXvYqyAJkvpTiBOXCIJSBP6KVknjBV85oGJ2RQS1wvP9leUeTUegVIzBWcw+rg0Z9W0Zy0Il8VTP2sRrzZt50sgvjg=
X-Received: by 2002:a19:f703:: with SMTP id z3mr2767410lfe.171.1565104227277; Tue, 06 Aug 2019 08:10:27 -0700 (PDT)
MIME-Version: 1.0
References: <5756FB984666AD4BB8E1D63E2E3AA3D001EE95B1@DGGEMM533-MBS.china.huawei.com> <87o914gcxn.fsf@nic.cz>
In-Reply-To: <87o914gcxn.fsf@nic.cz>
From: Andy Bierman <andy@yumaworks.com>
Date: Tue, 06 Aug 2019 08:10:15 -0700
Message-ID: <CABCOCHQLqB60o1JJQ24TV_ogZFKS3poJ8PxBZeM4+po==qZqcQ@mail.gmail.com>
To: "Fengchong (frank)" <frank.fengchong@huawei.com>, "netmod@ietf.org" <netmod@ietf.org>, "Zhangxiaoping (C)" <zhang.xiaoping@huawei.com>, liuzhiying <liuzhiying@huawei.com>
Content-Type: multipart/alternative; boundary="00000000000080f310058f743985"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/vPk7XAQnrYjX1fg_E3-IdWY1mxg>
Subject: Re: [netmod] a question 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: Tue, 06 Aug 2019 15:10:32 -0000

On Mon, Aug 5, 2019 at 2:49 AM Ladislav Lhotka <lhotka@nic.cz> wrote:

> "Fengchong (frank)" <frank.fengchong@huawei.com> writes:
>
> > Hi all,
> >
> > I encounter a question about 'when', when I implement yang model
> associated when condition.
> >
> > Yang model:
> >
> > leaf password-type {
> >    type enumeration {
> >       enum null;
> >       enum simple;
> >       enum cipher;
> >    }
> > }
> >
> > leaf password-text {
> > type string;
> > when "../password-type != null";
> > }
> >
> > I config these two leafs as below:
> > <password-type>simple</password-type>
> > <password-text>123456</password-text>
> >
> > And I changed password-type to null, I get the config like below:
> > <password-type>null</password-type>
> >
> > And then, I reconfig the password-type to simple, what data should be
> returned?
> >
> > Is
> >   <password-type>simple</password-type>
>
> According to RFC 7950, sec. 8.2, the server deleted "password-text" after
> you changed "password-type" to null but the original value isn't recovered
> after you change the type back.
>
> This server behaviour means that a typo or similar trivial error may have
> catastrophic consequences such as auto-deletion of entire configuration
> subtrees. That's why our RESTCONF implementation (jetconf) does something
> else: it won't permit you to change "password-type" to null as long as the
> "password-text" exists.
>
>
It seems odd to optimize the server for client mistakes.
It is far more likely (99 to 1?) that the client knows what it is doing and
expects
the standard to be followed.  Consider the burden on the client deleting all
the "false-when" nodes manually.  This is also inconsistent with the
standard
behavior for choice-stmt (new case deletes the old case automatically).

Lada
>
>
Andy


> >
> > Or
> >
> >   <password-type>simple</password-type>
> >   <password-text>123456</password-type>
> > _______________________________________________
> > netmod mailing list
> > netmod@ietf.org
> > https://www.ietf.org/mailman/listinfo/netmod
>
> --
> Ladislav Lhotka
> Head, CZ.NIC Labs
> PGP Key ID: 0xB8F92B08A9F76C67
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>