Added clixon_netconf command-line option -0and changed -H to -1

* `-0` means dont send hello, but fix netconf base version to 0 and use EOM framing
    * `-1` means dont send hello, but fix netconf base version to 1 and use chunked framing
This commit is contained in:
Olof hagsand 2022-04-29 19:07:12 +02:00
parent f11e4bad6c
commit 28bd146e5c
3 changed files with 13 additions and 4 deletions

View file

@ -68,6 +68,9 @@ Users may have to change how they access the system
* Added 404 return without body if neither restconf, data or streams prefix match * Added 404 return without body if neither restconf, data or streams prefix match
* Netconf: Usage of chunked framing" * Netconf: Usage of chunked framing"
* To keep existing end-of-message encoding, set `CLICON_NETCONF_BASE_CAPABILITY` to `0` * To keep existing end-of-message encoding, set `CLICON_NETCONF_BASE_CAPABILITY` to `0`
* Added `clixon_netconf` command-line option `-0`and changed `-H` to `-1`
* `-0` means dont send hello, but fix netconf base version to 0 and use EOM framing
* `-1` means dont send hello, but fix netconf base version to 1 and use chunked framing
* New `clixon-config@2022-03-21.yang` revision * New `clixon-config@2022-03-21.yang` revision
* Added option: * Added option:
* `CLICON_RESTCONF_API_ROOT` * `CLICON_RESTCONF_API_ROOT`

View file

@ -70,7 +70,7 @@
#include "netconf_rpc.h" #include "netconf_rpc.h"
/* Command line options to be passed to getopt(3) */ /* Command line options to be passed to getopt(3) */
#define NETCONF_OPTS "hD:f:E:l:qHa:u:d:p:y:U:t:eo:" #define NETCONF_OPTS "hD:f:E:l:q01ca:u:d:p:y:U:t:eo:"
#define NETCONF_LOGFILE "/tmp/clixon_netconf.log" #define NETCONF_LOGFILE "/tmp/clixon_netconf.log"
@ -727,7 +727,8 @@ usage(clicon_handle h,
"\t-E <dir> \tExtra configuration file directory\n" "\t-E <dir> \tExtra configuration file directory\n"
"\t-l (e|o|s|f<file>) Log on std(e)rr, std(o)ut, (s)yslog(default), (f)ile\n" "\t-l (e|o|s|f<file>) Log on std(e)rr, std(o)ut, (s)yslog(default), (f)ile\n"
"\t-q\t\tServer does not send hello message on startup\n" "\t-q\t\tServer does not send hello message on startup\n"
"\t-H \t\tServer does not expect hello message from client.\n" "\t-0 \t\tSet netconf base capability to 0, server does not expect hello, force EOM framing\n"
"\t-1 \t\tSet netconf base capability to 1, server does not expect hello, force chunked framing\n"
"\t-a UNIX|IPv4|IPv6 Internal backend socket family\n" "\t-a UNIX|IPv4|IPv6 Internal backend socket family\n"
"\t-u <path|addr>\tInternal socket domain path or IP addr (see -a)\n" "\t-u <path|addr>\tInternal socket domain path or IP addr (see -a)\n"
"\t-d <dir>\tSpecify netconf plugin directory dir (default: %s)\n" "\t-d <dir>\tSpecify netconf plugin directory dir (default: %s)\n"
@ -866,7 +867,12 @@ main(int argc,
case 'e': /* dont ignore packet errors */ case 'e': /* dont ignore packet errors */
ignore_packet_errors = 0; ignore_packet_errors = 0;
break; break;
case 'H': /* Hello messages are optional */ case '0': /* Force EOM */
clicon_option_int_set(h, "CLICON_NETCONF_BASE_CAPABILITY", 0);
clicon_option_bool_set(h, "CLICON_NETCONF_HELLO_OPTIONAL", 1);
break;
case '1': /* Hello messages are optional */
clicon_option_int_set(h, "CLICON_NETCONF_BASE_CAPABILITY", 1);
clicon_option_bool_set(h, "CLICON_NETCONF_HELLO_OPTIONAL", 1); clicon_option_bool_set(h, "CLICON_NETCONF_HELLO_OPTIONAL", 1);
break; break;
case 'o':{ /* Configuration option */ case 'o':{ /* Configuration option */

View file

@ -442,7 +442,7 @@ function stop_backend(){
# Wait for restconf to stop sending 502 Bad Gateway # Wait for restconf to stop sending 502 Bad Gateway
function wait_backend(){ function wait_backend(){
freq=$(chunked_framing "<rpc $DEFAULTNS><ping $LIBNS/></rpc>") freq=$(chunked_framing "<rpc $DEFAULTNS><ping $LIBNS/></rpc>")
reply=$(echo "$freq" | $clixon_netconf -qHef $cfg) reply=$(echo "$freq" | $clixon_netconf -q1ef $cfg)
# freply=$(chunked_framing "<rpc-reply $DEFAULTNS><ok/></rpc-reply>") # freply=$(chunked_framing "<rpc-reply $DEFAULTNS><ok/></rpc-reply>")
# chunked_equal "$reply" "$freply" # chunked_equal "$reply" "$freply"
let i=0; let i=0;