libyang
3.4.2
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
|
YANG feature statement is an important part of the language which can significantly affect the meaning of the schemas. Modifying features may have similar effects as loading/removing schema from the context so it is limited to context preparation period before working with data. YANG features, respectively their use in if-feature statements, are evaluated as part of schema compilation so a feature-specific compiled schema tree is generated as a result.
To enable any features, they must currently be specified when implementing a new schema with lys_parse() or ly_ctx_load_module(). To later examine what the status of a feature is, check its LYS_FENABLED flag or search for it first with lys_feature_value(). Lastly, to evaluate compiled if-features, use lysc_iffeature_value().
To iterate over all features of a particular YANG module, use lysp_feature_next().
Note, that the feature's state can affect some of the output formats (e.g. Tree format).