summaryrefslogtreecommitdiffstats
path: root/lib/yang.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* lib: add support for YANG lists with mixed config and state dataRenato Westphal2018-11-261-1/+2
| | | | | | | | A YANG list that contains both configuration and state data must have the following callbacks: create(), delete(), get_next(), get_keys() and lookup_entry(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: rework the yang schema node iteration functionsRenato Westphal2018-11-261-26/+36
| | | | | | | | | | | | | * Rename yang_snodes_iterate() to yang_snodes_iterate_subtree() and expose it in the public API. * Rename yang_module_snodes_iterate() to yang_snodes_iterate_module(). * Rename yang_all_snodes_iterate() to yang_snodes_iterate_all(). * Make it possible to stop the iteration at any time by returning YANG_ITER_STOP in the iteration callbacks. * Make the iteration callbacks accept only one user argument and not two. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: introduce function that loads all FRR native YANG modulesRenato Westphal2018-11-261-0/+11
| | | | | | | | | | | | | | | | | In some cases it will be necessary to load all FRR native modules. Examples: * vtysh needs to load all YANG modules so that it can manipulate data from all daemons. * The gen_northbound_callbacks tool will need to load all YANG modules since augmentations from one module can have an effect in the required northbound callbacks of other modules. The new yang_module_load_all() function provides this functionality. As a side note, the "frr_native_modules" will need to be updated every time we add a new YANG module to FRR. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: remove entire data tree on yang_dnode_free()Renato Westphal2018-11-261-0/+2
| | | | | | | | | | For convenience, make yang_dnode_free() remove the entire data tree and not only the data node given as a parameter. Also, add a null-pointer check on nb_config_replace() before calling yang_dnode_free(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib, tools: use CHECK_FLAG/SET_FLAG more often in the northbound codeRenato Westphal2018-11-261-5/+5
| | | | | | Cosmetic change to improve code readability a bit. No binary changes. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: make it possible to create YANG data nodes containing state dataRenato Westphal2018-11-261-2/+8
| | | | | | | | | By default the data nodes created by yang_dnode_new() could contain only configuration data (LYD_OPT_CONFIG). Add a 'config_only' option to yang_dnode_new() so that it can create data nodes containing both configuration and state data. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: don't fetch schema information when creating yang_data structuresRenato Westphal2018-11-261-12/+0
| | | | | | | | | Prefetching the schema node when creating yang_data structures is expensive, and in most cases we don't need that information. In that case, fetch the schema information only when necessary to improve performance when fetching operational data. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* yang: embed models into binariesDavid Lamparter2018-11-191-0/+40
| | | | | | | | | | | | | | This bakes our YANG models straight into the library/daemons, so they don't need to be loaded from /usr/share/yang. This makes the installation quite a bit more robust, as well as gets us halfway to running uninstalled. (The other half is baking in the extension type module.) The /usr/share/yang directory is still searched as a fallback, as well as for the experimental YANG model translator. This is likely to stay as is for the time being. Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: introduce new northbound APIRenato Westphal2018-10-271-0/+618
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>