Commit graph

933 commits

Author SHA1 Message Date
Olof hagsand
0c79298e76 Changed C-API for xml translation/print the internal cxobj tree data structure to other formats
New API is as follows:
  * `clixon_xml2file()` - Print internal tree as XML to file
  * `clixon_xml2cbuf()` - Print internal tree as XML to buffer
  * `clixon_json2file()` - Print internal tree as JSON to file
  * `clixon_json2cbuf()` - Print internal tree as JSON to buffer
  * `clixon_cli2file()` - Print internal tree as CLI format to file
  * `clixon_txt2file()` - Print internal tree as text format to file
2022-06-01 20:02:27 +02:00
Olof hagsand
2ece0b8f51 * Experimental text syntax parser/loader
* Added new text syntax parsing and loading from CLI
  * Unified text output functions to `xml2txt` and moved to clixon_text_syntax.[ch]
    * The following are removed: `cli_xml2txt` and `xml2txt_cb`
  * Text output format changed:
    * Namespace/modulename added to top-level
  * See [Support performant load_config_file(...) for TEXT format](https://github.com/clicon/clixon/issues/324)
2022-06-01 11:07:15 +02:00
Olof hagsand
43a57dad79 Changed C-API for xml translation/print to other formats.
* Added `skiptop` parameter, if set only apply to children of a node, skip top node
    * default is 0
* Functions are merged, ie removed and replaced with more generic functions
* `xml2json_cbuf()`: Added `skiptop` parameter: `xml2json_cbuf(..., int skiptop)`
* `xml2json()` and `xml2json_cb()` merged into `xml2json_file()` with `skiptop`
    * Replace `xml2json(...)` with `xml2json_file(..., stdout, 0)`
    * Replace `xml2json_cb(...)` with `xml2json_file(..., 0)`
* `clicon_xml2cbuf()`: Added `skiptop` parameter: `clicon_xml2cbuf(..., int skiptop)`
* `xml2cli()`: Added `skiptop` parameter: `xml2cli(..., int skiptop)`
2022-06-01 10:48:39 +02:00
Olof hagsand
8e6ba7fa53 test of cligen expand bug #332 2022-05-30 15:27:19 +02:00
Olof hagsand
50fcedafac Make socket read (SSL_read) error handling more resilient: log and continue instead of exit 2022-05-16 19:34:00 +02:00
Olof hagsand
7b099a5685 Fixed Restconf nghttp2 client EPIPE crash 2022-05-13 13:34:06 +02:00
Olof hagsand
d153bfcd0c Test: restconf notification parallel disabled. start script -l removed 2022-05-12 16:17:26 +02:00
Olof hagsand
9cbe313712 * Fixed: [Keywords containing '-' hyphen are missing from the auto-completion list](https://github.com/clicon/clixon/issues/330)
* Fixed by disabling `cligen_preference_mode`. This may have other side effects.
2022-05-12 14:54:53 +02:00
Olof hagsand
7065d6f760 Test: restconf CN variable, strip curl newline
Fixed a few compile warnings
2022-05-12 09:40:12 +02:00
Olof hagsand
a49cf41d1e * CLI expansion of leafrefs default behavior changed
* In the autocli and handcrafted CLI:s using `expand_dbvar()` the CLI expansion followed the leafrefs to the sources, ie the origin of the leafrefs
    * Instead leafref expansion now only looks at the leafrefs
2022-05-10 10:06:43 +02:00
Olof hagsand
7452813da7 Http data server Fixed binary data retrieval 2022-05-05 18:08:45 +02:00
Olof hagsand
90474d1523 Fixed: A long TLS+HTTP/2 request such as by a browser causing block of other requests.
Test: Disabled privileges test if clixon_restconf started with -r
2022-05-02 10:31:53 +02:00
Olof hagsand
463aa15544 Restconf compile warnings and docs 2022-05-02 10:28:24 +02:00
Olof hagsand
5551d753ef Logging fixes
* Fixed: [Error message seen twice in some cases](https://github.com/clicon/clixon/issues/325)
* Extended `-l` command-line option to all clixon commands with a `none` option, eg `-l n` directs logging to `dev/null`
2022-04-30 11:31:51 +02:00
Olof hagsand
28bd146e5c 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
2022-04-29 19:07:12 +02:00
Olof hagsand
f11e4bad6c Http data server changes
* Indirect redirects from directory to `index.html`
  * Added `HTTP_DATA_INTERNAL_REDIRECT` compile-time option
* Added CLICON_RESTCONF_API_ROOT to clixon-config.yang
* Added 404 return without body if neither restconf, data or streams prefix match
* Fixed: HTTP/1 parse error for '/' path
2022-04-28 16:17:07 +02:00
Olof hagsand
84d88c8ad8 Restconf http-data server updates
Check data paths for .., ~ and soft links
Changed semantics of `CLICON_HTTP_DATA_PATH` and `_ROOT`
Change URI catch-all to 404 instead of 400
Fixed some memory leaks
2022-04-26 17:42:53 +02:00
Olof hagsand
e0100a6e3c Fixed: YANG if-feature in config file did not work, was always on
Test: unset test variables
2022-04-23 16:49:09 +02:00
Olof hagsand
404d05950a HTTP data server updates
Check of enable-http-data config option
HTTP/2 Return 400 bad request if no path match
Test: updated yang file revisions, extended restconf config with http-data
2022-04-22 15:23:38 +02:00
Olof hagsand
2a8cedf0c3 Limited http-data static server
* Renamed from www-data to http-data
* New `clixon-restconf@2022-03-21.yang` revision
  * Added option:
    * `enable-http-data`
  * Added feature: `http-data`
* Added new str2str mapper
* Test: new test_http_data.sh, added CI github action testing
2022-04-21 16:02:39 +02:00
Olof hagsand
76213057b6 * Extended the Restconf implementation with a limited www-data
* This is an experimental implementation
  * Added `www-data` feature and two new config options to clixon-config.yang:
     * `CLICON_WWW_DATA_PATH`
     * `CLICON_WWW_DATA_ROOT`
  * The limited implemtation is as follows:
     * path: Local files within `CLICON_WWW_DATA_ROOT`
     * operation GET, HEAD, or OPTIONS
     * query parameters not supported
     * indata should be NULL (no write operations)
     * Limited media: text/html, JavaScript, image, and css
     * Authentication as restconf
Generic changes:
  * Uniform path selection across fcgi, native http/1 + http/2
2022-04-21 16:01:33 +02:00
Olof hagsand
fa077839f0 Misc sanity checks and documentation 2022-04-19 14:19:29 +02:00
Olof hagsand
6418e030ce RESTCONF FCGI notifications: minor timing adjustments, mostly for testcases 2022-04-18 12:15:26 +02:00
Olof hagsand
600f0616f6 Memory leak/err in notification when closing down
test: restconf notification chunked framing update
2022-04-17 13:30:07 +02:00
Olof hagsand
8c60d81ed2 - Disabled xpath optimization for hierarchical list
- Made cli show xpath command more capable
2022-04-14 15:21:25 +02:00
Olof hagsand
ecac027d18 CLI argument to shell example callback
Save state of netconf chunked framing between inputs
Treat EBADF in internal protocol (triggered by freebsd+notifications)
Test: chunked encoding: use printf instead of echo
2022-04-11 19:09:26 +02:00
Olof Hagsand
ac7673bc35 Fixed static build typo
Test: grep --null -Eo not supported on ubunti 20
Enable IPv6 for ubuntu
Vagrant: enable insecure downloads
2022-04-09 15:14:18 +00:00
Olof hagsand
1a9def2f6e [provide support for load config of cli format along with json and xml format as save config is supported for all 3 formats](https://github.com/clicon/clixon/issues/320) 2022-04-01 18:05:19 +02:00
Olof hagsand
451562ca77 Removed unnecessary libclixon_netconf, functions moved to libclixon 2022-03-29 15:46:38 +02:00
Olof hagsand
9690e0d8f2 * Fixed: HTTP/1 multiple write requests in single session appended data between writes, eg PUT+PUT. 2022-03-28 22:55:43 +02:00
Olof hagsand
c038c9a27f * Implementation of "chunked framing" according to RFC6242 for Netconf 1.1.
* First hello is 1.0 EOM framing, then successing rpc is chunked framing
  * See
    * [Netconf framing](https://github.com/clicon/clixon/issues/50), and
    * [Clixon does not switch to chunked framing after NETCONF 1.1 is negotiated](https://github.com/clicon/clixon/issues/314)
* C:
  * Moved netconf framing code from netconf application to clixon lib
* Test:
  * New expecteof_netconf and adjusted other expect scripts to handle NETCONF 1.1 framing
2022-03-28 12:36:44 +02:00
Olof hagsand
bf983d7ca4 * New clixon-config@2022-03-21.yang revision
* Added option:
    * `CLICON_NETCONF_BASE_CAPABILITY`
* Removed `NETCONF_1_1_ANNOUNCE` compile option
2022-03-27 17:38:36 +02:00
Olof hagsand
dfeb7cef75 * CLI reconnects to backend if backend restarts with a warning
* Note that edits to the candidate database or locks will be lost
  * To force the CLI to exit if backend restarts, undef `PROTO_RESTART_RECONNECT`
  * This is an effect of the fix of [Broken pipe error seen in client (cli) when backend restarts and CLICON_SOCK is recreated](https://github.com/clicon/clixon/issues/312), the CLI behavior on backend restart is changed.
* Added `eof` parameter to `clicon_rpc()` and `clicon_rpc1()` and error handling modified
2022-03-16 18:30:21 +01:00
Olof hagsand
72025bfc5e CHANGELOG for 5.6.0; removed wwwdir 2022-03-07 20:08:33 +01:00
Olof hagsand
ff37ce808c * Rename demon -> daemon 2022-03-07 11:18:27 +01:00
Olof hagsand
dd2ac56af8 Module state upgrade: RFC7895 to RFC 8525
Changes to clixon-config:
  * Added option: 'CLICON_YANG_LIBRARY`
  * Changed default value: `CLICON_MODULE_LIBRARY_RFC7895` to false
Datastore modstate is backward compatible
Tests upgraded to RFC8525
2022-03-07 10:56:54 +01:00
Olof hagsand
dd4e2be25c Deleted obsolete fields in clixon-config.yang 2022-03-05 12:48:37 +01:00
Olof hagsand
0a593cd513 * [Strict auto completion for CLI argument expansion #163](https://github.com/clicon/clixon/issues/163)
* Fixed a bug with the extension API: different unknown statements were treated as same
2022-03-01 09:27:11 +01:00
Olof hagsand
cf2de375f7 - Moved backend start message to after the clixon socket ops: create/bind/listen 2022-02-26 10:24:29 +01:00
Olof hagsand
2291275fae Fixed: [Restconf PATCH method request failed on item defined by submodule #306](https://github.com/clicon/clixon/issues/306) 2022-02-23 11:20:52 +01:00
Olof hagsand
97316e0bfa * Follow-up on [restconf GET json response does not encode top level node with namespace as per rfc #303](https://github.com/clicon/clixon/issues/303)
* Load/save JSON config file did not work
* Added rfc7951 parameter to `clixon_json_parse_string()` and `clixon_json_parse_file()`
  * If set, honor RFC 7951: JSON Encoding of Data Modeled with YANG, eg it requires module name prefixes
  * If not set, parse as regular JSON
* Test: added test_db.sh for datastore format tests
2022-02-22 14:28:01 +01:00
Olof hagsand
503c4f8754 * Fix: http1 parser termination with EOF required on freebsd flex
* Test: sed -i does not seem to work on all platforms
2022-02-17 20:55:52 +01:00
Olof hagsand
bf00fdf2c1 * Fixed: [restconf GET json response does not encode top level node with namespace as per rfc #303](https://github.com/clicon/clixon/issues/303) 2022-02-17 18:42:37 +01:00
Olof hagsand
12695c5d87 * Unit test ifdef for restconf http1 parser
* test: fix cli-union test
2022-02-17 09:16:01 +01:00
Olof hagsand
61661e6940 Restconf and http/1 modifications for http/1-only 2022-02-15 15:48:37 +01:00
Olof hagsand
c006c6189d - Fixed restconf http/1 only compile errors 2022-02-15 09:31:32 +01:00
Olof hagsand
82e0d907b3 restconf typo, left minimal debug recv buffer in place 2022-02-15 08:52:57 +01:00
Olof hagsand
12dddfd794 * RESTCONF,
* Refactored http1 code
  * fixed some http1/http2 only compile issues
2022-02-14 21:03:23 +01:00
Olof hagsand
78bdc4eaca Backend ignore of SIGPIPE. This occurs if client quits unexpectedly over the UNIX socket.
This is a timing issue but occurs more frequently in large RESTCONF messgaes.
2022-02-14 20:56:57 +01:00
Olof hagsand
10886a31a2 * Fixed inefficient RESTCONF HTTP/1 read body by appending bufs instead of re-parsing
* Fixed: http1 by mistake included in fcgi build
* Test: restconf perf test uses restconf for initial setup instead of netconf
2022-02-12 21:54:22 +01:00