Changed output of clixon_cli -G option to show generated CLI spec original text instead of resulting parse-tree, which gives better detail from a debugging perspective.
This commit is contained in:
parent
f9e1fe5de7
commit
266e5581e4
6 changed files with 21 additions and 20 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# Clixon Changelog
|
# Clixon Changelog
|
||||||
|
|
||||||
* [4.5.0](#440) Expected: May 2020
|
* [4.5.0](#450) Expected: May 2020
|
||||||
* [4.4.0](#440) 5 April 2020
|
* [4.4.0](#440) 5 April 2020
|
||||||
* [4.3.0](#430) 1 January 2020
|
* [4.3.0](#430) 1 January 2020
|
||||||
* [4.3.3](#433)
|
* [4.3.3](#433)
|
||||||
|
|
@ -44,6 +44,7 @@ Expected: May 2020
|
||||||
* Added: restart-plugin RPC for restarting individual plugins without restarting backend.
|
* Added: restart-plugin RPC for restarting individual plugins without restarting backend.
|
||||||
* xml-stats moved from clixon-config.yang as state data to an rpc `datastats` in clixon-lib.yang
|
* xml-stats moved from clixon-config.yang as state data to an rpc `datastats` in clixon-lib.yang
|
||||||
* Stricter incoming RPC sanity checking, error messages may have changed.
|
* Stricter incoming RPC sanity checking, error messages may have changed.
|
||||||
|
* Changed output of `clixon_cli -G` option to show generated CLI spec original text instead of resulting parse-tree, which gives better detail from a debugging perspective.
|
||||||
|
|
||||||
### C-API changes on existing features (you may need to change your plugin C-code)
|
### C-API changes on existing features (you may need to change your plugin C-code)
|
||||||
|
|
||||||
|
|
@ -57,7 +58,7 @@ Expected: May 2020
|
||||||
### Minor changes
|
### Minor changes
|
||||||
|
|
||||||
* Added option `CLICON_YANG_UNKNOWN_ANYDATA` to treat unknown XML (wrt YANG) as anydata.
|
* Added option `CLICON_YANG_UNKNOWN_ANYDATA` to treat unknown XML (wrt YANG) as anydata.
|
||||||
* This is to be (very) forgiving but you need to accept eg unsynchronized YANG and XML
|
* This is a way to loosen sanity checks if you need to accept eg unsynchronized YANG and XML
|
||||||
* Compile-time option: `USE_CLIGEN44` for running clixon-45 with cligen-44.
|
* Compile-time option: `USE_CLIGEN44` for running clixon-45 with cligen-44.
|
||||||
* Temporary fix since cligen-45 have some non-backward compatible behaviour.
|
* Temporary fix since cligen-45 have some non-backward compatible behaviour.
|
||||||
* Optimizations
|
* Optimizations
|
||||||
|
|
|
||||||
|
|
@ -909,8 +909,9 @@ yang2cli_stmt(clicon_handle h,
|
||||||
/*! Generate CLI code for Yang specification
|
/*! Generate CLI code for Yang specification
|
||||||
* @param[in] h Clixon handle
|
* @param[in] h Clixon handle
|
||||||
* @param[in] yspec Yang specification
|
* @param[in] yspec Yang specification
|
||||||
* @param[out] ptnew CLIgen parse-tree
|
|
||||||
* @param[in] gt CLI Generate style
|
* @param[in] gt CLI Generate style
|
||||||
|
* @param[in] printgen Log generated CLIgen syntax
|
||||||
|
* @param[out] ptnew CLIgen parse-tree
|
||||||
*
|
*
|
||||||
* Code generation styles:
|
* Code generation styles:
|
||||||
* VARS: generate keywords for regular vars only not index
|
* VARS: generate keywords for regular vars only not index
|
||||||
|
|
@ -919,8 +920,9 @@ yang2cli_stmt(clicon_handle h,
|
||||||
int
|
int
|
||||||
yang2cli(clicon_handle h,
|
yang2cli(clicon_handle h,
|
||||||
yang_stmt *yspec,
|
yang_stmt *yspec,
|
||||||
parse_tree *ptnew,
|
enum genmodel_type gt,
|
||||||
enum genmodel_type gt)
|
int printgen,
|
||||||
|
parse_tree *ptnew)
|
||||||
{
|
{
|
||||||
cbuf *cb = NULL;
|
cbuf *cb = NULL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
@ -936,6 +938,9 @@ yang2cli(clicon_handle h,
|
||||||
while ((ymod = yn_each(yspec, ymod)) != NULL)
|
while ((ymod = yn_each(yspec, ymod)) != NULL)
|
||||||
if (yang2cli_stmt(h, ymod, gt, 0, cb) < 0)
|
if (yang2cli_stmt(h, ymod, gt, 0, cb) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
if (printgen)
|
||||||
|
clicon_log(LOG_NOTICE, "%s: Generated CLI spec:\n%s", __FUNCTION__, cbuf_get(cb));
|
||||||
|
else
|
||||||
clicon_debug(2, "%s: buf\n%s\n", __FUNCTION__, cbuf_get(cb));
|
clicon_debug(2, "%s: buf\n%s\n", __FUNCTION__, cbuf_get(cb));
|
||||||
/* Parse the buffer using cligen parser. XXX why this?*/
|
/* Parse the buffer using cligen parser. XXX why this?*/
|
||||||
if ((globals = cvec_new(0)) == NULL)
|
if ((globals = cvec_new(0)) == NULL)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
/*
|
/*
|
||||||
* Prototypes
|
* Prototypes
|
||||||
*/
|
*/
|
||||||
int yang2cli(clicon_handle h, yang_stmt *yspec, parse_tree *ptnew,
|
int yang2cli(clicon_handle h, yang_stmt *yspec, enum genmodel_type gt,
|
||||||
enum genmodel_type gt);
|
int printgen, parse_tree *ptnew);
|
||||||
|
|
||||||
#endif /* _CLI_GENERATE_H_ */
|
#endif /* _CLI_GENERATE_H_ */
|
||||||
|
|
|
||||||
|
|
@ -576,12 +576,9 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
treeref = clicon_cli_model_treename(h);
|
treeref = clicon_cli_model_treename(h);
|
||||||
/* Create cli command tree from dbspec */
|
/* Create cli command tree from dbspec */
|
||||||
if (yang2cli(h, yspec, &pt, clicon_cli_genmodel_type(h)) < 0)
|
if (yang2cli(h, yspec, clicon_cli_genmodel_type(h), printgen, &pt) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
cligen_tree_add(cli_cligen(h), treeref, pt);
|
cligen_tree_add(cli_cligen(h), treeref, pt);
|
||||||
|
|
||||||
if (printgen)
|
|
||||||
pt_print(stdout, pt, 1); /* pt_print */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize cli syntax */
|
/* Initialize cli syntax */
|
||||||
|
|
@ -619,10 +616,8 @@ main(int argc, char **argv)
|
||||||
/* Join rest of argv to a single command */
|
/* Join rest of argv to a single command */
|
||||||
restarg = clicon_strjoin(argc, argv, " ");
|
restarg = clicon_strjoin(argc, argv, " ");
|
||||||
|
|
||||||
#if 0 /* Unsure for why this is enabled by default, turned off in clixon 4.5? */
|
|
||||||
/* If several cligen object variables match same preference, select first */
|
/* If several cligen object variables match same preference, select first */
|
||||||
cligen_preference_mode_set(cli_cligen(h), 1);
|
cligen_preference_mode_set(cli_cligen(h), 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Call start function in all plugins before we go interactive
|
/* Call start function in all plugins before we go interactive
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -224,5 +224,5 @@ rwxr-xr-x 1 www-data www-data 0 sep 22 11:46 /www-data/fastcgi_restconf.sock
|
||||||
|
|
||||||
You can set debug level of the backend via restconf:
|
You can set debug level of the backend via restconf:
|
||||||
```
|
```
|
||||||
url -is -X POST -H "Content-Type: application/yang-data+json" -d '{"clixon-lib:input":{"level":1}}' http://localhost/restconf/operations/clixon-lib:debug
|
curl -is -X POST -H "Content-Type: application/yang-data+json" -d '{"clixon-lib:input":{"level":1}}' http://localhost/restconf/operations/clixon-lib:debug
|
||||||
```
|
```
|
||||||
|
|
@ -436,7 +436,7 @@ xml_chardata_encode(char **escp,
|
||||||
|
|
||||||
/*! Escape characters according to XML definition and append to cbuf
|
/*! Escape characters according to XML definition and append to cbuf
|
||||||
* @param[in] cb CLIgen buf
|
* @param[in] cb CLIgen buf
|
||||||
* @param[in] fmt Not-encoded input string
|
* @param[in] str Not-encoded input string
|
||||||
* @see xml_chardata_encode for the generic function
|
* @see xml_chardata_encode for the generic function
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue