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

Reply via email to