summaryrefslogtreecommitdiff
path: root/tools/gen_northbound_callbacks.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-11-13 20:36:48 -0200
committerRenato Westphal <renato@opensourcerouting.org>2018-11-26 17:38:08 -0200
commit544ca69a5cc7da81ad2f9f72110b34ee03b7cc44 (patch)
tree84daae9c8863af8bffae0ef910fbcc5f6f5f65f6 /tools/gen_northbound_callbacks.c
parente0ccfad220d80c1d02b327fd0ee24faf6a8d2bd4 (diff)
lib: add support for YANG lists with mixed config and state data
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>
Diffstat (limited to 'tools/gen_northbound_callbacks.c')
-rw-r--r--tools/gen_northbound_callbacks.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/gen_northbound_callbacks.c b/tools/gen_northbound_callbacks.c
index 9417155e61..5ecb34e023 100644
--- a/tools/gen_northbound_callbacks.c
+++ b/tools/gen_northbound_callbacks.c
@@ -272,8 +272,15 @@ int main(int argc, char *argv[])
yang_init();
- /* Load YANG module. */
- module = yang_module_load(argv[0]);
+ /* Load all FRR native models to ensure all augmentations are loaded. */
+ yang_module_load_all();
+ module = yang_module_find(argv[0]);
+ if (!module)
+ /* Non-native FRR module (e.g. modules from unit tests). */
+ module = yang_module_load(argv[0]);
+
+ /* Create a nb_node for all YANG schema nodes. */
+ nb_nodes_create();
/* Generate callback functions. */
yang_snodes_iterate_module(module->info, generate_callbacks, 0, NULL);
@@ -296,6 +303,7 @@ int main(int argc, char *argv[])
"};\n");
/* Cleanup and exit. */
+ nb_nodes_delete();
yang_terminate();
return 0;