[netmod] leafref to multi-key list: can only use current() in 2nd leafref

"Sterne, Jason (Nokia - CA/Ottawa)" <jason.sterne@nokia.com> Thu, 20 May 2021 16:19 UTC

Return-Path: <jason.sterne@nokia.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 C57653A1C86 for <netmod@ietfa.amsl.com>; Thu, 20 May 2021 09:19:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nokia.onmicrosoft.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 qfqj65RdWkzp for <netmod@ietfa.amsl.com>; Thu, 20 May 2021 09:19:56 -0700 (PDT)
Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2120.outbound.protection.outlook.com [40.107.93.120]) (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 11A513A1C83 for <netmod@ietf.org>; Thu, 20 May 2021 09:19:55 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mmT9p8PdwhPrDAsZdUGFPIMK39oupNWMy3d7aLvqAy6LRCiKObbWpVPlt5ItOem2SkgxcQCnauijuESx2XceDBYi25c+b0oWNeAnbVrFXLveg23wyDp+hGNYjGBAoFPUst85hezz6L5ZfCrz/pKIMpvaz9bDTZmd5CrvAIzFDwgZyVJdeVeuOklbg+WVv1M+b6Qawj7luV2eovvPKEn0jxYHGbeqqjgRwJebEQRtSZIHee12pvRDM6VlMB7cxY7IU6adJ3qPiDocXDNpW36HY3ZuVnZ7JbT+AKSRV8cGZ7MgEk4CZG9qAJnLJD2IoEbOsjDpK6YdUw6rxYyRsP1eJw==
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=3SOa++QGMi6Lz3bRykR7ffTvfkkcsW/aSO8ZmTZiVwU=; b=d4y7jzI6tistxT4kZrzA8Chc/Zpx0QpZyMfYaTEYMSB58wv1pgGrfGxMtpfWiQZDP/aGuGqxEZABEwfIkBhRiSsuA6eS4P0nMuwtUaT1pXZA04yHbCdc7sh7fIDyVC319/GDTG21OCgSvEtd/rAfUV2zTU6hw31tuXD0qigKe34p4q5rxx7L677BrXfLdTpYqEzVuCsAdADtZylugCuVQNnY3wGmtLBbCHD7faaulNu0zbtqK0wKHvndtt6B+P/pO/mUCZK6vutjRZsghEASCEKcnM3aAR0L6j5RwJc2gncooLehTYahuVVMU8tdscpbYq178v+ftCI5x9fgkRWuYg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3SOa++QGMi6Lz3bRykR7ffTvfkkcsW/aSO8ZmTZiVwU=; b=qsczpf1xMNjnEnX4YT1AKVX4b1ykCVncGZzcO0dZU22AUnkK1lqE2PlygztYBlLCqBL16VgKh56+1zQwPpfC+iLu8CucMY2+V0jof8XgMogUqKLyAzTz9kZj2wH6NtIxoNUOTCDfRb5aThe5jUlYM5tTi31OeLhhEvMpnKVyf4o=
Received: from DM6PR08MB5084.namprd08.prod.outlook.com (2603:10b6:5:41::29) by DM5PR08MB2377.namprd08.prod.outlook.com (2603:10b6:3:6c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.25; Thu, 20 May 2021 16:19:54 +0000
Received: from DM6PR08MB5084.namprd08.prod.outlook.com ([fe80::616e:7de0:be27:e9b1]) by DM6PR08MB5084.namprd08.prod.outlook.com ([fe80::616e:7de0:be27:e9b1%3]) with mapi id 15.20.4129.031; Thu, 20 May 2021 16:19:54 +0000
From: "Sterne, Jason (Nokia - CA/Ottawa)" <jason.sterne@nokia.com>
To: "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: leafref to multi-key list: can only use current() in 2nd leafref
Thread-Index: AddNk9D/ORR56jGfST6vYvVZnkE38g==
Date: Thu, 20 May 2021 16:19:54 +0000
Message-ID: <DM6PR08MB5084F0CB6B01D6212491D91E9B2A9@DM6PR08MB5084.namprd08.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: ietf.org; dkim=none (message not signed) header.d=none;ietf.org; dmarc=none action=none header.from=nokia.com;
x-originating-ip: [23.233.24.194]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: c13c9a57-c9d9-4780-b887-08d91bab1a42
x-ms-traffictypediagnostic: DM5PR08MB2377:
x-microsoft-antispam-prvs: <DM5PR08MB2377B453C8A3B8D446B764A89B2A9@DM5PR08MB2377.namprd08.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: eHLRi8VKKkVnJQASFmHuV9ooxcZA0p1hb3GpeSPNaaYMDHotyDy2qPKiN/eH22lMlosQrdETxKh4qruljoyehUAhX7FiEYKhsb0VgH7E65sgRb4Ib7q7qrjmNSJk5b6OzhnEsmb81uBtEFB+heOZqn3ScmuYA1qFRNuVlwnkZsAV7O3dJM+IZhsb4BjlGq9v/IS/SK0Le1W4AZrptalQ/d2yowlZNQmWt8q+3XStScK2GOi1VM+05Uhd7T2Yj6EAtOFh4rCDKq8+Vhr8DLDPEgKkX6oE1TEChZFNIF+Tqnu87W82eOVBDTQPFcTII4NCyjq75VzDs/zoR5nPDUBewPD4uZHq4JI3dwmLEkW9PQgtRgm512eQ/Wn1jdg9ixewrxb/9Ttj1FmUFRujpyJq1sbNTltP74/Qge+5iG9mFbtnUPyiV/EfmalpS8I9t1OaCEDxwE7C4t1DBuH8I4rj6HZs74Ki+HlWB77++DBLwTE7JDIlxnKGqu7Ky7taIovY3ozsU/fakiWFImVtS3QyAB/KAo9coHunxS9JbpYLJl188TjL/xp7Z86eEwCuDZgWftt1owWzaU0ab3n/Dj+N2y3+cnmViui13RaccGJ/Td4=
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR08MB5084.namprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(396003)(346002)(39860400002)(136003)(366004)(86362001)(64756008)(66476007)(52536014)(55016002)(26005)(316002)(76116006)(66446008)(66556008)(66946007)(9686003)(6916009)(8676002)(6506007)(38100700002)(122000001)(71200400001)(33656002)(2906002)(5660300002)(7696005)(8936002)(186003)(478600001); DIR:OUT; SFP:1102;
x-ms-exchange-antispam-messagedata: 5yp+HMiEY5m7Nj+Y1AYlkc6QV/djswKwJEymIIHy40pCPR/9M3yMAa4cp3lD7tLudWA8guRBgicLDl7E5uOqW5gN9OQ+5Nb1LMa/n/laojV9kPCdW1lR3QjKN4nvSEPhX2H12p5+xI1X6Dk0YVAuxwATypSb20dFxQTCt0VS1O2VcSI45QRUO/OcdGXvMPHSzIbbSF2wqs2mBf5+Iz/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+SelfaAvecAdMkKZrYxYk9N5mf0cSBSRNhYqw/V9aercQUGtBZIlz5PTVCZKWdi0q
x-ms-exchange-transport-forked: True
Content-Type: multipart/alternative; boundary="_000_DM6PR08MB5084F0CB6B01D6212491D91E9B2A9DM6PR08MB5084namp_"
MIME-Version: 1.0
X-OriginatorOrg: nokia.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: DM6PR08MB5084.namprd08.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: c13c9a57-c9d9-4780-b887-08d91bab1a42
X-MS-Exchange-CrossTenant-originalarrivaltime: 20 May 2021 16:19:54.2675 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5d471751-9675-428d-917b-70f44f9630b0
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: MyvqFK6K5Ld7fX26UU54GdE8KtkuM80cWpwAPSGl6yNNN268An/pg9CpprJy2QxJLeiGVplD95wx/68CJK+iPA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR08MB2377
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/gXr7DmVies2Y-g1dlcMZL4VIBVk>
Subject: [netmod] leafref to multi-key list: can only use current() in 2nd leafref
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: Thu, 20 May 2021 16:19:59 -0000

Hi all,

In any examples I've seen where a YANG model contains a set of leafrefs to a multi-key list, or to a list key within a list, the "current()" xpath function is only in the 2nd leafref and never the first.

EXAMPLE A - OpenConfig  ACL model

      list acl-set {
        key "name type";

... snip ...

  grouping interface-ingress-acl-config {
    description
      "Configuration data for per-interface ingress ACLs";

    leaf set-name {
      type leafref {
        path "../../../../../../acl-sets/acl-set/config/name";
      }
      description
        "Reference to the ACL set name applied on ingress";
    }

    leaf type {
      type leafref {
        path "../../../../../../acl-sets/acl-set[name=current()/../set-name]" +
          "/config/type";
      }
      description
        "Reference to the ACL set type applied on ingress";
    }
  }

We've tried this type of 2-leaf leafref in some models, and yangLint complains (validating instance data) if we instead changed the first one to the following (this is just an illustrative example, we actually did a similar thing with our own models, not actually with this OpenCOnfig model):

    leaf set-name {
      type leafref {
        path "../../../../../../acl-sets/acl-set[type=current()/../type]/config/name";

      }
      description
        "Reference to the ACL set name applied on ingress";
    }

I'm not sure I understand why this wouldn't work. When all is said and done, both leafrefs would be satisfied if this is applied atomically. But maybe it is some sort of circular chicken-and-egg problem in resolving the value spaces ?

I suspect I'm missing some basic understanding here since:
- Other examples of 2-part leafrefs always only use current() in the 2nd leafref, and
- yangLint complains about this (with instance data)

Rgds,
Jason