Commit graph

54 commits

Author SHA1 Message Date
Olof hagsand
d9136c8972 * Stricter handling of multi-namespace handling
* This occurs in cases where there are more than one XML namespaces in a config tree, such as `augment`:ed trees.
  * Affects all parts of the system, including datastore, backend, restconf and cli.
* Invalid api-path syntax (eg non-matching yang) error changed from 412 operation-failed to 400 Bad request invalid-value, or unknown-element.
2019-09-29 14:45:08 +02:00
Olof hagsand
22307e0a9e Invalid api-path syntax error changed from 412 operation-failed to 404 invalid-value. 2019-09-21 11:26:03 +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
8b7b7b0f60 * RESTCONF "content" query parameter supported
* New clixon-lib@2019-08-13.yang revision
* Bugfix: If `ietf-netconf.yang` was imported from any yang module, client/backend communication stops working.
2019-08-13 13:21:11 +02:00
Olof hagsand
e244f5c8f8 Added patch media types; restconf patch test-cases; nsc spelling 2019-08-09 14:49:40 +02:00
Olof hagsand
46b6a8008a RESTCONF PATCH (plain patch) is supported according to RFC 8040 4.6.1 2019-08-08 11:42:45 +02:00
Olof hagsand
aa14f8ac2c RESTCONF PUT/POST -d {} media is enforced 2019-08-06 15:47:46 +02:00
Olof hagsand
b73348e0cd * Revised RESTCONF->NETCONF insert/point translation
* Netconf edit-config "operation" attribute namespace check is enforced
2019-08-02 17:04:27 +02:00
Olof hagsand
c97346921b Netconf operation attribute namespace check is enforced 2019-07-31 16:45:48 +02:00
Olof hagsand
2d9d204f69 * RESTCONF "insert" and "point" query parameters supported
* Yang Netconf leaf/leaf-list insert support
  * For "ordered-by user" leafs and leaf-lists, the insert and value/key attributes are supported according to RFC7950 Sections 7.7.9 and 7.8.6

