From 6f294fe67a28494d83f306eefc99e5a281af42c3 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Wed, 15 May 2019 11:12:23 +0200 Subject: [PATCH] Yang Enumeration including space did not generate working CLIgen code, see [Choice with space is not working in CLIgen code](https://github.com/olofhagsand/cligen/issues/24) --- CHANGELOG.md | 1 + README.md | 19 ++++++++++--------- apps/cli/cli_generate.c | 10 +++++++++- test/test_type.sh | 6 +++--- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 489199d9..b5ce395b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -168,6 +168,7 @@ * Added libgen.h for baseline() ### Corrected Bugs +* Yang Enumeration including space did not generate working CLIgen code, see [Choice with space is not working in CLIgen code](https://github.com/olofhagsand/cligen/issues/24) * Fixed support for multiple datanodes in a choice/case statement. Only single datanode was supported. * Fixed an ordering problem showing up in validate/commit callbacks. If two new items following each order (yang-wise), only the first showed up in the new-list. Thanks achernavin! * Fixed a problem caused by recent sorting patches that made "ordered-by user" lists fail in some cases, causing multiple list entries with same keys. NACM being one example. Thanks vratnikov! diff --git a/README.md b/README.md index 36c29745..c97cb4ef 100644 --- a/README.md +++ b/README.md @@ -109,15 +109,16 @@ Clixon follows: - [YANG 1.1 RFC 7950](https://www.rfc-editor.org/rfc/rfc7950.txt). - [RFC 7895: YANG module library](http://www.rfc-base.org/txt/rfc-7895.txt) -However, the following YANG syntax modules are not implemented: -- deviation -- action -- refine - -The following restrictions on Yang exists: -- Yang extended Xpath functions: re-match, deref, derived-from, derived-from-or-self, enum-value, bit-is-set -- Submodules cannot re-use a prefix in an import statement that is already used for another imported module in the module that the submodule belongs to. (see https://github.com/clicon/clixon/issues/60) -- Default values on leaf-lists are not supported (RFC7950 7.7.2) +However, the following YANG syntax modules are not implemented (reference to RFC7950 in parenthesis): +- deviation (7.20.3) +- action (7.15) +- refine (7.13.2) +- status (7.21.2) +- extension (7.19) +- modifier (9.4.6) +- YIN (13) +- Yang extended Xpath functions: re-match(), deref)(), derived-from(), derived-from-or-self(), enum-value(), bit-is-set() (10.2-10.6) +- Default values on leaf-lists are not supported (7.7.2) ## XML diff --git a/apps/cli/cli_generate.c b/apps/cli/cli_generate.c index 7a41f25c..9a23741f 100644 --- a/apps/cli/cli_generate.c +++ b/apps/cli/cli_generate.c @@ -311,7 +311,9 @@ yang2cli_var_sub(clicon_handle h, char *type; yang_stmt *yi = NULL; int i = 0; + int j; char *cvtypestr; + char *arg; if (cvtype == CGV_VOID){ retval = 0; @@ -334,7 +336,13 @@ yang2cli_var_sub(clicon_handle h, continue; if (i) cprintf(cb, "|"); - cprintf(cb, "%s", yang_argument_get(yi)); + /* Encode by escaping delimiters */ + arg = yang_argument_get(yi); + for (j=0; j