From fd2a5db31ba3544629d1fdc6d9a87ac1f1c6286d Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Thu, 27 Jul 2017 12:09:57 +0200 Subject: [PATCH] fixed empty cli gen err --- CHANGELOG.md | 1 - apps/cli/cli_generate.c | 7 ++++++- test/test_yang.sh | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ba398cb..30b8e72f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,6 @@ ## Upcoming 3.3.2 ### Known issues -* Error in CLI generated code for Yang empty types ### Major changes: * Added support for YANG anyxml. diff --git a/apps/cli/cli_generate.c b/apps/cli/cli_generate.c index 3cf8d04e..072d6b4d 100644 --- a/apps/cli/cli_generate.c +++ b/apps/cli/cli_generate.c @@ -348,6 +348,12 @@ yang2cli_var(clicon_handle h, &options, &mincv, &maxcv, &pattern, &fraction_digits) < 0) goto done; restype = yrestype?yrestype->ys_argument:NULL; + + if (restype && strcmp(restype, "empty") == 0){ + retval = 0; + goto done; + } + if (clicon_type2cv(type, restype, &cvtype) < 0) goto done; @@ -389,7 +395,6 @@ yang2cli_var(clicon_handle h, cprintf(cb0, ")"); } } - retval = 0; done: return retval; diff --git a/test/test_yang.sh b/test/test_yang.sh index 5f3e84d3..018bf446 100755 --- a/test/test_yang.sh +++ b/test/test_yang.sh @@ -101,7 +101,7 @@ new "netconf get (should be some)" expecteof "$clixon_netconf -qf $clixon_cf -y /tmp/test.yang" "]]>]]>" "^125]]>]]>$" new "cli set leaf-list" -expectfn "$clixon_cli -D 1 -1f $clixon_cf -y /tmp/test.yang set x f e foo" "" +expectfn "$clixon_cli -1f $clixon_cf -y /tmp/test.yang set x f e foo" "" new "cli show leaf-list" expectfn "$clixon_cli -1f $clixon_cf -y /tmp/test.yang show xpath /x/f/e" "foo"