* Fixed RESTCONF api-path leaf-list selection was not made properly
2019-07-31 14:04:27 +02:00
Olof hagsand
c1bae276ff * RESTCONF PUT/POST erroneously returned 200 OK. Instead restconf now returns:
* `201 Created` for created resources
  * `204 No Content` for replaced resources.
  * See [RESTCONF: HTTP return codes are not according to RFC 8040](https://github.com/clicon/clixon/issues/56)

* HTTP `Location:` fields added in RESTCONF POST replies
2019-07-25 13:15:31 +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
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
41f7e44dec Return 404 Not found error if restconf GET does not return requested instance 2019-07-04 20:21:07 +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
9d64ddd305 handle null 2019-03-21 20:51:57 +01:00
Olof hagsand
83edd29678 Revert "Revert "* Added valgrind memory leak tests in testmem.sh for restconf""
This reverts commit a73d2bd242.
2019-02-20 16:25:42 +01:00
Olof hagsand
a73d2bd242 Revert "* Added valgrind memory leak tests in testmem.sh for restconf"
String error
This reverts commit 6e63f0a77b.
2019-02-20 16:19:07 +01:00
Olof Hagsand
6e63f0a77b * Added valgrind memory leak tests in testmem.sh for restconf
* Added clicon_socket_set() and clicon_socket_get() functions for cleaning up backend server and restconf FCGI socket on termination.
* Removed obsolete `-x` command-line option to clixon_cli.
2019-02-20 13:06:18 +01:00
Olof hagsand
ea8c84a372 Added new log function: clicon_log_xml() for logging XML tree 2019-02-13 11:35:49 +01:00
Olof Hagsand
f02310dcef More on clixon base container on Alpine 2019-02-12 11:11:04 +01:00
Olof hagsand
0103d58994 2019 2019-01-02 15:48:30 +01:00
Olof hagsand
861300d6c0 netconf error handling and test summary script 2018-12-21 14:44:59 +01:00
Olof hagsand
f872c7e295 * More precise Yang validation and better error messages
* For Example, adding bad-, missing-, or unknown-element error messages, etc instead of operation-failed
* Removed delete-config support for candidate db since it is not supported in RFC6241.
* Switched the order of `error-type` and `error-tag` in all netconf and restconf error messages to comply to RFC order.
* Added example_rpc RPC to example backend
* Renamed xml_namespace[_set]() to xml_prefix[_set]()
* Some restconf error messages contained "rpc-reply" or "rpc-error" which have now been removed.
* Netconf/Restconf RPC extra input arguments are ignored (https://github.com/clicon/clixon/issues/47)
2018-12-21 01:33:41 +01:00
Olof hagsand
f2810e849f Fork fcgi handler for streams 2018-11-04 14:46:15 +01:00
Olof hagsand
71eddeaa74 * Restconf stream notification support - two variants.
* Both a "native" stream support and one using nginx/nchan pub/sub.
  * See (apps/restconf/README.md) for details.
* clixon-config YAML file has new revision: 2018-10-21.
2018-10-21 22:19:38 +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
b2abab71f0 local restconf rpc callback sent error and then main restconf handler sent ok. Callback should just return xml buffer, not do actual restconf callback 2018-04-15 10:52:52 +01:00
Olof Hagsand
a2e9a05902 mv api_return_err to restconf_lib.c 2018-04-08 16:07:24 +00: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
bfce20c760 * Added Clixon Restconf library
* Builds and installs a new restconf library: libclixon_restconf.so and clixon_restconf.h
  * The restconf library can be included by a restconf plugin.
  * Example code in example/Makefile.in and example/restconf_lib.c
* Authorization
  * Example extended with authorization
  * Test added with http basic authorization (test/test_auth.sh)
  * Documentation in FAQ.md
* README.md extended with new yang, netconf, restconf, datastore, and auth sections.
2018-03-25 15:47:27 +02:00
Olof hagsand
efa72e9e6f * Proper RFC 6241 Netconf error handling
* New functions added in clixon_netconf_lib.[ch]
  * Datastore code modified for RFC 6241
  * Remaining: validate, generic restconf and netconf code
2018-03-18 18:06:02 +00:00
Olof hagsand
55010e7541 restconf credentials plugin 2018-02-09 12:18:39 +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
38f0b446fa 2017->2018 2018-01-01 12:25:33 +01:00
Olof hagsand
548ffd2da6 Disabled key-value datastore; Removed mandatory requirements for BACKEND, NETCONF, RESTCONF and CLI dirs 2017-11-19 18:04:23 +01:00
Olof Hagsand
e8a8d6e871 Restconf: http cookie sent as attribute in rpc restconf_post operations to backend. 2017-10-25 21:09:04 +02:00
Olof hagsand
265ed859de mem leak 2017-08-01 19:39:19 +02:00
Olof hagsand
4e986d6660 Added new backend plugin callback: plugin_statedata() for getting state data; Added generic xml_merge() function. 2017-07-05 12:30:42 +02:00
Olof hagsand
f5c19d8586 Added state data 2017-07-01 17:42:39 +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
d02015f456 datastore text works with replace 2017-04-17 19:47:32 +02:00
Olof hagsand
85af4342dc common plugin code, removed clixon_proc.c 2017-04-12 22:39:01 +02:00
Olof hagsand
af334bb746 Removed curl dependency 2017-04-10 21:52:39 +02:00
Olof hagsand
f6b3e95100 Created xmldb plugin api 2017-04-09 22:53:48 +02:00
Olof hagsand
19813a4d9c restconf post/put/head/patch, memtests 2017-03-26 15:14:37 +02:00
Olof Hagsand
5c938febf4 xpath multiple match, int main, etc 2016-11-17 21:25:49 +01:00