Re: [yang-doctors] conditional default?

Martin Björklund <mbj+ietf@4668.se> Sun, 23 May 2021 18:17 UTC

Return-Path: <mbj+ietf@4668.se>
X-Original-To: yang-doctors@ietfa.amsl.com
Delivered-To: yang-doctors@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D63A23A214E for <yang-doctors@ietfa.amsl.com>; Sun, 23 May 2021 11:17:20 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=4668.se header.b=MJhBUvhX; dkim=pass (2048-bit key) header.d=messagingengine.com header.b=kUxZ0X7p
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 GJ6ygnoVTCxY for <yang-doctors@ietfa.amsl.com>; Sun, 23 May 2021 11:17:15 -0700 (PDT)
Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 90EB23A213B for <yang-doctors@ietf.org>; Sun, 23 May 2021 11:17:15 -0700 (PDT)
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 1B414128A; Sun, 23 May 2021 14:17:10 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 23 May 2021 14:17:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=4668.se; h=date :message-id:to:cc:subject:from:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=fm1; bh= C+kD4ryaoMuIUBr+n6381rSSleJcLBjwhfJVDz6Zgx4=; b=MJhBUvhXOEMs+XjS WoWGca43u+N/464KUeQHw32scgbNK03lFc1SnJcQtsRMU8krv0FTaVV0rjehHJqh renqQw9X9r2m7e9O3FKxaG0AZalfNR7FTwBHsfCz6SUfAy/ttU4M2UCXMLmE9PZ8 2rKRZspuO+mwAn4KZ8SyNV5zRjbMCTKKvGKEFYRObeiL4lBF11B9BdeWQuPDjQbP ZKelyrU/3DF92zflZ0mWnXiTlAHniz2ihhDFMc0vr7z4ZJXpVKqe4bDxhwr9z8g7 WSDAF0pZwvTiLUcr1dWlVzW30BhO5Be1HrjxC+XsfO/RxDGLzEDD7s+BdDyAUTER G2QL5Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=C+kD4ryaoMuIUBr+n6381rSSleJcLBjwhfJVDz6Zg x4=; b=kUxZ0X7pqYdP49WAeOZpkC7ZIwAGUb+QPmoID4bLoBST+1J4uzU0GGbd3 ea/7r8l6d0O05D4+Cldnz2JGbPC2jeNwHw+gyH76d+kLZmdM5IKsJhbq+i1wkezo /xgciz5aZlYy61JlbLxIrKJ11YC67TrCoVYT8a6RYSA3Vo9Bhp5sWHUkLGQ4ebXo ec7frIcVLl7jKd5YiTDU661trI90P8PyJM9NNzZBkpGr6P8nBX0bkZGEXKDE+zqs 6EP+nW6edLwRgVB0DnNa7YZCqGVSvxrZ6wiApS6Q2bYFVjU/zC/Ehj2kFzIVdsTm BgQBvY4DQ4iRWSF3v5IMzU8jqi6Xw==
X-ME-Sender: <xms:JZyqYAHtAsCto9Pi2Fd4OnJF-bAgZ4scQzNmu8Aa9FqrXJh1tg7l6w> <xme:JZyqYJXrDwWdvVe_0SPzpTVjFyZUo0IKmoHYZ1K8AyWZ4vzsEc-Qns0R0DopGN8yj y07ffqskQDk2GtDyhU>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdejjedgjeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffkffvuffhjghfofggtgfgsehtje ertdertddvnecuhfhrohhmpeforghrthhinhcuuehjnphrkhhluhhnugcuoehmsghjodhi vghtfhesgeeiieekrdhsvgeqnecuggftrfgrthhtvghrnhepjeetgedvueelfeduudeule egfefgveevgfevueejhefhleeghfelieehfeffhfeknecuffhomhgrihhnpehivghtfhdr ohhrghenucfkphepudehkedrudejgedrgedrvdduheenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmsghjodhivghtfhesgeeiieekrdhsvg
X-ME-Proxy: <xmx:JZyqYKKEK9B1uy6rc1o5PErX4LqwqhRvjRM0PrPFTLTwUkl7fWj6Dw> <xmx:JZyqYCFx7MEt7y7kpE--BdzGSLbj03ubuM9F42G8uFy5wpmDtKPh_A> <xmx:JZyqYGWV_yPVM33rhNSTX31t_taK5o9OVRxVIV1mYil7chQaC89zpQ> <xmx:JZyqYBAcrJGgzf-xW7haYXOPJNJHlO4gJdg_FhQQq-4Pi5Qw1qtQgA>
Received: from localhost (h-158-174-4-215.a165.priv.bahnhof.se [158.174.4.215]) by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 23 May 2021 14:17:08 -0400 (EDT)
Date: Sun, 23 May 2021 20:17:07 +0200 (CEST)
Message-Id: <20210523.201707.196010256021596677.id@4668.se>
To: chopps@chopps.org
Cc: yang-doctors@ietf.org
From: Martin =?iso-8859-1?Q?Bj=F6rklund?= <mbj+ietf@4668.se>
In-Reply-To: <m2mtsm9j3a.fsf@ja.int.chopps.org>
References: <m2mtsm9j3a.fsf@ja.int.chopps.org>
X-Mailer: Mew version 6.8 on Emacs 26.3
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/pMi27pz44Is-hT7IBoAeCepev-I>
Subject: Re: [yang-doctors] conditional default?
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Email list of the yang-doctors directorate <yang-doctors.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/yang-doctors/>
List-Post: <mailto:yang-doctors@ietf.org>
List-Help: <mailto:yang-doctors-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 23 May 2021 18:17:21 -0000

Hi,

Christian Hopps <chopps@chopps.org> wrote:
> 
> I received this good question during the IESG review of geo location
> module:
> 
> > * Is WGS-84 still the default for geodetic-datum when astronomical-body
> > * != "earth"?
> > ...
> > I don't know enough YANG to know if the "when" statement is usable in
> > this case to constrain the applicability of this default or not.
> 
> Is there a way to specify a conditional default in YANG?

No.  But you can explain in the description statement what happens if
the leaf doesn't have a value configured.

> A separate but related issue I ran into the other day is that I have a
> Boolean in a grouping that can default to true or false (in the actual
> software) depending on where it is included... Also curious if that's
> solvable.

Yes, by using refine:

  uses the-grouping {
    refine the-leaf {
      default "true";
    }
  }


/martin




> 
> Thanks,
> Chris.
> 
> _______________________________________________
> yang-doctors mailing list
> yang-doctors@ietf.org
> https://www.ietf.org/mailman/listinfo/yang-doctors