From 3bb513c399c2e7c8dd597b7399dd7c0f064842d0 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Tue, 4 May 2021 10:41:58 -0400 Subject: lib: adapt to version 2 of libyang Compile with v2.0.0 tag of `libyang2` branch of: https://github.com/CESNET/libyang staticd init load time of 10k routes now 6s vs ly1 time of 150s Signed-off-by: Christian Hopps --- vtysh/extract.pl.in | 2 +- vtysh/vtysh.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'vtysh') diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 37ae0ab18..86cf8c965 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -42,7 +42,7 @@ sub scan_file { $cppadd = $fabricd ? "-DFABRICD=1" : ""; - open (FH, "@CPP@ -P -std=gnu11 -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -Ivtysh/@top_builddir@ -Ivtysh/@top_srcdir@ -Ivtysh/@top_srcdir@/lib -Ivtysh/@top_builddir@/lib -Ivtysh/@top_srcdir@/bgpd -Ivtysh/@top_srcdir@/bgpd/rfapi @LUA_INCLUDE@ @CPPFLAGS@ $cppadd $file |"); + open (FH, "@CPP@ -P -std=gnu11 -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -Ivtysh/@top_builddir@ -Ivtysh/@top_srcdir@ -Ivtysh/@top_srcdir@/lib -Ivtysh/@top_builddir@/lib -Ivtysh/@top_srcdir@/bgpd -Ivtysh/@top_srcdir@/bgpd/rfapi @LUA_INCLUDE@ @CPPFLAGS@ @LIBYANG_CFLAGS@ $cppadd $file |"); local $/; undef $/; $line = ; if (!close (FH)) { diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 336bd44a4..111c2dbc0 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2890,6 +2890,37 @@ DEFUN (show_yang_operational_data, return show_one_daemon(vty, argv, argc - 1, argv[argc - 1]->text); } +DEFUN(show_yang_module, show_yang_module_cmd, + "show yang module [module-translator WORD] " DAEMONS_LIST, + SHOW_STR + "YANG information\n" + "Show loaded modules\n" + "YANG module translator\n" + "YANG module translator\n" DAEMONS_STR) +{ + return show_one_daemon(vty, argv, argc - 1, argv[argc - 1]->text); +} + +DEFUN(show_yang_module_detail, show_yang_module_detail_cmd, + "show yang module\ + [module-translator WORD]\ + WORD " DAEMONS_LIST, + SHOW_STR + "YANG information\n" + "Show loaded modules\n" + "YANG module translator\n" + "YANG module translator\n" + "Module name\n" + "Display compiled module in YANG format\n" + "Display summary information about the module\n" + "Display module in the tree (RFC 8340) format\n" + "Display module in the YANG format\n" + "Display module in the YIN format\n" DAEMONS_STR) +{ + return show_one_daemon(vty, argv, argc - 1, argv[argc - 1]->text); +} + + DEFUNSH(VTYSH_ALL, debug_nb, debug_nb_cmd, "[no] debug northbound\ @@ -4449,6 +4480,8 @@ void vtysh_init_vty(void) /* northbound */ install_element(ENABLE_NODE, &show_config_running_cmd); install_element(ENABLE_NODE, &show_yang_operational_data_cmd); + install_element(ENABLE_NODE, &show_yang_module_cmd); + install_element(ENABLE_NODE, &show_yang_module_detail_cmd); install_element(ENABLE_NODE, &debug_nb_cmd); install_element(CONFIG_NODE, &debug_nb_cmd); -- cgit v1.2.3