Re: [netmod] Augmentation with a mandatory leaf in a submodule - Is the following legal?

"Beauville, Yves (Nokia - BE/Antwerp)" <yves.beauville@nokia.com> Fri, 15 February 2019 11:51 UTC

Return-Path: <yves.beauville@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 3548F130DC9 for <netmod@ietfa.amsl.com>; Fri, 15 Feb 2019 03:51:45 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=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 0Udqjg071I0k for <netmod@ietfa.amsl.com>; Fri, 15 Feb 2019 03:51:41 -0800 (PST)
Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50092.outbound.protection.outlook.com [40.107.5.92]) (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 2AEC6130FB1 for <netmod@ietf.org>; Fri, 15 Feb 2019 03:51:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XgpcWOVFFEac1qrzd3F5jQwBn3bquuzBF6JPlXtgxaM=; b=Z+oP/jboEaMgEKGNdAI7BbT/1Bssaww/Cx6y1HX81O+o7YyaQOecVajxippYJ2bLc+/wxLDIFf7J3sNiwcalRgVOacii82YcG1UeWdGeJpPg736pg1PTRraI1xi0nspys9NaA6RfB1okCGjzGn8fMHdqq6idCitGwFqFlk8OeEY=
Received: from VI1PR07MB5792.eurprd07.prod.outlook.com (20.178.121.222) by VI1PR07MB4845.eurprd07.prod.outlook.com (20.177.63.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.8; Fri, 15 Feb 2019 11:51:38 +0000
Received: from VI1PR07MB5792.eurprd07.prod.outlook.com ([fe80::b1cf:d9b9:6654:e6bf]) by VI1PR07MB5792.eurprd07.prod.outlook.com ([fe80::b1cf:d9b9:6654:e6bf%4]) with mapi id 15.20.1643.008; Fri, 15 Feb 2019 11:51:38 +0000
From: "Beauville, Yves (Nokia - BE/Antwerp)" <yves.beauville@nokia.com>
To: Robert Wilton <rwilton@cisco.com>, "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: [netmod] Augmentation with a mandatory leaf in a submodule - Is the following legal?
Thread-Index: AQHUxQ6Rb/ufk4ALnEO3ok4pna4OcaXgoqMAgAAc2YA=
Date: Fri, 15 Feb 2019 11:51:38 +0000
Message-ID: <4d8d77d8-f576-c4e1-754e-04ad4eaf09f8@nokia.com>
References: <6b988ca0-7634-6a57-e984-6553f8f706b7@nokia.com> <b97a5f89-b547-203c-d03f-ba68f83708e5@cisco.com>
In-Reply-To: <b97a5f89-b547-203c-d03f-ba68f83708e5@cisco.com>
Accept-Language: fr-BE, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [131.228.32.166]
user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0
x-clientproxiedby: LNXP123CA0002.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:d2::14) To VI1PR07MB5792.eurprd07.prod.outlook.com (2603:10a6:803:cf::30)
authentication-results: spf=none (sender IP is ) smtp.mailfrom=yves.beauville@nokia.com;
x-ms-exchange-messagesentrepresentingtype: 1
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 2f6d8953-d62a-46aa-d09f-08d6933bf152
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7193020); SRVR:VI1PR07MB4845;
x-ms-traffictypediagnostic: VI1PR07MB4845:
x-ms-exchange-purlcount: 4
x-microsoft-exchange-diagnostics: 1;VI1PR07MB4845;23:j6wM4KP9kiq+LAmAhM8PGZq6JL83OQw9v/dtOh0F1sh0bemeIPG4uO3sV0nfDKVZTEjSTxzE5YQ6j69+hJjG3OVPESOUQl7l74LgCGBGVmvUPumA64kNx9IPfCiji30ikKLv6d6/3x1PSR6z+7/opPSMRo4dlb2v2LE2jCI3+WpjFW4YK2BI4Hv+QRpZTiNQSPPTuRv97Ohy0KuAwbJn9U+aXgIvFWIQu+J5Y/Vk/iTbIaehRiam8e8xPLelJsu0jo5Vft8F9tgAQAjuEOWpEIti06RU0e3cXNz+VgC7o6jYTcVLt9upeAMmg+U5hId9jU20RFCjUzP2yE+pb4qHMhCrYRnRk32henARltp9/ixGmHdsd3wxUR/5ZEaeB457Qe05LHXIe0dOIlvteiBXy0rLA6qVaYL2DVw4CFXUsQDQuO7DU/wuQdJDI0Z/tguMdmof+j4DoqCkIn5SqJEoy0obCNmZz7FGxWq9IhclPoGKYXBNNTgEru2MASpDxrm29gk6CSnjeIQmYFXCyGvOuCfXgHJJIoX2T2mj1KBZ4hEde+lQO9g2W9be0vjGcUxepW7n1ug+9xCIFPm63eSFh64LIRCxSvpVJEVF5hD+xtOPtyoNT5GzeahqiKCH8i4XwybStVrZB/6mSFP2bavoNz69OMW4666KDh4637fRFWUthqAYDhvPmCkPKZqSmNu5JJS0JBcXEpv9UEG6QuReugW8u6dZlGi67gKLwuMSJdBywFpdvCKKMceyH2q9bO9b81V6iXLl5ue4AWceAxlcHtehLJ8UVYWWDHr0tyW1etEeQAZATO5+PKqBEfvtLK074hi+QIs1+DG22idyre3fIX0w6/e2S2XZagwAOP5HvRmUrk3gZywQumXa7suIJDcSpK8xz/oCXuA3er4mzBqhYLqqFBLemYDQB00gszpEvPqNsoXkGEgX33TK6tGtaMnMJownsdh1eJKmqqt83v4wWclCByTG2emNARZZZxOqe9n7vhATd3s7yyYKqxJ34T+i6BHGVe7nqbZHc00x55ndxpIEYxzQ2m0hkm5Q0hMWbhBDkNTiAd3kh40Uvna/IYbjKi5+1Mx/tKUO22Wn3rtm4ZJWiTE/5x07JLCoTdu+I76UtsC6Vv3iZrq0sV0mXhyLDl/XVPEW8x8YCwikGXqHATsgw1KUTXVBvrMDM/WxhyNgGGXw/T9DA2yT3tuwRwqfi9OSken6Xk2oIQMkJNBURAJQ7HcoqYKH9PpOlsdqWbPkXGj0rhaMnxz6BINDr/gPsh7dsc9sa6CQZ3wcRXA9rnEWMt+Un8eR/ASB9i3R+GVMBau7ncVuD8LiJQ4vxb30jM8bWi1y26akvzvYHH6rG4jxs8lZ8YebyO1pyU4dM5+Irdr4fa23Jd+BecCfC0SEfYBQsLXRZmOYS2zxzGfpFc6qb/LAPqZnRhEvkjIFU00=
x-microsoft-antispam-prvs: <VI1PR07MB4845507E222C1BA284DC9E6B89600@VI1PR07MB4845.eurprd07.prod.outlook.com>
x-forefront-prvs: 09497C15EB
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(39860400002)(376002)(396003)(366004)(346002)(189003)(51444003)(199004)(476003)(26005)(14454004)(53936002)(31686004)(186003)(52116002)(256004)(14444005)(65806001)(86362001)(3846002)(11346002)(8936002)(966005)(53546011)(606006)(25786009)(2616005)(106356001)(6506007)(81156014)(105586002)(446003)(8676002)(81166006)(6116002)(2906002)(58126008)(386003)(486006)(71200400001)(110136005)(71190400001)(102836004)(31696002)(66066001)(65956001)(7736002)(97736004)(68736007)(65826007)(76176011)(229853002)(316002)(6246003)(6486002)(6436002)(99286004)(6306002)(54896002)(36756003)(64126003)(6512007)(478600001)(236005)(2501003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR07MB4845; H:VI1PR07MB5792.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1;
received-spf: None (protection.outlook.com: nokia.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: q7mjY+9len1IQaQ1tDSnDzYHuDM/hVQ6xqESeSA7gcyVtp210lxJPBGBYvTtA0tUMNQkE+QXFvJjkZQhcVDJLJrxI5AgmlS7VOcUVvhewmAzKDSA13YyZrVZP6XP3/Tc0YpTiuAhBOqtqxu5kF+8HB5KIVL7TWjGA4aqZ0Zm1QXwIc0zOWJ/DrOSCMhTMtjLkER3e3bAdTDUZQTI/1XiucUavMVxyjburRGK3+2jgueNCSc8JEzdAp2j9Et11O5PWKdA2/+SKaCGvXhIPd+vll/3hcmppwUBClGJF3pFuELnVaHw6xVDtTvkhVUML+YQJ1pV9Xnma7CJWX/faLKmPC0GGkj2mPzucUR0gN0sdWZ82qT5yQwThcPEo9/wsA35Gx0RQo1sLRVnlj8L0FAk2gRrNqXsMokZOJU10N+H/KA=
Content-Type: multipart/alternative; boundary="_000_4d8d77d8f576c4e1754e04ad4eaf09f8nokiacom_"
MIME-Version: 1.0
X-OriginatorOrg: nokia.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 2f6d8953-d62a-46aa-d09f-08d6933bf152
X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Feb 2019 11:51:37.6591 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-id: 5d471751-9675-428d-917b-70f44f9630b0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB4845
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/JOKeIpdaHO_k-UICQc0omjkfFQg>
Subject: Re: [netmod] Augmentation with a mandatory leaf in a submodule - Is the following legal?
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: Fri, 15 Feb 2019 11:51:49 -0000

Hi Rob,

Thank you very much for your fast reply, for proposing a mitigation, and for 'reducing' our set of YANG modules to pin-point the cause of the issue.

I am aligned with you. It is indeed a corner case. We will forward your feedback to OpenDaylight as well.

Thank you,

Yves

On 15-02-19 11:08, Robert Wilton wrote:

Hi Yves,

My interpretation of the spirit of the RFC is that this should be allowed, and I don't think that any text in 7.17 specifically prevents this.

However, this seems like a corner case, and I am also not surprised that a YANG compiler would fail on this.  This issue could perhaps be easily mitigated by making the second augmentation also conditional on the same when statement.

Note that the use of sub-modules doesn't really matter, in that a compiler can treat them as one module.  So, I think that the problem is equivalent to:

module module-a {
  yang-version 1.1;
  namespace "http://www.example.com/anothermodule"<http://www.example.com/anothermodule>;
  prefix am;

  container top {
    leaf type {
      type string;
      mandatory true;
    }
  }
}

module module-b {
  yang-version 1.1;
  namespace "http://www.example.com/module-b"<http://www.example.com/module-b>;
  prefix mm;

  augment '/am:top' {
    when "am:type = 'test'";
    container first-augment {
    }

  augment '/am:top/mm:first-augment' {
    leaf mandatory-leaf {
      type string;
      mandatory true;
     }
  }
}

Thanks,
Rob


On 15/02/2019 09:12, Beauville, Yves (Nokia - BE/Antwerp) wrote:
Hi,

We are working with a submodule in which we are augmenting a container of the same module with a mandatory node. There is a small catch though.

Our YANG modules are actually supporting two augmentations - I have copied a trimmed down version of our modules at the end of this mail -:

* From container 'top' in 'module-a' to container 'first-augment' in 'module-b' (sub-module-1) => This augmentation is made conditional with a 'when' statement.

* From container 'first-augment' to leaf 'mandatory-leaf'. This is done within two submodules of the same module 'module-b' => This augmentation is NOT conditional.

The Open Daylight parser rejects our YANG modules with the following error:

   Failed to add augmentation sub-module-1b.yang defined at sub-module-2b.yang org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: An augment cannot add node 'mandatory-leaf' because it is mandatory and in module different than target [at sub-module-2b.yang]

As per https://tools.ietf.org/html/rfc7950#section-7.17, we believe these augmentations are both legal'.

We have raised a ticket YANGTOOLS-956 at Open Daylight but folks at ODL are asking us to check with experts in this mailing list.

Can one assess if these models are making a 'legal' use of augmentations or not?

Yves

================================

module module-a {
  yang-version 1.1;
    namespace "http://www.example.com/anothermodule"<http://www.example.com/anothermodule>;
    prefix am;
    container top {
      leaf type {
        type string;
        mandatory true;
      }
  }
}
module module-b {
  yang-version 1.1;
    namespace "http://www.example.com/module-b"<http://www.example.com/module-b>;
   prefix mm;
   include sub-module-1;
   include sub-module-2;
}
submodule sub-module-1 {
   yang-version 1.1;
   belongs-to module-b {
    prefix mm;
  }
    import module-a {
    prefix am;
  }
  augment '/am:top' {
    when "am:type = 'test'";
    container first-augment {
    }
  }
}
submodule sub-module-2 {
  yang-version 1.1;
  belongs-to module-b {
    prefix mm;
  }
    import module-a {
    prefix am;
  }
  include sub-module-1;
  grouping dummygrouping {
    leaf mandatory-leaf {
      type string;
      mandatory true;
     }
  }
  augment '/am:top/mm:first-augment' {
    uses dummygrouping;
  }
}


_______________________________________________
netmod mailing list
netmod@ietf.org<mailto:netmod@ietf.org>
https://www.ietf.org/mailman/listinfo/netmod