]> git.proxmox.com Git - mirror_frr.git/commitdiff
tests/lib/cli: allow using YANG modules
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 20 Apr 2021 03:36:30 +0000 (05:36 +0200)
committerMartin Winter <mwinter@opensourcerouting.org>
Mon, 5 Jul 2021 23:44:35 +0000 (01:44 +0200)
Since the common CLI code calls nb_init, allow specifying some modules
to load by overriding test_yang_models.

Signed-off-by: David Lamparter <equinox@diac24.net>
tests/lib/cli/common_cli.c
tests/lib/cli/common_cli.h

index 49bc0f4fb23abbf72bfff23167428d3731683b86..8be81cc4cb1ece3d326f85c17548cabda1019829 100644 (file)
@@ -59,10 +59,13 @@ static void vty_do_exit(int isexit)
                exit(0);
 }
 
+const struct frr_yang_module_info *const *test_yang_modules = NULL;
+
 /* main routine. */
 int main(int argc, char **argv)
 {
        struct thread thread;
+       size_t yangcount;
 
        /* Set umask before anything for security */
        umask(0027);
@@ -79,7 +82,11 @@ int main(int argc, char **argv)
 
        vty_init(master, false);
        lib_cmd_init();
-       nb_init(master, NULL, 0, false);
+
+       for (yangcount = 0; test_yang_modules && test_yang_modules[yangcount];
+            yangcount++)
+               ;
+       nb_init(master, test_yang_modules, yangcount, false);
 
        test_init(argc, argv);
 
index 15abe3b855905c745fd9ef492f0f095e6d8132aa..3042ff5b12696320f1415434ad22bf25ffa6aa7c 100644 (file)
@@ -25,6 +25,9 @@
 #include "zebra.h"
 #include "vty.h"
 #include "command.h"
+#include "northbound.h"
+
+extern const struct frr_yang_module_info *const *test_yang_modules;
 
 /* function to be implemented by test */
 extern void test_init(int argc, char **argv);