Commit graph

201 commits

Author SHA1 Message Date
Olof hagsand
62e652bbcf Confirm-commit refactoring
Moved commit-confirm code to backend_confirm.c and removed (almost all) globals vars
2022-10-24 10:54:51 +02:00
Olof hagsand
6f0bd01a6a Confirm-commit RESTCONF support 2022-10-18 10:56:14 +02:00
Phil Heller
284316b646 Initial implementation of NETCONF confirmed-commit 2022-10-03 21:44:35 -06:00
Olof hagsand
e3f3d772c7 Fixed: [message-id present on netconf app "hello"](https://github.com/clicon/clixon/issues/369) 2022-09-28 15:04:11 +02:00
Olof hagsand
2eb9c6cda1 Refactored YANG min/max validation code, created new clixon_validate_minmax.[ch]
Added new recursive minmax check for non-presence containers
This makes validation checks stricter, including check of incoming RPCs
Renamed xml_yang_check_list_unique_minmax() to xml_yang_minmax_recurse()
Fixed again: [YANG min-elements within non-presence container does not work](https://github.com/clicon/clixon/issues/355)
2022-09-01 18:29:17 +02:00
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
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
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
77b4468eb3 Updated copyright statements to 2022 2022-01-18 16:36:00 +01:00
Olof hagsand
5388aace12 Refactoring for better performance of large auto-cli specs
* Fixed: [very slow execution of load_set_file #288](https://github.com/clicon/clixon/issues/288)
* New `clixon-lib@2021-11-11.yang` revision
  * Modified option: RPC stats extended with YANG stats
* Modified `clixon-config@2021-11-11.yang` revision
  * Added option:
    * CLICON_PLUGIN_CALLBACK_CHECK
    * Enable to make plugin context check before and after all callbacks.
* Added statistics for YANG: number of objects and memory used
* Use the treeref no-copy option of CLIgen to reduce memory
* Refactored cli-generation/autocli-start code
* Refactored cligen glue functions to use cligen_eval directly (remove clicon_eval,clixon_cligen_eval)
2021-11-25 12:04:05 +01:00
Olof hagsand
0626de9431 * RPC replies now verified with YANG
* Stricter checking of outgoing RPC replies from server
  * See [RPC output not verified by yang](https://github.com/clicon/clixon/issues/283)
  * This lead to some corrections of RPC replies in system code
2021-11-16 22:12:14 +01:00
Olof hagsand
7631c3f0a3 coverage: added tests for all ints 2021-10-06 08:36:34 +02:00
Olof hagsand
b70e22096e - Pagination: enabled LIST_PAGINATION and remobved constant
- Changed logic on how to find clixon_restconf in pseudo plugin
- Removed ==== in constants to avoid conflict with git merge
- Remove assert
- Added fuzzing for netconf
2021-09-23 13:33:26 +02:00
Olof hagsand
6e316b519b - Refactoring of get_common/get_list_pagination with two sub-functions
- Fixed memory leak
2021-09-21 11:27:58 +02:00
Olof hagsand
caabfd464e * New state callback signature (ca_statedata2)
* The new callback contains parameters for paging
   * Goal is to replace ca_statedata callback
* New plugin callback when lock/unlock occurs
  * Add `ca_lockdb` tro plugin init to use it.
* Fixed: Typing 'q' in CLI more paging did not properly quit output
  * Output continued but was not shown, for a very large file this could cause considerable delay
* Fixed: Lock was broken in first get get access
  * if the first netconf operation to a backend was lock;get;unlock, the lock was broken in the first get access.
2021-09-21 11:27:58 +02:00
Olof hagsand
a046306270 - New netconf-specific uint32 parse functions
- Added failure handling to xpath traverse_canonical
- Started pagination cli code
2021-09-21 11:24:53 +02:00
Olof hagsand
fb0b9409f3 - Moved restrconf code from pageing rpc to get 2021-09-21 11:24:53 +02:00
Olof hagsand
c9843b34a6 - Rewrite of netconf get/get-config code
- Unified get and get-config code to single function get_common
  - Integrated list-pagination code
  - Moved get code to new files backend_get.[ch]
2021-09-21 11:24:53 +02:00
Olof hagsand
b03cf426a4 * Protyped netconf native pagination 2021-09-21 11:24:53 +02:00
Olof hagsand
6bf3112fe7 * JSON encoding of YANG metadata according to RFC 7952
* XML -> JSON translation
2021-09-21 11:23:40 +02:00
Olof hagsand
76e59873c2 - Changed media name: yang.collection+xml/yang to application-collection+xml/json
- Modified ietf-netconf-list-pagination.yang:
     - changed get-pagable ->  get-pageable
     - renamed count -> limit
     - renamed skip -> offset
     - added import ietf-yang-metadata
     - added md:annotation remaining
2021-09-21 11:22:41 +02:00
Olof hagsand
0c7f2043f3 * Pagination according to new draft
* count/skip -> limit/offset
* ietf-yang-metadata RFC 7952 support, placeholder parsing and extension
2021-09-21 11:22:41 +02:00
Olof hagsand
77bacc93bb - Updated code to clixon 5.2 status
- Added LIST_PAGINATION clixon_custom constant
- Fix: leafs added as augments on rpc input/output lacked cv:s
2021-09-21 11:22:40 +02:00
Olof hagsand
2485bec483 fixes for compilation 2021-09-21 11:22:40 +02:00
Olof hagsand
2b5dceb82c cli pagination 2021-09-21 11:22:40 +02:00
Olof hagsand
8e266dd136 skip+count 2021-09-21 11:22:40 +02:00
Olof hagsand
78f5a6983c Pagination draft 2021-09-21 11:22:40 +02:00
Olof hagsand
2e857bb417 First working prototype 2021-09-21 11:22:40 +02:00
Olof hagsand
dee081646c * Fixed: SEGV in clixon_netconf_lib functions from internal errors including validation.
* Check xerr argument both before and after call on netconf lib functions
2021-07-27 10:31:16 +02:00
Olof hagsand
dd8883420c * Made backend transaction and commit/validate API available to plugin code.
* This enables that RPOC handles can call commit and validate via lib
  * The commit/validate API is now: `candidate_validate()` and `candidate_commit()`
2021-06-17 19:20:27 +02:00
Olof hagsand
c20c672d83 * Changed config and install options for Restconf
* clixon_restconf daemon is installed in /usr/local/sbin (as clixon_backend), instead of /www-data
    * `configure --with-wwwdir=<dir>` remains but only applies to fcgi socket and log
    * New option `CLICON_RESTCONF_INSTALL_DIR` is set to where clixon_restconf is installed, with default `/usr/local/sbin/`
  * Restconf drop privileges user is defined by `CLICON_RESTCONF_USER`
    * `configure --with-wwwuser=<user>` is removed
  * clixon_restconf drop of privileges is defined by `CLICON_RESTCONF_PRIVILEGES` option
* New clixon-restconf@2020-05-20.yang revision
  * Added: restconf `log-destination`
2021-05-23 17:14:18 +02:00
Olof hagsand
b88722fa25 - Restructure plugin module using a "module struct" rather than global variables.
This include plugin module init and exit functions
  New type: clixon_plugin_t exposed via public API while struct clixon_plugin is private
- Makefile changes for static linkage using "LINKAGE=static"
- Moved nacm external init to later stage in backend_main
2021-04-19 11:06:40 +02:00
Olof hagsand
8469a0962e * Add multiple yang support also for obsolete versions
* This means that files and datastores supporting modstate also looks for deleted or updated yang modules.
  * A stricter binding which gives error if loading outdated YANG file does not exist.
* Stricter yang checks: you cannot do get-config on datastores that have obsolete YANG
* Added xerr output parameter to `xmldb_get0()`
2021-04-12 12:42:26 +02:00
Olof hagsand
07d196dfd0 Added several fields to process-control status operation: active, description, command, status, starttime, pid 2021-03-12 17:22:22 +01:00
Olof hagsand
7e9a207ab2 * New clixon-lib@2020-03-08.yang revision
* Changed: RPC process-control output to choice dependent on operation
2021-03-12 12:10:25 +01:00
Olof hagsand
b7991d9b39 * Made a separate Clixon datastore XML/JSON top-level symbol
* Replaces the hardcoded "config" keyword.
  * Implemented by a compile-time option called `DATASTORE_TOP_SYMBOL` option in clixon_custom.h
* Tests: added endtest to all tests. Removed all premature exits if BE=0
2021-03-05 14:15:15 +01:00
Olof hagsand
b2f9c59a34 * Reverted blocked signal behavior introduced in 5.0.
* Introduced a delay before making process start/stop/restart processes for race conditions when configuring eg restconf
* For restconf `CLICON_BACKEND_RESTCONF_PROCESS`, restart restconf if restconf is edited.
2021-03-02 12:24:07 +01:00
Olof hagsand
b41f68b677 debug print of backend state, split test-stream into a netconf and restconf part, change restconf yang auth-type from leaf-list to leaf 2021-01-27 14:40:34 +01:00
Olof hagsand
96b50b88e8 Copyright 2021 2021-01-13 14:40:34 +01:00
Olof hagsand
cf63d0f761 * New clixon-config@2020-12-30.yang revision
* New clixon-lib@2020-12-30.yang revision
* Added callback to process-control RPC feature in clixon-lib.yang to manage processes
* Changed behavior of starting restconf internally using `CLICON_BACKEND_RESTCONF_PROCESS` monitoring changes in enable flag, not only the RPC.
* Changed: RPC process-control output parameter status to pid
2021-01-02 17:27:44 +01:00
Olof hagsand
eaedb14918 Prepare for 4.9.0 release 2020-12-18 13:54:00 +01:00
Olof hagsand
22adc58187 * New process-control RPC feature in clixon-lib.yang to manage processes
* This is an alternative to manage a clixon daemon via sudtemd, containerd or other
  * One important special case is starting the clixon-restconf daemon internally
  * This is how it works:
    * Register a process via `clixon_process_register(h, name, namespace, argv, argc)`
    * Use process-control RPC defined in clixon-lib.yang to start/stop/restart or query status on that process
  * Example code in the main example
2020-12-15 15:48:42 +01:00
Olof hagsand
d045e8abce * Fixed: [namespace prefix nc is not supported in full #154](https://github.com/clicon/clixon/issues/154)
* edit-config "config" parameter did not work with prefix other than null
2020-12-02 14:21:17 +01:00
Olof hagsand
c32950c8a9 * Added message-id attributes in error and hello replies
* See [namespace prefix nc is not supported in full #154](https://github.com/clicon/clixon/issues/154)
* Removed mandatory loading of clixon_restconf.yang
2020-12-01 12:14:30 +01:00
Olof hagsand
4ecffa6885 test systemctl; better rpc namespace errormsg 2020-11-11 13:09:58 +01:00
Olof hagsand
fab261cb53 * Added XPATH functions position 2020-10-27 09:40:45 +01:00
Olof hagsand
1614bcd19c Cleanup master for 4.9.0.PRE 2020-10-19 20:06:20 +02:00
Olof hagsand
a77cd27abb * Fixed: [namespace prefix nc is not supported](https://github.com/clicon/clixon/issues/143)
* Added more sanity checks on incoming top-level rpc and hello messages, including verifying top-level namespace
2020-10-17 18:04:46 +02:00
Olof hagsand
6465022f57 Find non-config nodes and mark/return error with better error message 2020-10-15 13:55:44 +02:00