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
[email protected]<mailto:[email protected]>
https://www.ietf.org/mailman/listinfo/netmod

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

Reply via email to