Commit graph

102 commits

Author SHA1 Message Date
Olof hagsand
85e2945ec9 * Netconf message-id attribute changed from optional to mandatory
* Made NETCONF message handling more strict according to RFC 6241
  * Set `CLICON_NETCONF_MESSAGE_ID_OPTIONAL` to true to accept omission of message-id attribute
* Fixed: [need make sure message-id exist in rpc validate #240](https://github.com/clicon/clixon/issues/240)
2021-06-30 10:59:10 +02:00
shmuels
bfb7edece4 completing the function of hide for autocli-op in the yang files 2021-04-22 19:17:32 +03:00
shmuels
33ad428854 completing the function of hide for autocli-op in the yang files 2021-04-21 15:09:40 +03:00
shmuels
c370ac8706 completing the function of hide for autocli-op in the yang files 2021-04-18 16:58:18 +03:00
Olof hagsand
692dc12c03 * Fixed ["aux" folder issue with Windows. #198](https://github.com/clicon/clixon/issues/198)
* Updated config scripts
* removed unused expand_dir util cli function
* Fixed again [making cli_show_options's output more human readable #199](https://github.com/clicon/clixon/issues/199)
2021-04-07 09:44:18 +02:00
Olof hagsand
7412bb7b3d Fixed [changing interface name not support with openconfig module #195](https://github.com/clicon/clixon/issues/195) 2021-04-06 22:36:46 +02:00
Olof hagsand
2def5d2367 * Fixed Yang parsing of comments in (extension) unknown statements, to allow multiple white space
* Fixed cli_start_shell: comments and cli_error
* Fixed [making cli_show_options's output more human readable #199](https://github.com/clicon/clixon/issues/199)
* Fixed SSL/evhtp limited read buffer problem
2021-04-01 15:56:56 +02: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
68371d4fc5 upgrade copyright, aux tools, etc 2021-01-21 12:23:46 +01:00
Olof hagsand
96b50b88e8 Copyright 2021 2021-01-13 14:40:34 +01:00
Olof hagsand
96ab7292b9 * Added cvv_i output parameter to api_path_fmt2api_path() to see how many cvv entries were used
* CLIspec dbxml API: Ability to specify deletion of _any_ vs _specific_ entry.
2020-12-29 11:14:34 +01:00
Olof hagsand
75f85e0253 revert yang2cli sub code, use existing yang2cli solution 2020-11-27 15:31:27 +01:00
Olof hagsand
09d33acd45 cli show options. doc and testing 2020-10-01 11:07:57 +02:00
Olof hagsand
9a76899482 Fixed cli show conflicts for https://github.com/clicon/clixon/pull/137 2020-09-15 14:22:40 +02:00
Olof hagsand
81fc7f742b * Netconf as default namespace has been disabled by default.
* Only requests on the form: `<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config>...` will be accepted
  * All replies will be on the form: `<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">...`
  * Requests such as: `<rpc><edit-config>...` will not  be accepted.
  * You can revert this behaviour (to clixon pre-4.6 behaviour) by enabling `CLICON_NAMESPACE_NETCONF_DEFAULT`
  * This API change is a consequence of: [copy-config's RPC cxobj parameter does not contain namespace #131](https://github.com/clicon/clixon/issues/131)
2020-09-02 15:44:10 +02:00
Olof hagsand
0adcd94f3f * Added new cli show functions to work with cligen_output for cligen pageing to work. To acheive this, add a callback function as follows:
* xml2txt(...) --> xml2txt_cb(..., cligen_output)
  * xml2cli(...) --> xml2cli_cb(..., cligen_output)
  * clicon_xml2file(...) --> clicon_xml2file_cb(..., cligen_output)
  * xml2json(...) --> xml2json_cb(..., cligen_output)
  * yang_print(...) --> yang_print_cb(..., cligen_output)
2020-06-17 14:04:19 +02:00
Olof hagsand
5120409a56 Auto-cli updates and sync with clixon-docs 2020-06-15 16:07:04 +02:00
Olof hagsand
e898dda016 * Auto-CLI enhancements
* A generated clispec including state (default @datanodestate) also generated along with the config clispec tree (default @datanode)
  * New mode `GT_HIDE` set by option `CLICON_CLI_GENMODEL_TYPE` to collapse non-presence containers that only contain a single list
  * Added a prfix for cli_show_config/cli_show_auto so that it can produce parseable output
  * Thanks dcornejo@netgate.com for trying it out and suggestions
2020-06-13 12:05:26 +02:00
Olof hagsand
f9e1fe5de7 removed state path kludge 2020-05-05 17:13:38 +02:00
Olof hagsand
592c513b83 Fix up state bypass get code 2020-05-04 13:10:43 +02:00
Olof hagsand
65806f1ef2 Copyright change: LLC -> LLC(Netgate) 2020-04-23 16:55:56 +02:00
Olof hagsand
dc36282874 * Fixed instance-id multiple results
* Fixed last NACM write paths
2020-04-22 14:00:40 +02:00
Olof hagsand
0d4263e324 * xml_merge() changed to use 3-value return: 1:OK, 0:Yang failed, -1: Error
* `clixon_netconf_error(category, xerr, msg, arg)` removed first argument -> `clixon_netconf_error(xerr, msg, arg)`
* Renamed utility function `clixon_util_insert()` to `clixon_util_xml_mod()` and added merge functionality.
* Fixed: Insertion of subtree leaf nodes were not made in the crrect place, always ended up last regardless of yang spec (if ordered-by system).
2020-04-17 15:47:37 +02:00
Olof hagsand
09a2e09848 * New XML parsing API:
* `clixon_xml_parse_string()`
   * `clixon_xml_parse_file()`
* New JSON parsing API, with same signature as XML parsing:
   * `clixon_json_parse_string()`
   * `clixon_xml_parse_file()`
* XML YANG binding API have been rearranged as follows:
   * `xml_bind_yang_rpc()`
   * `xml_bind_yang_rpc_reply()`
   * `xml_bind_yang()`
   * `xml_bind_yang0()`
2020-03-19 21:32:27 +01:00
Olof hagsand
c5e2039cac Removed prefix parameter to xml_new
Added xml_new_body() by mgsmith
2020-03-17 11:18:22 +01:00
Olof hagsand
7425a3b520 * C-API change: xml_new() changed from xml_new(name, xp, ys) to xml_new(name, prefix, xp, type)
* If you have used, `ys`, add `xml_spec_set(x, ys)` after the statement
  * If you have `xml_type_set(x, TYPE)` or `xml_prefix_set(x, PREFIX)` immediately after the statement, you can remove those and set them directly as: `xml_new(name, PREFIX, xp, TYPE)`
2020-03-12 22:29:28 +01:00
Olof hagsand
adbb683329 C-API:
* All uses of `api_path2xpath_cvv()` should be replaced by `api_path2xpath()`
  * `api_path2xpath()` added an `xerr` argument.
2020-03-10 22:37:16 +01:00
Olof hagsand
bab3b5ad56 * Added yang population of data in clicon_rpc_get[_config] 2020-03-04 17:31:52 +01:00
Olof hagsand
9fa5e216c4 * New "general-purpose" datastore upgrade callback added which i called once on startup, intended for lo
w-level general upgrades and as a complement to module-specific upgrade.
  * Called on startup after initial XML parsing, but before module-specific upgrades
  * Enabled by definign the `.ca_datastore_upgrade`
  * [General-purpose upgrade documentation](https://clixon-docs.readthedocs.io/en/latest/backend.html#ge
neral-purpose)
* JSON parse error messages change from ` on line x: syntax error,..` to `json_parse: line x: syntax err
or`
* Unknown-element error message is more descriptive, eg from `namespace is: urn:example:clixon` to: `Fai
led to find YANG spec of XML node: x with parent: xp in namespace urn:example:clixon`.
* C-API parse and validation API more capable
  * `xml_spec_populate` family of functions extended with three-value return values
    * -1: error, 0: parse OK, 1: parse and YANG binding OK.
  * `xml_parse` and `json_parse` API changes
    * Three value returns: -1: error, 0: parse OK, 1: parse and YANG binding OK.
    * Extended `xml_parse_file2` and `xml_parse_string2` extended API functions with all options available.
      * New concept called `yang_bind` that defines how XML symbols are bound to YANG after parsing
    * Existing API same except `xml_parse_file` `endtag` argument moved to `xml_parse_file2`
* C-API: Added instrumentation: `xml_size` and `xml_stats_get`.
* Fixed: Enabling modstate (CLICON_XMLDB_MODSTATE), changing a revision on a yang, and restarting made the backend daemon exit at start (thanks Matt)
  * Also: ensure to load `ietf-yang-library.yang ` if CLICON_XMLDB_MODSTATE is set
2020-02-20 14:00:01 +01:00
Olof Hagsand
a87e9cb246 clang warnings 2019-12-23 14:03:42 +00:00
Olof hagsand
7ad16bd84b * C-API: Added xpath_first_localonly() as an xpath function that skips prefix and namespace checks.
* Added experimental code for optizing XPath search using binary search.
  * Enable with XPATH_LIST_OPTIMIZE
* Changed `clicon_rpc_generate_error(msg, xerr)` to `clicon_rpc_generate_error(xerr, msg, arg)`
2019-12-20 18:21:46 +01:00
Olof hagsand
d68a829862 * Added namespace-context parameter nsc to xpath_first and xpath_vec, (xpath_vec_nsc and xpath_first_nsc` are removed). 2019-12-07 20:46:13 +01:00
Olof hagsand
8cdb0bb062 * Changed so that 400 Bad Request are for invalid api-path or unknown yang elements, 404 Not Found for valid xml when object not found. 2019-10-07 22:20:34 +02:00
Olof hagsand
6e41592aec * Changed clicon_rpc_get and clicon_rpc_get_config functions: added username and replaced namespace with namespace context
* Fixed several issues with multiple namespaces.
2019-10-03 22:01:16 +02:00
Olof hagsand
ee329ee382 * RESTCONF "depth" query parameter supported
* C API change: Added `depth` parameter to function `clicon_xml2cbuf`, default is -1.
2019-08-17 10:54:13 +02:00
Olof hagsand
10a2dbe8ec * Added experimental binary search API function: xml_binsearch
* Added content parameter to `clicon_rpc_get` (-1 or CONTENT_ALL is default)
* Reverted change in clixon-lib.yang
2019-08-14 11:13:24 +02:00
Olof hagsand
aa653d0831 CLI multi-key bug for ordered-by user 2019-08-04 17:38:13 +02:00
Olof hagsand
df9e4734f9 Bugfix: multiple key cli bug, ambiguous commands in expand_dbvar 2019-08-04 17:07:11 +02:00
Olof hagsand
1fe7d916f4 segv on multiple keys 2019-08-03 15:08:10 +02:00
Olof hagsand
e7b60619da * Pushed tag to 4.0.1.PRE
* Restconf RFC 8040 increased feature compliance
  * Cache-Control: no-cache added in HTTP responses (RFC Section 5.5)
  * Restconf monitoring capabilities (RFC Section 9.1)
* Added support for Yang extensions
  * New plugin callback: ca_extension
  * Main backend example includes example code on how to implement a Yang extension in a plugin.
* JSON changes
  * Non-pretty-print output removed all extra spaces.
    * Example: `{"nacm-example:x": 42}` --> {"nacm-example:x":42}`
  * Empty JSON container changed from `null` to `{}`.
    * Empty list and leafs remain as `null`
* Removed unnecessary configure dependencies
  * libnsl, libcrypt, libm, if_vlan,...
* pseudo-plugin added, to enable callbacks also for main programs. Useful for extensions
* Yang Unique statements with multiple schema identifiers did not work on some platforms due to memory error.
2019-07-23 22:11:14 +02:00
Olof hagsand
fe46a0e093 Clixon release 4.0.0 2019-07-13 16:33:23 +02: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
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
a7af7e7593 memleaks 2019-05-22 18:27:53 +00: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
c17784cfe9 Removed O(n^2) in cli expand/completion code 2019-05-16 20:08:25 +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
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
56f32371ce * Backend plugin returning NULL was still installed - is now logged and skipped.
* [Parent list key is not validated if not provided via RESTCONF #83](https://github.com/clicon/clixon/issues/83), thanks achernavin22.
2019-04-11 11:25:42 +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