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)

This commit is contained in:
Olof hagsand 2019-05-15 11:12:23 +02:00
parent f8850990d4
commit 6f294fe67a
4 changed files with 23 additions and 13 deletions

View file

@ -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!

View file

@ -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

View file

@ -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<strlen(arg); j++){
if (index(CLIGEN_DELIMITERS, arg[j]))
cprintf(cb, "\\");
cprintf(cb, "%c", arg[j]);
}
i++;
}
}

View file

@ -34,7 +34,7 @@ module example3{
type w;
type enumeration {
enum "bounded";
enum "unbounded";
enum "un bounded"; /* note w space */
}
}
}
@ -258,8 +258,8 @@ EOF
new "cli validate"
expectfn "$clixon_cli -1f $cfg -l o -y $fyang -l o validate" 0 '^$'
new "cli set transitive union string"
expectfn "$clixon_cli -1f $cfg -l o -y $fyang set c ulle unbounded" 0 '^$'
new "cli set transitive union string (and space)"
expectfn "$clixon_cli -1f $cfg -l o -y $fyang set c ulle un\ bounded" 0 '^$'
new "cli validate"
expectfn "$clixon_cli -1f $cfg -l o -y $fyang -l o validate" 0 '^$'