diff --git a/CHANGELOG.md b/CHANGELOG.md index a3bab479..6f806787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,6 +87,9 @@ * `commit` - NACM is applied to candidate and running operations only (3.2.8) * Client-side RPC:s are _not_ supported. * Recovery user "_nacm_recovery" added. +* Change GIT branch handling to a single working master branch + * Develop branched abandoned + * Travis CI supported, see [https://travis-ci.org/clicon/clixon] ### API changes on existing features (you may need to change your code) * Added `username` argument to `xmldb_put()` datastore function for NACM data-node write checks @@ -119,14 +122,15 @@ * For backward compatibility, define CLICON_CLI_MODEL_TREENAME_PATCH in clixon_custom.h ### Minor changes -* Change GIT branch handling to a single working master branch - * Develop branched abandoned - * Travis CI supported, see [https://travis-ci.org/clicon/clixon] * XML parser conformance to W3 spec * Names lexically correct (NCName) * Syntactically Correct handling of '=" command-line option to all programs: backend, cli, netconf, restconf. diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c index 0cbafccd..b3f18000 100644 --- a/apps/cli/cli_main.c +++ b/apps/cli/cli_main.c @@ -352,7 +352,7 @@ main(int argc, char **argv) break; /* see above */ case 'F': /* read commands from file */ if (freopen(optarg, "r", stdin) == NULL){ - cli_output(stderr, "freopen: %s\n", strerror(errno)); + fprintf(stderr, "freopen: %s\n", strerror(errno)); return -1; } break; @@ -531,6 +531,7 @@ main(int argc, char **argv) *(argv-1) = tmp; cligen_line_scrolling_set(cli_cligen(h), clicon_option_int(h,"CLICON_CLI_LINESCROLLING")); + cligen_utf8_set(cli_cligen(h), clicon_option_int(h,"CLICON_CLI_UTF8")); /* Launch interfactive event loop, unless -1 */ if (restarg != NULL && strlen(restarg)){ char *mode = cli_syntax_mode(h); diff --git a/apps/cli/cli_plugin.c b/apps/cli/cli_plugin.c index 4f17f948..74cfec38 100644 --- a/apps/cli/cli_plugin.c +++ b/apps/cli/cli_plugin.c @@ -455,15 +455,13 @@ int cli_handler_err(FILE *f) { if (clicon_errno){ - cli_output(f, "%s: %s", - clicon_strerror(clicon_errno), - clicon_err_reason); + fprintf(f, "%s: %s", clicon_strerror(clicon_errno), clicon_err_reason); if (clicon_suberrno) - cli_output(f, ": %s", strerror(clicon_suberrno)); - cli_output(f, "\n"); + fprintf(f, ": %s", strerror(clicon_suberrno)); + fprintf(f, "\n"); } else - cli_output(f, "CLI command error\n"); + fprintf(f, "CLI command error\n"); return 0; } @@ -482,7 +480,6 @@ clicon_eval(clicon_handle h, { int retval = 0; - cli_output_reset(); if (!cligen_exiting(cli_cligen(h))) { clicon_err_reset(); if ((retval = cligen_eval(cli_cligen(h), match_obj, cvv)) < 0) { @@ -546,7 +543,7 @@ clicon_parse(clicon_handle h, } else { if ((smode = syntax_mode_find(stx, modename, 0)) == NULL) { - cli_output(f, "Can't find syntax mode '%s'\n", modename); + fprintf(f, "Can't find syntax mode '%s'\n", modename); goto done; } } @@ -576,13 +573,12 @@ clicon_parse(clicon_handle h, switch (retval) { case CG_EOF: /* eof */ case CG_ERROR: - cli_output(f, "CLI parse error: %s\n", cmd); + fprintf(f, "CLI parse error: %s\n", cmd); break; case CG_NOMATCH: /* no match */ /* clicon_err(OE_CFG, 0, "CLI syntax error: \"%s\": %s", cmd, cli_nomatch(h));*/ - cli_output(f, "CLI syntax error: \"%s\": %s\n", - cmd, cli_nomatch(h)); + fprintf(f, "CLI syntax error: \"%s\": %s\n", cmd, cli_nomatch(h)); break; case CG_MATCH: if (strcmp(modename, *modenamep)){ /* Command in different mode */ @@ -596,7 +592,7 @@ clicon_parse(clicon_handle h, *evalres = r; break; default: - cli_output(f, "CLI syntax error: \"%s\" is ambiguous\n", cmd); + fprintf(f, "CLI syntax error: \"%s\" is ambiguous\n", cmd); break; } /* switch retval */ } diff --git a/apps/cli/cli_show.c b/apps/cli/cli_show.c index 0fa9fa56..c5449638 100644 --- a/apps/cli/cli_show.c +++ b/apps/cli/cli_show.c @@ -193,7 +193,7 @@ expand_dbvar(void *h, if (xml_merge(xt, xtop, yspec, &reason) < 0) /* Merge xtop into xt */ goto done; if (reason){ - cli_output(stderr, "%s\n", reason); + fprintf(stderr, "%s\n", reason); goto done; } if ((xcur = xpath_first(xt, "%s", xpath)) == NULL){ @@ -602,9 +602,11 @@ done: return retval; } -int cli_show_version(clicon_handle h, cvec *vars, cvec *argv) +int cli_show_version(clicon_handle h, + cvec *vars, + cvec *argv) { - cli_output(stdout, "%s\n", CLIXON_VERSION_STRING); + fprintf(stdout, "%s\n", CLIXON_VERSION_STRING); return 0; } diff --git a/apps/cli/clixon_cli_api.h b/apps/cli/clixon_cli_api.h index d2926029..0c95a093 100644 --- a/apps/cli/clixon_cli_api.h +++ b/apps/cli/clixon_cli_api.h @@ -67,7 +67,6 @@ int cli_notification_register(clicon_handle h, char *stream, enum format_enum fo char *filter, int status, int (*fn)(int, void*), void *arg); -#define cli_output cligen_output /* cli_common.c: CLIgen new vector callbacks */ diff --git a/doc/FAQ.md b/doc/FAQ.md index f15ee42c..de8e7a74 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -65,6 +65,7 @@ On linux: sudo usermod -a -G clicon sudo usermod -a -G clicon www-data ``` +(you may have to restart shell) Verify: ``` diff --git a/example/README.md b/example/README.md index 8e9c61f0..10515f25 100644 --- a/example/README.md +++ b/example/README.md @@ -121,11 +121,22 @@ Setup a web/reverse-proxy server. For example, using nginx, install, and edit config file: /etc/nginx/sites-available/default: ``` server { - ... - location /restconf { - fastcgi_pass unix:/www-data/fastcgi_restconf.sock; - include fastcgi_params; - } + ... + location / { + root /usr/share/nginx/html/restconf; + fastcgi_pass unix:/www-data/fastcgi_restconf.sock; + include fastcgi_params; + } + location /restconf { + fastcgi_pass unix:/www-data/fastcgi_restconf.sock; + include fastcgi_params; + } + location /streams { + fastcgi_pass unix:/www-data/fastcgi_restconf.sock; + include fastcgi_params; + proxy_http_version 1.1; + proxy_set_header Connection ""; + } } ``` Start nginx daemon diff --git a/example/example_cli.c b/example/example_cli.c index 10e122ee..56d3b82d 100644 --- a/example/example_cli.c +++ b/example/example_cli.c @@ -63,8 +63,8 @@ mycallback(clicon_handle h, cvec *cvv, cvec *argv) /* Access cligen callback variables */ myvar = cvec_find(cvv, "var"); /* get a cligen variable from vector */ - cli_output(stderr, "%s: %d\n", __FUNCTION__, cv_int32_get(myvar)); /* get int value */ - cli_output(stderr, "arg = %s\n", cv_string_get(cvec_i(argv,0))); /* get string value */ + fprintf(stderr, "%s: %d\n", __FUNCTION__, cv_int32_get(myvar)); /* get int value */ + fprintf(stderr, "arg = %s\n", cv_string_get(cvec_i(argv,0))); /* get string value */ /* Show eth0 interfaces config using XPATH */ if (clicon_rpc_get_config(h, "running", diff --git a/test/Makefile.in b/test/Makefile.in index acb0d930..23465f93 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -44,6 +44,7 @@ SHELL = /bin/sh all: ./test_xml.sh + ./test_json.sh # ./all.sh clean: diff --git a/yang/clixon/Makefile.in b/yang/clixon/Makefile.in index 1f9c99a2..1c498b1a 100644 --- a/yang/clixon/Makefile.in +++ b/yang/clixon/Makefile.in @@ -40,7 +40,7 @@ datarootdir = @datarootdir@ CLIXON_DATADIR = @CLIXON_DATADIR@ -YANGSPECS = clixon-config@2018-10-21.yang +YANGSPECS = clixon-config@2019-02-06.yang YANGSPECS += clixon-lib@2019-01-02.yang YANGSPECS += clixon-rfc5277@2008-07-01.yang diff --git a/yang/clixon/clixon-config@2018-10-21.yang b/yang/clixon/clixon-config@2019-02-06.yang similarity index 97% rename from yang/clixon/clixon-config@2018-10-21.yang rename to yang/clixon/clixon-config@2019-02-06.yang index dfa2f5e1..4cb5bed0 100644 --- a/yang/clixon/clixon-config@2018-10-21.yang +++ b/yang/clixon/clixon-config@2019-02-06.yang @@ -39,6 +39,10 @@ module clixon-config { ***** END LICENSE BLOCK *****"; + revision 2019-02-06 { + description + "Released in Clixon 3.9"; + } revision 2018-10-21 { description "Released in Clixon 3.8"; @@ -275,6 +279,14 @@ module clixon-config { Set to 1 if you want CLI to scroll sideways when approaching right margin"; } + leaf CLICON_CLI_UTF8 { + type int8; + default 0; + description + "Set to 1 to enable CLIgen UTF-8 experimental mode. + Note that this feature is EXPERIMENTAL and may not properly handle + scrolling, control characters, etc"; + } leaf CLICON_SOCK_FAMILY { type string; default "UNIX";