Hi Jan, Thank you for the test.
From: Anima <[email protected]> On Behalf Of Jan Lindblad Sent: Donnerstag, 4. August 2022 12:23 To: Michael Richardson <[email protected]> Cc: [email protected]; [email protected] Subject: Re: [Anima] [netmod] mcr's YANG question raised during the ANIMA WG session Michael, I had a look at your test example. The example is invalid, but pyang fails to detect the error and overwrites some internal structures, with the result below. The root cause of the problem is this: module ietf-voucher-D { ... uses b:voucher-request-prm-grouping { augment "voucher" { } } uses c:voucher-request-constrained-grouping { augment "voucher" { } } } Each one of the two uses statement brings in a "container voucher" (with partly different content) at this point in the schema. That is an attempt at a duplicate definition of voucher, which is an error. Pyang misses this, and overwrites one voucher object with the next, losing some of the content. By placing the two uses statements into separate containers, pyang is able to successfully make a tree: module: ietf-voucher-D +--rw x1 | +--rw voucher | +--rw created-on? yang:date-and-time | +--rw expires-on? yang:date-and-time | +--rw assertion? enumeration | +--rw serial-number string | +--rw idevid-issuer? binary | +--rw pinned-domain-cert? binary | +--rw domain-cert-revocation-checks? boolean | +--rw nonce? binary | +--rw last-renewal-date? yang:date-and-time | +--rw prior-signed-voucher-request? binary | +--rw proximity-registrar-cert? binary | +--rw agent-signed-data? binary | +--rw agent-provided-proximity-registrar-cert? binary | +--rw agent-sign-cert* binary +--rw x2 +--rw voucher +--rw created-on? yang:date-and-time +--rw expires-on? yang:date-and-time +--rw assertion enumeration +--rw serial-number string +--rw idevid-issuer? binary +--rw pinned-domain-cert? binary +--rw domain-cert-revocation-checks? boolean +--rw nonce? binary +--rw last-renewal-date? yang:date-and-time +--rw proximity-registrar-pubk? binary +--rw proximity-registrar-pubk-sha256? binary +--rw proximity-registrar-cert? binary +--rw prior-signed-voucher-request? binary Normally in YANG, it wouldn't be hard to to let modules "B" and "C" augment module "A" independently. But here you are working with groupings in such a way that both "B" and "C" build up a complete grouping with everything in "A". When "D" tries to use both "B" and "C", there is inevitably unwanted duplication. If instead, "B" and "C" just defined their little contributions, "D" could import groupings from "A", "B" and "C" and compose them as desired. [stf] Just to be sure, you said you would recommend to avoid the "use" statement, which leads to duplication when creating "D". I understand this for the inclusion case. If we use voucher B stand alone without the "use" statement wouldn't we miss a part of the voucher? Or would you recommend to move the use out of the grouping? Regards Steffen Best Regards, /jan
_______________________________________________ netmod mailing list [email protected] https://www.ietf.org/mailman/listinfo/netmod
