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.

Best Regards,
/jan

_______________________________________________
Anima mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/anima

Reply via email to