Re: [yang-doctors] Yang syntax for a globally-unique key?

Kent Watsen <kent@watsen.net> Tue, 25 August 2020 15:55 UTC

Return-Path: <0100017426549b2c-239db9f8-b897-469c-b054-1b5e157f995d-000000@amazonses.watsen.net>
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 75D903A10B8 for <yang-doctors@ietfa.amsl.com>; Tue, 25 Aug 2020 08:55:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.003
X-Spam-Level:
X-Spam-Status: No, score=0.003 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=amazonses.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 8pMFkgQ8Z3NQ for <yang-doctors@ietfa.amsl.com>; Tue, 25 Aug 2020 08:55:16 -0700 (PDT)
Received: from a48-95.smtp-out.amazonses.com (a48-95.smtp-out.amazonses.com [54.240.48.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6DBBB3A0EEC for <yang-doctors@ietf.org>; Tue, 25 Aug 2020 08:55:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1598370913; h=From:Message-Id:Content-Type:Mime-Version:Subject:Date:In-Reply-To:Cc:To:References:Feedback-ID; bh=0agqdpyGiWiCQf3hjXXW65U/TgQZU7jY/t9/EvufjXc=; b=FqRnNjy5cOD5TCSJ7FnukPH2bqLSUn68iGRRlRPSKBWOnpcwNVKVnc5MeGZ96i/d Uz7u0Hng+7pbsL8zj+es2Y8AyZDTN74WCJuutyUV3A7QEcaNjzb5W2J7VtRNqSXd/Ki Cn7HTk80MWe9mfVm0/9BCTDxdiRnEBtOGDaEI3D4=
From: Kent Watsen <kent@watsen.net>
Message-ID: <0100017426549b2c-239db9f8-b897-469c-b054-1b5e157f995d-000000@email.amazonses.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_B8820FA1-07E5-446E-B3AD-51474EEB5F12"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\))
Date: Tue, 25 Aug 2020 15:55:13 +0000
In-Reply-To: <9432DBC8-25E0-4063-BEA2-75641558D073@cisco.com>
Cc: Andy Bierman <andy@yumaworks.com>, YANG Doctors <yang-doctors@ietf.org>
To: "Reshad Rahman (rrahman)" <rrahman=40cisco.com@dmarc.ietf.org>
References: <0100017425c983cb-d9471cc6-34d3-4a49-ab7b-942bca5ae697-000000@email.amazonses.com> <CABCOCHRhE9EqpgKKHpvkCWrmE4JkQN6i5kAF4EMfXF=GA1EVQg@mail.gmail.com> <9432DBC8-25E0-4063-BEA2-75641558D073@cisco.com>
X-Mailer: Apple Mail (2.3608.80.23.2.2)
X-SES-Outgoing: 2020.08.25-54.240.48.95
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/-jI0LorNvUj3X0XeQzvNDAlr_ZY>
Subject: Re: [yang-doctors] Yang syntax for a globally-unique key?
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: Tue, 25 Aug 2020 15:55:19 -0000

Unique did not work with `yanglint`:

	err : Unique argument references list.

This MAY be a bug in yanglint.  Hard to say from that GitHub issue if this syntax is supposed to work or not.

Lada writes that a “must” statement could be used when a “unique” statement fails.  What might that “must” statement look like?

Kent


> On Aug 25, 2020, at 11:22 AM, Reshad Rahman (rrahman) <rrahman=40cisco.com@dmarc.ietf.org> wrote:
> 
> I don’t think unique-stmt works for this case, see https://github.com/netmod-wg/yang-next/issues/74 <https://github.com/netmod-wg/yang-next/issues/74>
>  
> Regards,
> Reshad.
>  
> From: yang-doctors <yang-doctors-bounces@ietf.org <mailto:yang-doctors-bounces@ietf.org>> on behalf of 'Andy Bierman' <andy@yumaworks.com <mailto:andy@yumaworks.com>>
> Date: Tuesday, August 25, 2020 at 11:08 AM
> To: Kent Watsen <kent@watsen.net <mailto:kent@watsen.net>>
> Cc: YANG Doctors <yang-doctors@ietf.org <mailto:yang-doctors@ietf.org>>
> Subject: Re: [yang-doctors] Yang syntax for a globally-unique key?
>  
>  
>  
> On Tue, Aug 25, 2020 at 6:23 AM Kent Watsen <kent@watsen.net <mailto:kent@watsen.net>> wrote:
>> [trying here before the “netmod” list]
>> 
>> YANG Doctors,
>> 
>> Assume data model:
>> 
>>   +—rw tenants
>>       +—rw tenant [key]
>>           +—rw  key        string
>>           +—rw admins
>>               +—rw admin [name]
>>                    +—rw name     string
>> 
>> The "admin" list’s key “name” ensures that the names are unique per tenant, but not globally.   Is it possible to place a “must” statement on the “tenants” container to ensure globally-unique admin names?
>> 
>> Can anyone offer syntax to do so?
>> 
>  
> Isn't this a use-case for unique-stmt?
>  
>    list tenant {
>        unique "admins/admin/name";
>        ...
>    }
>  
>  
>> Kent
>> 
>  
>  
> Andy
>  
>> _______________________________________________
>> yang-doctors mailing list
>> yang-doctors@ietf.org <mailto:yang-doctors@ietf.org>
>> https://www.ietf.org/mailman/listinfo/yang-doctors <https://www.ietf.org/mailman/listinfo/yang-doctors>_______________________________________________
> yang-doctors mailing list
> yang-doctors@ietf.org <mailto:yang-doctors@ietf.org>
> https://www.ietf.org/mailman/listinfo/yang-doctors <https://www.ietf.org/mailman/listinfo/yang-doctors>