Commit graph

109 commits

Author SHA1 Message Date
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
Olof hagsand
5b1c3d9a86 * clixon-config YAML file has new revision: 2019-02-06.
* Replaced all calls to (obsolete) `cli_output` with `fprintf`
* Added _experimental_ config option `CLICON_CLI_UTF8` default set to 0.
  * CLIgen UTF8 does not work with scrolling and control editing
2019-02-06 14:33:04 +01:00
Olof hagsand
0103d58994 2019 2019-01-02 15:48:30 +01:00
Olof hagsand
0baebc93fd * Strict namespace setting can be a problem when upgrading existing database files, such as startup-db or persistent running-db, or any other saved XML file.
* For backward compatibility, load of startup and running set CLICON_XML_NS_STRICT to false temporarily.
* Added three-valued return values for several validate functions where -1 is fatal error, 0 is validation failed and 1 is validation OK.
  * This includes: `xmldb_put`, `xml_yang_validate_all`, `xml_yang_validate_add`, `xml_yang_validate_rpc`, `api_path2xml`, `api_path2xpath`
* Added new xml functions for specific types: `xml_child_nr_notype`, `xml_child_nr_notype`, `xml_child_i_type`, `xml_find_type`.
2019-01-02 15:18:29 +01:00
Olof hagsand
56e51f1a8d 3.8.0.PRE preparations and
* Obsoleted COMPAT_CLIV and COMPAT_XSL that were optional in 3.7
2018-07-22 21:29:21 +02:00
Olof hagsand
ba7f84afee * Much better support for XPATH 1.0 according to https://www.w3.org/TR/xpath-10 using yacc/lex
* NOTE: Due to an error in the previous implementation, all XPATH calls on the form `x[a=str]` where `str` is a string (not a number or XML symbol), must be changed to: `x[a='str'] or x[a="str"]`
    * This includes all calls to `xpath_vec, xpath_first`, etc.
    * All calls to cli_copy_config in CLI spec files must replace 2nd argument from `x[%s=%s]` to `x[%s='%s']`
  * The old API is stillenabled. To define the new, define XPATH_USE_NEW in include/clixon_custom.h and recompile
2018-07-17 16:59:32 +02:00
Olof hagsand
85c4782e36 Dedicated xml,json,yang and xsl parser utility programs added
Sanity check of stdarg (...) added
Cleanup of error messages.
2018-06-17 19:40:06 +02:00
Olof hagsand
dacd2fe3a0 replace obsolete cvec_find_var with cvec_find 2018-06-08 15:54:43 +02:00
Olof hagsand
c5991c9844 * Added a generated CLI show command that works on the generated parse tree with auto completion.
* A typical call is: 	show @datamodel:example, cli_show_auto("candidate", "json");
  * The example contains a more elaborate example.
  * Thanks ngashok for request, see https://github.com/clicon/clixon/issues/24
2018-06-05 16:45:43 +02:00
Olof hagsand
39538461c2 dont exit cli when expand gets auth denied from backend 2018-06-03 20:18:43 +02:00
Olof hagsand
ea13727e97 * Removed cli callback vector functions. Set COMPAT_COMPAT_CLIV if you need to keep these functions in clixon_custom.h.
* Added --enable-debug.
2018-05-30 22:38:12 +02:00
Olof hagsand
1ac57dedaf Some memleaks and last minute 3.6 release changes. 2018-04-29 18:35:06 +02:00
Olof hagsand
67c0abead7 Fixed issue https://github.com/clicon/clixon/issues/17 special character in strings can break RPCs 2018-04-21 16:32:46 +02:00
Olof hagsand
7650803475 * Experimental NACM RFC8341 Network Configuration Access Control Model.
* CLICON_NACM_MODE config option, default is disabled.
  * Added username attribute to all rpc:s from frontend to backend
  * Added NACM backend module in example
2018-04-19 22:44:15 +02:00
Olof hagsand
79e3fbdaa9 * Restructure and more generic plugin API (cli,backend,restconf,netconf)
* For preparation for authorization RFC8341
  * Plugins add clixon_plugin_init() and api struct for function pointers, eg:
```
static const struct clixon_plugin_api api = {
    "example",
    clixon_plugin_init,
    ...
}
clixon_plugin_api *clixon_plugin_init(clicon_handle h)
{
    return (void*)&api;
}
```
  * Moved specific plugin functions from apps/ to generic functions in lib/
    * New generic plugin load function: clixon_plugins_load()
  * Removed client-local netconf plugins netconf_plugin_callbacks()
    * This was code used before generic YANG rpc calls
  * Added username to clixon handle:
    * clicon_username_get() / clicon_username_set()
  * Added authentication plugin callback
  * Removed some obscure plugin code that seem not to be used (please report if needed!)
    * CLI parse hook
    * CLICON_FIND_PLUGIN
    * clicon_valcb()
