Commit graph

836 commits

Author SHA1 Message Date
Olof hagsand
bdb516fec9 YANG Action (RFC 7950 Section 7.15)
See [Support for "action" statement](https://github.com/clicon/clixon/issues/101)
2022-06-21 15:44:02 +02:00
Olof hagsand
87c65c3541 Fixed: [RPC edit-config payloads are not fully validated](https://github.com/clicon/clixon/issues/337) 2022-06-20 15:08:50 +02:00
Olof hagsand
0b16797a45 * Added: [Feature Request: Log SSL events](https://github.com/clicon/clixon/issues/331)
* Added syslog NOTICE on failed user certs
2022-06-08 13:22:38 +02:00
Olof hagsand
609e27e0c2 Augmented XML uses default namespace
* Instead of using prefixes for augmented XML, assign the default namespace
Test: moved datastore format tests from test_cli to new test_datastore_format
2022-06-08 11:49:48 +02:00
Olof hagsand
b6bfcb69f7 Text syntax parser/loader
Added support for list x y;
Uses a mechanism to parse as unknown XML body and post-parsing replace with list keys
Fixed example and test to work with new TEXT syntax
2022-06-02 19:28:49 +02:00
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
87719c623c Text syntax parser/loader
Leaf-list syntax using: "id [ leaf leaf ...]" syntax for output and input
Variables using \n\r in text
Added clixon_xvec_merge()
2022-06-01 11:08:19 +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
5740d37737 Clixon 5.8.0.pre 2022-05-30 12:30:37 +02:00
Olof hagsand
cca8c88ec1 5.7.0 release 2022-05-17 11:45:43 +02:00
Olof hagsand
0adeae64df Clixon 5.7.0 2022-05-16 19:44:32 +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
0c81b66ef3 Fixed: [Returning a string while Querying leaf-list for single entry](https://github.com/clicon/clixon/issues/326) 2022-05-12 12:04:13 +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
614c927343 * Added nsc parameter to xml2xpath() and ensured the xpath uses prefixes.
* Old code: add `NULL` as second parameter
2022-05-09 13:48:07 +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
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
ef302f0c05 Fixed: [if choice is declared with multiple elements or leaf-list with in a case scope , addition or updation is not happening as expected](https://github.com/clicon/clixon/issues/327)
* This includes several choice/case adjustments to follow RFC 7950 Sec 7.9 better
2022-04-29 19:16:56 +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
0ed8b836b1 Test: Ensured HVER/RCPROTO work as envvars to test and documented it 2022-04-23 17:23:41 +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
feec3a21d9 YANG key list and unique fixes
* Fixed: YANG key list check bad performance
  * List key check did unique "xpath" lookup instead of direct child traverse
* Fixed: YANG unique single schema-nodeid required "canonical" namespace
  * E.g., `a/b` did not work even if there was default namespace in XML
* Memory leak in xpath parser
2022-04-17 11:02:34 +02:00
Olof hagsand
580396d32f - Misc documentation
- Test: move pid file from tmp to global storage to prevent multiple instances
2022-04-14 15:21:25 +02:00
Olof hagsand
6c3771e604 Fixed: Removed warning at startup: No YANG spec for module-set 2022-04-12 16:51:01 +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
a51abd0063 * XPath parser: fixing lexical issues cornercases
* Some complexities in Section 3.7 Lexical Structure of XPath 1.0 spec
  * There used to be some cornercases where function-names could not be used as nodes
  * For example, `node()` is a nodetest, so `/node/` caused an error.
  * In the grammar these include: axisnames,  nodetests, functionnames
  * The NCNames vs functionnames is now impölemented according to the lexical structure section
2022-04-07 12:53:57 +02:00
Olof hagsand
f1300d7a12 * [Adding feature to top level container doesn't work](https://github.com/clicon/clixon/issues/322)
* Instead of removing YANG which is disabled by `if-feature`, replace it with an yang `anydata` node.
  * This means XML specified by such YANG is ignored, and it is not an error to access it
  * Note the similarity with `CLICON_YANG_UNKNOWN_ANYDATA`
2022-04-06 14:04:11 +02: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
3d648bc08f * [prevent clixon-restconf@2021-05-20.yang module from loading](https://github.com/clicon/clixon/issues/318)
* Instead of always loading it, load it to datastore YANGs only if `CLICON_BACKEND_RESTCONF_PROCESS` is `true`
*
2022-03-29 17:24:03 +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
85c6c11970 * Netconf: Disabled default announcing of Netconf 1.1, instead only announce 1.0
* See [Clixon does not switch to chunked framing after NETCONF 1.1 is negotiated](https://github.com/clicon/clixon/issues/314)
  * To enable Netconf 1.1, set `NETCONF_1_1_ANNOUNCE`
2022-03-17 20:29:41 +01:00
Olof hagsand
23b466a854 * YANG unique: added single descendant node ids as special case
* This means that two variants are supported:
    * unique "a b c", ie multiple direct chidlren
    * unique "a/b/c", ie single descendants
  * RFC 7950 Sec 7.8.3 is somewhat unclear
  * The combination is not supported
* Netconf data-not-unique info changed to return schema nodes instead of XML for RFC7950 compliance
2022-03-17 17:14:42 +01: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
a973eaaeef Fixed: [Xpath API do not support filter data by wildcard](https://github.com/clicon/clixon/issues/313) 2022-03-15 16:03:48 +01:00
Olof hagsand
9a88cb5f0d * Bumped version to 5.7.0_PRE
* Fixed: SEGV in cli show yang
2022-03-14 12:13:45 +01:00
Olof hagsand
60e6477be2 Clixon 5.6.0 Release 2022-03-08 10:40:34 +01:00
Olof hagsand
72025bfc5e CHANGELOG for 5.6.0; removed wwwdir 2022-03-07 20:08:33 +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
add797ed31 * Fixed: [Validate error when appending module B grouping to module A item use augment statement #308](https://github.com/clicon/clixon/issues/308) 2022-02-23 13:21:10 +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