What about this scenario?

module base-module {
  prefix bmod;

  feature things;
  feature widgets;

  container things {
    if-feature things;
    ...
    container widgets {
      if-feature widgets;
      ...
    }
  }
}    

module augment-module {
  prefix amod;

  augment "/bmod:things" {
    container other-things {
    }
  }

  augment "/bmod:widgets" {
    container other-widgets {
    }
  }
}

At some point, a product wants to implement the base-module and the 
augment-module but does not support 'widgets'. How should this be handled? I 
realize that ideally you would have an augment module for things and another 
for widgets but let's say that is not the case and you are left with the above. 
The question then is does the augment need to be conditional via the same 
feature or does it implicitly inherit the feature of the augmented node?

Regards,
Joey

-----Original Message-----
From: Martin Bjorklund [mailto:[email protected]] 
Sent: Tuesday, March 14, 2017 12:40 PM
To: JOEY BOYD
Cc: [email protected]
Subject: Re: [netmod] augment and if-feature

Hi,

JOEY BOYD <[email protected]> wrote:
> Hi all,
> 
> An issue arose recently where a certain tool failed to build the 
> schema tree when a feature was turned off. The problem was that an 
> augmenting module did not have the same if-feature statement as the 
> node being augmented. For example, I have these two modules.
> 
> module base-module {
>   prefix bmod;
> 
>   feature do-things;
> 
>   container things {
>     if-feature do-things;
>     ...
>   }
> }
> 
> module augment-module {
>   prefix amod;
> 
>   augment "/bmod:do-things" {
>     container other-things {
>     }
>   }
> }
> 
> If I included both modules and turned off the feature, 'do-things', 
> the tool would complain that the node being augmented did not exist. 
> Forgetting the obvious solution of not including the augmenting module 
> if you don't support the feature (this is a very simplified example), 
> my thought was that the schema tree should first be built including 
> all augments, then the feature is applied.
> 
> What are your thoughts on this? Surely, an augment should not have to 
> contain if-feature statements of all parents of the augmented node.

The spec says:

   When a server implements a module containing an "augment" statement,
   that implies that the server's implementation of the augmented module
   contains the additional nodes.

Compare with a simple augment of a node w/o an if-feature.  In this case, if 
the server implements the augmenting module, it MUST also implement the 
augmented module.



/martin

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

Reply via email to