From 9a88cb5f0d811f0f884f29562caee595e7528de2 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Mon, 14 Mar 2022 12:13:45 +0100 Subject: [PATCH] * Bumped version to 5.7.0_PRE * Fixed: SEGV in cli show yang --- CHANGELOG.md | 8 ++++++++ configure | 4 ++-- configure.ac | 4 ++-- example/main/example_cli.cli | 3 +++ lib/src/clixon_yang.c | 3 --- lib/src/clixon_yang_internal.h | 1 + test/test_yang.sh | 32 +++++++++++++++++++++++++++++--- 7 files changed, 45 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2421b62..17310a1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Clixon Changelog +* [5.7.0](#560) Expected: May 2022 * [5.6.0](#560) 8 March 2022 * [5.5.0](#550) 20 January 2022 * [5.4.0](#540) 30 November 2021 @@ -33,6 +34,13 @@ * [3.3.2](#332) Aug 27 2017 * [3.3.1](#331) June 7 2017 +## 5.7.0 +Expected: May 2022 + +### Corrected Bugs + +* Fixed: SEGV in cli show yang + ## 5.6.0 8 March 2022 diff --git a/configure b/configure index b817069d..7cdfde6e 100755 --- a/configure +++ b/configure @@ -2266,9 +2266,9 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. CLIXON_VERSION_MAJOR="5" -CLIXON_VERSION_MINOR="6" +CLIXON_VERSION_MINOR="7" CLIXON_VERSION_PATCH="0" -CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}\"" +CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}_PRE\"" # Debug flag # Check whether --enable-debug was given. diff --git a/configure.ac b/configure.ac index c094f197..1a08ba82 100644 --- a/configure.ac +++ b/configure.ac @@ -48,9 +48,9 @@ AC_INIT(lib/clixon/clixon.h.in) AC_CONFIG_AUX_DIR(config-aux) CLIXON_VERSION_MAJOR="5" -CLIXON_VERSION_MINOR="6" +CLIXON_VERSION_MINOR="7" CLIXON_VERSION_PATCH="0" -CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}\"" +CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}_PRE\"" # Debug flag AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Build with debug symbols, default: no]),[ diff --git a/example/main/example_cli.cli b/example/main/example_cli.cli index 55775436..1668587a 100644 --- a/example/main/example_cli.cli +++ b/example/main/example_cli.cli @@ -91,6 +91,9 @@ show("Show a particular state of the system"){ state("Show configuration and state"), cli_auto_show("datamodel", "running", "text", true, true); { xml("Show configuration and state as XML"), cli_auto_show("datamodel", "running", "xml", true, true); } + yang("Show yang specs"), show_yang(); { + clixon-example("Show clixon-example yang spec"), show_yang("clixon-example"); + } } save("Save candidate configuration to XML file") ("Filename (local filename)"), save_config_file("candidate","filename", "xml");{ diff --git a/lib/src/clixon_yang.c b/lib/src/clixon_yang.c index d45663e1..c6683383 100644 --- a/lib/src/clixon_yang.c +++ b/lib/src/clixon_yang.c @@ -1854,9 +1854,6 @@ yang_print_cbuf(cbuf *cb, else cprintf(cb, " %s", ys->ys_argument); } - if (ys->ys_cv){ - cprintf(cb, " %s", cv_string_get(ys->ys_cv)); - } if (ys->ys_len){ cprintf(cb, " {\n"); yang_print_cbuf(cb, ys, marginal+3); diff --git a/lib/src/clixon_yang_internal.h b/lib/src/clixon_yang_internal.h index e5941a45..fa64d134 100644 --- a/lib/src/clixon_yang_internal.h +++ b/lib/src/clixon_yang_internal.h @@ -86,6 +86,7 @@ struct yang_stmt{ mandatory: boolean true or false require-instance: true or false fraction-digits for fraction-digits + revision (uint32) unknown-stmt (optional argument) */ cvec *ys_cvec; /* List of stmt-specific variables diff --git a/test/test_yang.sh b/test/test_yang.sh index d9d6ce8e..d4d39aeb 100755 --- a/test/test_yang.sh +++ b/test/test_yang.sh @@ -10,6 +10,8 @@ cfg=$dir/conf_yang.xml fyang=$dir/$APPNAME.yang fsubmod=$dir/example-types.yang fyangerr=$dir/err.yang +clispec=$dir/clispec +test -d $clispec || mkdir $clispec cat < $cfg @@ -17,9 +19,9 @@ cat < $cfg ${YANG_INSTALLDIR} $dir $fyang - /usr/local/lib/$APPNAME/clispec + $clispec /usr/local/lib/$APPNAME/cli - $APPNAME + example /usr/local/var/$APPNAME/$APPNAME.sock /usr/local/var/$APPNAME/$APPNAME.pidfile /usr/local/var/$APPNAME @@ -32,6 +34,9 @@ module $APPNAME{ prefix ex; namespace "urn:example:clixon"; include example-types; + revision 2020-12-01 { + description "Added table/parameter/value as the primary data example"; + } extension c-define { description "Example from RFC 6020"; argument "name"; @@ -139,6 +144,24 @@ module $APPNAME{ } EOF +cat < $clispec/example.cli +CLICON_MODE="example"; +CLICON_PROMPT="cli> "; + +# Reference generated data model +set @datamodel, cli_set(); +commit("Commit the changes"), cli_commit(); +quit("Quit"), cli_quit(); +show("Show a particular state of the system"){ + configuration("Show configuration"), cli_show_config("candidate", "text", "/"); + version("Show version"), cli_show_version("candidate", "text", "/"); + xpath("Show configuration") ("XPATH expression") ("Namespace"), show_conf_xpath("candidate"); + yang("Show yang specs"), show_yang(); { + example("Show example yang spec"), show_yang("example"); + } +} +EOF + new "test params: -f $cfg" if [ "$BE" -ne 0 ]; then @@ -154,9 +177,12 @@ fi new "wait backend" wait_backend -new "cli defined extension" +new "cli show version" expectpart "$($clixon_cli -1f $cfg show version)" 0 "${CLIXON_VERSION}" +new "cli show yang example" +expectpart "$($clixon_cli -1f $cfg show yang example)" 0 "revision 2020-12-01" "Added table/parameter/value as the primary data example" + new "empty values in leaf-list" expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOa]]>]]>" "^]]>]]>$"