* Removed username to rpc calls (added below)
2018-04-02 10:38:53 +02:00
Olof Hagsand
ac7480b9f5 * Invalid key to api_path2xml gives warning instead of error and quit. 2018-03-05 20:00:10 +00:00
Olof hagsand
990700b68d https://github.com/clicon/clixon/issues/16
Added restconf/operations get, see RFC8040 Sec 3.3.2:
2018-03-04 21:24:38 +01:00
Olof hagsand
35b142cf4d * Added Yang "extension" statement. This includes parsing unknown
statements and identifying them as extensions or not. However,
  semantics for specific extensions must still be added.
* Renamed ytype_id and ytype_prefix to yarg_id and yarg_prefix, respectively

* Added cli_show_version()
2018-02-25 20:01:53 +01:00
Olof hagsand
278f3de840 Adding username to all restconf backend calls 2018-02-13 09:17:32 +07:00
Olof hagsand
e40d785d5c * Added a "user" parameter to plugin_credentials() restconf callback.
To enable authentication and in preparation for access control a la RFC 6536.
* yang string length "max" keyword set to MAXPATHLEN
2018-02-08 15:24:05 +07:00
Olof hagsand
363bd5d19d New configuration option: CLICON_RESTCONF_PRETTY
Changed RESTCONF GET to return object referenced. ie, GET /restconf/data/X returns X.
2018-01-07 18:01:42 +01:00
Olof hagsand
38f0b446fa 2017->2018 2018-01-01 12:25:33 +01:00
Olof Hagsand
0076a8b838 leafref bug 2017-12-09 20:48:29 +01:00
Olof hagsand
e169485985 Datastore cache introduced; Added yang to XML API 2017-12-02 14:49:49 +01:00
Olof hagsand
14cfc46ce4 Apple Darwin port 2017-10-12 22:03:02 +02:00
Olof hagsand
5cea5fa768 xml config default; api_path_fmt2api_path cleanup 2017-10-03 22:41:12 +02:00
Olof hagsand
becddfab41 Added format string to clicon_rpc_generate_error() and used that to make better backend error messages 2017-09-27 18:10:13 +02:00
Olof hagsand
d8065551b6 cli_copy config bug; allow non-api-path expand_dbvar() 2017-08-03 22:35:02 +02:00
Olof hagsand
fd91bb2933 restconf RPC 2017-07-30 16:16:10 +02:00
Olof hagsand
e5b625e722 Added support for yang presence and no-presence containers. 2017-07-23 12:59:02 +02:00
Olof hagsand
f995f1e268 Added completion for generated cli leafrefs for both absolute and relatve paths. 2017-07-19 09:26:56 +02:00
Olof hagsand
1b6c9aacbe Added validation for leafref forward and nackward references. 2017-07-18 19:56:54 +02:00
Olof hagsand
43c39160a5 Restricted yang (sub)module file match to match RFC6020 exactly 2017-06-25 17:48:21 +02:00
Olof hagsand
abd3eee17d Generic map_str2int generic mapping tables; Removed vector return values from xmldb_get() 2017-06-21 21:02:09 +02:00
Olof hagsand
3453dae0db - removed api_path extension from internal netconf
- Strings in xmldb_put not properly encoded, eg eth/0 became eth.00000
2017-05-30 21:57:06 +02:00
Olof hagsand
f6b3e95100 Created xmldb plugin api 2017-04-09 22:53:48 +02:00
Olof hagsand
31c45e5c62 removed cli single callback arg code 2017-04-06 10:26:10 +02:00
Olof Hagsand
1e92304a52 show_configuration and cli_copy_object added as generic cli commands 2017-04-05 13:27:02 +02:00
Olof hagsand
236b661e43 cleaned up string functions 2017-04-04 17:11:21 +02:00
Olof hagsand
19813a4d9c restconf post/put/head/patch, memtests 2017-03-26 15:14:37 +02:00
Olof hagsand
2fcefda831 Change internal protocol from clicon_proto.h to netconf. 2017-03-25 11:10:50 +01:00
Olof hagsand
4461cc9598 Netconf startup configuration support. Set CLICON_USE_STARTUP_CONFIG to 1 to
enable. Eg, if backend_main is started with -CIr startup will be copied to
  running.
 Added .. as valid step in xpath
2017-02-10 11:54:34 +01:00
Olof hagsand
7f0b9909b3 Library functions in clixon_cli_api.h (e.g cli_commit) is rewritten in new
for (eg cli_commitv). See clixon_cli_api.h for new names.
Use restconf format for internal xmldb keys. Eg /a/b=3,4
Changed example to use multiple cli callbacks
2017-01-31 22:36:14 +01:00
Olof hagsand
2db346abc8 Added cli multiple callback and expand support. 2017-01-15 20:22:51 +01:00