Open rgwilton opened 6 years ago
Isn't it exactly what extensions are good for?
I want a way to annotation an existing module with extension statements without having to modify the source YANG module. I.e. put all of the extension statements in another YANG file.
OK, I understand, this wasn't clear from the original description. I agree it would be useful.
As an example of a vendor-specific implementation, Tail-f has:
tailf:annotate /mod:path/mod:to/mod:schema/mod:node {
extmod:extension argument;
extmod:other-extension other-argument;
}
It works like augment
essentially, but instead of adding new schema nodes it adds metadata extensions.
OpenDaylight has some outstanding work in this regard -- https://jira.opendaylight.org/browse/YANGTOOLS-575 is about defining an extension which can mutate declared YANG in pretty much arbitrary ways, the scope is limited to adding because that's all we need.
I think this is better done with extensions. No need to have it in the language.
@mbj4668 can you explain why?
It seems that are a few different implementations achieving the same thing. Putting this directly in the language may make it easier for tooling. Defining standard common extensions to achieve this is another alternative.
@mbj4668 @rgwilton as an implementor, I do prefer standardized extensions over language revisions, as such extensions, by definition, do not change the language metamodel. With respect to functionality, it seems that tailf:annotate-statement is really what we need.
I think it adds noise to the language, but doing this as standard extensions could work.
Important to users. Seems like all vendors have their own solutions. The term "deviation" has bad stigma.
Issues #46 and #52 were closed in part with the assumption that this issue would be supported.
Martin: this can likely be done just with extensions
The naming is confusing here with rfc7952 metadata annotations
As a vendor we sometimes want to extend a YANG model by annotating it with extra metadata information. E.g. perhaps mappings to internal data-structures, or adding additional constraints.
Various vendors have their own implementations of an "annotation" extension that is used to add annotations to an existing YANG model.
In some cases, deviations can be used, but it doesn't work everywhere, and has a negative connotations.
Perhaps this should be considered in the next version of YANG? At least this would mean that generic tools would be able to understand these annotations, if required.