Olof Hagsand
2a766c5adf
zerocopy memleak
2019-07-13 13:40:14 +00:00
Olof hagsand
40d5b99d3b
Reverted some of the nsc xpath API changes. In the revert, xpath_first() and xpath_vec() retain their old syntax with nsc==NULL.
...
The reason is to be conservative with the API. However, less used functions, such as xpath_vec_bool(), xpath_vec_ctx() and xpath_vec_flag() are changed with a new `nsc`parameter, which should be set to NULL in most cases.
2019-07-09 12:19:03 +02:00
Olof hagsand
1f8c759f3d
Merge branch 'master' of https://github.com/clicon/clixon .
...
Added new API function `xpath_parse()` to split parsing and xml evaluation.
2019-07-08 14:47:18 +02:00
Olof hagsand
67b8685bab
The Clixon API has been extended with namespaces, or namespace contexts in the following cases:
...
* CLIspec functions have added namespace parameter:
* `cli_show_config <db> <format> <xpath>` --> `cli_show_config <db> <format> <xpath> <namespace>`
* `cli_copy_config <db> <xpath> ...` --> `cli_copy_config <db> <xpath> <namespace> ...`
* Xpath API
* `xpath_first(x, format, ...)` --> `xpath_first(x, nsc, format, ...)`
* `xpath_vec(x, format, vec, veclen, ...)` --> `xpath_vec(x, nsc, format, vec, veclen, ...)`
* `xpath_vec_flag(x, format, flags, vec, veclen, ...)` --> `xpath_vec_flag(x, format, flags, vec, veclen, ...)`
* `xpath_vec_bool(x, format, ...)` --> `xpath_vec_bool(x, nsc, format, ...)`
* `xpath_vec_ctx(x, xpath, xp)` --> `xpath_vec_ctx(x, nsc, xpath, xp)`
* xmldb_get0 has an added `nsc` parameter:
* `xmldb_get0(h, db, xpath, copy, xret, msd)` --> `xmldb_get0(h, db, nsc, xpath, copy, xret, msd)`
* The plugin statedata callback (ca_statedata) has been extended with an nsc parameter:
* `int example_statedata(clicon_handle h, cvec *nsc, char *xpath, cxobj *xstate);`
* rpc get and get-config api function has an added namespace argument:
* `clicon_rpc_get_config(clicon_handle h, char *db, char *xpath, char *namespace, cxobj **xt);`
* `int clicon_rpc_get(clicon_handle h, char *xpath, char *namespace, cxobj **xt);`
2019-07-08 10:36:37 +02:00
Olof hagsand
c3245f0600
On validation callbacks, XML_FLAG_ADD is added to all nodes at startup validation, not just the top-level. This is the same behaviour as for steady-state validation.
2019-06-19 21:54:59 +02:00
Olof hagsand
3bad8bc874
* startup_extraxml triggers unnecessary validation
...
* Renamed startup_db_reset -> xmldb_db_reset (its a general function)
* In startup_extraxml(), check if reset callbacks or extraxml file actually makes and changes to the tmp db.
2019-06-14 22:01:30 +02:00
Olof hagsand
fc78824110
Many validation functions have changed error parameter from cbuf to xml tree.
2019-06-10 12:49:40 +02:00
Olof hagsand
3dba0b5370
Restore xmldb_get() to original (but removed one parameter
...
Moved all zero-copy xmldb_get functions to xmldb_get0.
Clarified CHANGELOG for xmldb_get changes
2019-06-04 11:14:03 +02:00
Olof Hagsand
2ae9529a3e
added regexp free routines, replaced regexp mode string with symbol
2019-05-29 14:17:30 +00:00
Olof hagsand
2fe185d683
* Support for multiple patterns as described in RFC7950 Section 9.4.7
...
* Added regex cache to type resolution
* Added compiled regexp parameter as part of internal yang type resolution functions
* All internal `ys_populate_*()` functions (except ys_populate()) have switched parameters: `clicon_handle, yang_stmt *)`
2019-05-29 11:39:09 +02:00
Olof hagsand
5b39b63698
Added --with-libxml2 to configure
2019-05-24 10:04:29 +02:00
Olof hagsand
e55a27bcac
Check for libxml2 include files, not lib in code
2019-05-23 22:55:46 +02:00
Olof hagsand
a804e05375
* Added clicon_handle as parameter to all validate functions
...
* Added libxml2 XSD regexp mode as alternative to posix translation
* Added `CLICON_YANG_REGEXP` option with possible values libxml2 and posix
2019-05-23 22:48:33 +02:00
Olof hagsand
7e109d1d4b
Startup transactions did not mark added tree with XML_FLAG_ADD as it should
2019-05-21 10:55:16 +02:00
Olof hagsand
bc54f2d04c
* Regexp improvements
...
* Added check for libxml in configure';
* Added clixon_util_regexp utility function
* Yang state get improvements
* Integrated state and config into same tree on retrieval, not separate trees
* Added cli functions `cli_show_config_state()` and `cli_show_auto_state()` for showing combined config and state info.
* Added integrated state in the main example: `interface/oper-state`.
* Added performance tests for getting state, see [test/test_perf_state.sh].
2019-05-20 16:03:29 +02:00
Olof hagsand
b103599a1a
* Clixon transaction mechanism has changed which may affect your backend plugin callbacks:
...
* Validate-only transactions are terminated by an `end` or `abort` callback.
* If a commit user callback fails, a new `revert` callback will be made to plugins that have made a succesful commit.
2019-05-10 14:45:23 +02:00
Olof hagsand
99b7a1fe5b
Clixon config option CLICON_XMLDB_CACHE renamed to CLICON_DATASTORE_CACHE and changed type from boolean to datastore_cache
2019-05-09 14:25:16 +02:00
Olof hagsand
70221742f7
Merge branch 'master' of https://github.com/clicon/clixon
2019-05-08 13:05:51 +02:00
Olof hagsand
06e6ef80d1
Non-key list now not accepted in edit-config (before only on validation)
2019-05-08 12:51:10 +02:00
Olof hagsand
1cfb190ea9
* Changed return values in internal functions: netconf_trymerge, startup_module_state, yang_modules_state_get
2019-05-07 13:26:34 +02:00
Olof hagsand
c529847790
* Yang "min-element" and "max-element" feature supported
...
* New Clixon Yang RPC: ping. To check if backup is running.
* Fixed support for multiple datanodes in a choice/case statement.
2019-05-07 11:47:30 +02:00
Olof hagsand
6bf2a74e24
* Restconf with startup feature will now copy all edit changes to startup db (as it should according to RFC 8040)
...
* See [Restconf does not handle startup datastore according to the RFC](https://github.com/clicon/clixon/issues/74 )
* Netconf Startup feature is no longer hardcoded, you need to explicitly enable it (See RFC 6241, Section 8.7)
* Enable in config file with: `<CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>`, or use `*:*`
2019-04-26 12:12:55 +02:00
Olof hagsand
6a0628141a
More performance tweaks
2019-04-21 17:29:11 +02:00
Olof hagsand
8c36083e16
* A yang type regex cache added, this helps the performance by avoiding re-running the regcomp command on every iteration.
...
* An XML namespace cache added (see `xml2ns()`)
* Better performance of XML whitespace parsing/scanning.
2019-04-19 16:01:39 +02:00
Olof hagsand
728c97ab6d
Failure in startup - modified to handle memory exhaustion when loading file
2019-04-18 15:38:15 +02:00
Olof hagsand
b714eff077
Failure in startup with -m startup or running left running_db cleared.
2019-04-18 12:20:31 +02:00
Olof hagsand
cef0dc5a22
* Added yang access functions
...
* Change all y->ys_parent to yang_parent_get(y)
* Change all y->ys_keyword to yang_keyword_get(y)
* Change all y->ys_argument to yang_argument_get(y)
* Change all y->ys_cv to yang_cv_get(y)
* Change all y->ys_cvec to yang_cvec_get(y)
2019-04-11 15:53:25 +02:00
Olof hagsand
4a1e0f2cbc
xmldb_get cache bug
2019-04-10 15:58:21 +02:00
Olof hagsand
e29cd7cfb9
* Optimized validation by making xml_diff work on raw cache tree (not copies)
...
* xmldb_get() removed unnecessary config option
2019-04-07 15:55:53 +02:00
Olof hagsand
b5f1f7346e
Structural C-code change: Merged yang_spec and yang_node types into yang_stmt
2019-04-02 12:27:33 +02:00
Olof hagsand
4de15343c9
optimize
2019-04-02 11:46:28 +02:00
Olof hagsand
c1b489c8db
Merge branch 'develop'
2019-03-31 20:54:44 +02:00
Olof Hagsand
1d2a001597
memleak
2019-03-31 20:38:33 +02:00
Olof hagsand
98a5ebc76e
* Structural change: removed datastore plugin and directory, and merged into regulat clixon lib code.
...
* Moved out code from clixon_options.[ch] into a new file: clixon_data.[ch]
2019-03-31 18:17:40 +02:00
Olof Hagsand
c07577b42b
startup diff vector should be children of config root, not root itself
2019-03-29 15:31:00 +01:00
Olof hagsand
60cb87f998
Removed argc/argv parameters from ca_start plugin API function. You may need to change signatures of your startup in your plugins
2019-03-28 17:11:55 +01:00
Olof hagsand
cdbce7645e
Changed hash API for better error handling
2019-03-28 13:16:44 +01:00
Olof hagsand
4902f7cf1d
Merge branch 'develop'
2019-03-27 16:32:01 +01:00
Olof hagsand
6ff36a2894
* Added xml_wrap function that adds an XML node above a node as a wrapper
...
* also renamed `xml_insert` to `xml_wrap_all`.
* Added `clicon_argv_get()` function to get the user command-line options, ie the args in `-- <args>`. This is an alternative to using them passed to `plugin_start()`.
2019-03-27 16:04:14 +01:00
Olof hagsand
8624be0a67
xml changelog next iteration
2019-03-26 12:04:51 +01:00
Olof hagsand
7b9edd7112
ret error
2019-03-25 14:31:21 +01:00
Olof hagsand
b9df1ed5b3
mem-leak
2019-03-25 11:26:57 +01:00
Olof hagsand
a0abf8436e
XML chanelog revision
2019-03-25 10:42:27 +01:00
Olof Hagsand
69dcc721a9
* Added CLICON_NACM_MODE "internal-rpc" which is for RPC functionality only
2019-03-22 17:09:05 +01:00
Olof Hagsand
10d45bcee3
Memory leaks and errors
2019-03-21 20:36:47 +01:00
Olof hagsand
3f68cca06c
* New yang changelog experimental feature for automatic upgrade
...
* Added modules-state diff parameter to xmldb_get datastore function for startup scenarios.
* Allowed Yang extended Xpath functions (syntax only):
* re-match, deref, derived-from, derived-from-or-self, enum-value, bit-is-set
* XSD regular expression handling of dash(`-`)
*: Translate XDS `[xxx\-yyy]` to POSIX `[xxxyyy-]`.
* YANG Anydata treated same as Anyxml
2019-03-21 18:05:55 +01:00
Olof hagsand
434f0b930e
Made Makefile concurrent so that it can be compiled with -jN
2019-03-21 10:40:00 +01:00
Olof hagsand
606245ef02
* Added flags to example backend to control its behaviour:
...
* Start with `-- -r` to run the reset plugin
* Start with `-- -s` to run the state callback
* Rewrote yang dir load algorithm to follow the algorithm in [FAQ](FAQ(doc/FAQ.md#how-are-yang-files-found) with more precise timestamp checks, etc.
2019-03-18 16:31:34 +01:00
Olof hagsand
932ca2e8ce
Changed (startup) running mode so that startup_db is not overwritten.
...
This changes the upgrade semantics for running mode which will have to
be accounted for later.
2019-03-12 09:56:09 +01:00
Olof hagsand
b1c74b5f1f
* Ensured you can add multiple callbacks for any RPC, including basic ones.
...
* Extra RPC:s will be called _after_ the basic ones.
* One specific usecase is hook for `copy-config` (see [doc/ROADMAP.md] that can be implemented thus way.
* `rpc_callback_register` added a namespace parameter. Example:
```
rpc_callback_register(h, empty_rpc, NULL, "urn:example:clixon", "empty");
```
2019-03-10 17:27:52 +01:00