Commit graph

252 commits

Author SHA1 Message Date
Olof hagsand
6cb75f5492 Add tab mode in example. Make coverage script sh->bash script 2021-04-22 20:44:37 +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
7ebb538ebf - Changed master to 5.2.0.PRE
- Modified Makefiles for static linkage and coverage
- test namespace abstractions
2021-04-17 15:23:10 +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
d542cd5530 Add cli debug commands for cli/backend/restconf 2021-04-12 12:38:16 +02:00
Olof hagsand
244060fddc - Added specific WITH_RESTCONF compile contants for _NATIVE and _FCGI for C code
- Restconf auth=none changes
  - Load clixon-restconf and resolve features earlier so that config features work
  - Removed auth=none code from example (this was non-std half-baked basic auth)
  - Changed tests that used auth-type=none to enable feature clixon-restconf:allow-auth-none
- Moved cert creation from sub-shell to servercert function
- Fixed typos for dockerfile rename of restconf evhtp to native
2021-04-07 20:54:41 +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
e9df7b81f2 Building problems with evhtp 2021-03-31 22:38:24 +02:00
Olof hagsand
fb9917e81e * Removed endtag parameter of clixon_xml_parse_file() 2021-03-15 13:24:27 +01:00
Olof hagsand
f536b1dc67 Added: CLICON_CLI_AUTOCLI_EXCLUDE
Added openconfig interfaces tests
2021-03-15 13:08:42 +01:00
Olof hagsand
a8d29b1e7e * Restconf authentication callback (ca_auth) signature changed
* Not backward compatible: All uses of the ca-auth callback in restconf plugins must be changed
  * New version is: `int ca_auth(h, req, auth_type, authp, userp)`
    * where `auth_type` is the requested authentication-type (none, client-cert or user-defined)
    * `authp` is the returned authentication flag
    * `userp` is the returned associated authenticated user
    * and the return value is three-valued: -1: Error, 0: not handled, 1: OK
  * For more info see [clixon-docs/restconf](https://clixon-docs.readthedocs.io/en/latest/restconf.html)
2021-03-07 15:34:26 +01:00
Olof hagsand
3d07db24d9 * Added CLICON_ANONYMOUS_USER to clicon-config.yang
* evhtp restconf closes session on -1 fatal error (no hang)
* restconf auth-type=none call ca_auth callback
* main example for auth_type=none uses basic auth to get user but without passwd check
2021-02-21 14:48:12 +01:00
Olof hagsand
dee4e87edf Fixed [xml bind yang error in xml_bind_yang_rpc_reply #175](https://github.com/clicon/clixon/issues/175) 2021-02-16 17:21:33 +01:00
Olof Hagsand
d1e5599572 reorder clixon-restconf.yang and some test fixes 2021-02-14 14:48:52 +00:00
Olof hagsand
710fc76887 * Restconf authentication callback (ca_auth) signature changed
* Not backward compatible: All uses of the ca-auth callback in restconf plugins must be changed
  * New version is: `int ca_auth(h, req, auth_type, authp, userp)`
    * where `auth_type` is the requested authentication-type (none, client-cert or user-defined)
    * `authp` is the returned authentication flag
    * `userp` is the returned associated authenticated user
    * and the return value is three-valued: -1: Error, 0: ignored, 1: OK
  * For more info see [clixon-docs](https://clixon-docs.readthedocs.io/en/latest/restconf.html)
* New clixon-restconf@2020-12-30.yang revision
2021-02-09 21:26:35 +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
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
4de0a475d3 4.10.PRE 2020-12-28 13:16:25 +01:00
Olof hagsand
b8f5d1dcae * Added CLICON_BACKEND_RESTCONF_PROCESS to clixon-config.yang 2020-12-17 12:13:06 +01:00
Olof Hagsand
53cdfebe11
Merge pull request #161 from s-bauer/patch-1
Fixed example_reset function
2020-12-16 10:03:21 +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
8540820698 * New clixon-lib@2020-12-08.yang revision
* Added: autocli-op extension (see new features)
  * Added: rpc process-control for process/daemon management
* Added enable flag and removed presence in clixon-restconf
2020-12-13 22:19:25 +01:00
Simon Bauer
4ea547ac6f
Fixed example_reset function
The `xmldb_put` is failing due to the `x_spec` field not being set on the xml tree (`xt`) due to no yang spec being passed to the `clixon_xml_parse_string` function.
2020-12-13 17:04:43 +01:00
Olof hagsand
e1b94d94d2 * Ensure all fopen check for NULL (not -1)
* Improve test-perf cycles
2020-12-07 13:33:21 +01:00
Olof hagsand
e46f6f4a36 * Error-type changed from protocol to application for data-not-unique netconf/restconf errors
* Added new revision of main example yang: `clixon-example@2020-12-01.yang`
* Fixed [YANG: key statement in rpc/notification list #148](https://github.com/clicon/clixon/issues/148)
  * Do not check uniqueness among lists without keys
2020-12-01 18:58:20 +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
75f85e0253 revert yang2cli sub code, use existing yang2cli solution 2020-11-27 15:31:27 +01:00
Olof hagsand
dda3244252 * Auto-cli changed singature of yang2cli()
* Auto-cli: create generated CLI for sub-parts of a YANG spec
2020-11-26 17:32:09 +01:00
Olof hagsand
0b948248e4 * Reworked evhtp restconf config to only use clixon-restconf.yang and marked local restconf options as obsolete
* Extended clicon-config with clixon-restconf for local config
* Removed obsolete CLICON_TRANSACTION_MOD
2020-11-21 13:16:29 +01:00
Olof hagsand
9016dde319 Modify tests so they all work with evhtp and backend config, eg that CLICON_RESTCONF_CONFIG is default true.
Note that some tests are forced to CLICON_RESTCONF_CONFIG is false due to test complexities.
2020-11-18 13:57:25 +01:00
Olof hagsand
a0006075c3 Merge branch 'topic_benavrhm_rfc8527a_20201103' of https://github.com/benavrhm/clixon into benavrhm-topic_benavrhm_rfc8527a_20201103 2020-11-11 13:41:05 +01:00
Jonathan Ben-Avraham
a1f54d71ac Update yang/mandatory files for rfc8527 compliance
Updated the yang/mandatory files and test scripts for rfc8527.
2020-11-07 22:06:05 +02:00
Olof hagsand
c31b1c471b * Changed first parameter from int fd to FILE *f in the following functions:
* clixon_xml_parse_file(), clixon_json_parse_file(), yang_parse_file()
  * See [Bytewise read() of files is slow #146](https://github.com/clicon/clixon/issues/146)
2020-11-04 22:21:42 +01:00
Olof hagsand
1614bcd19c Cleanup master for 4.9.0.PRE 2020-10-19 20:06:20 +02:00
Olof hagsand
f07f291bdd Main examples uses new auto-mode 2020-10-18 00:02:38 +02:00
Olof hagsand
2d56c9674a * New YANG generated auto-cli feature with syntax modes
* The existing autocli does not support modes, complete paths must be given, eg: `set a b c d 42`.
  * In the new auto-cli, automatic modes are present at each YANG syntax node level, eg the above can be given as: `edit a b c; set d 4; top`
  * The existing CLI API remains, the new API is as follows: `cli_auto_edit()`, `cli_auto_up()`, `cli_auto_top()`, `cli_auto_show()`, `cli_auto_set()`, `cli_auto_merge()`, `cli_auto_create()`, `cli_auto_del()`.
  * See `test/test_cli_auto.sh` for an example of the new API, and `apps/cli/cli_auto.c` for the source code of the new callback API.
  * Documentation will be appear and full integration with the main example.
* Added inline state field to clixon-example.yang
* Added new clicon_data_cvec_*() API for generic cvec structs
2020-10-14 10:54:10 +02:00
Olof hagsand
09d33acd45 cli show options. doc and testing 2020-10-01 11:07:57 +02:00
Olof hagsand
101a8cb6e0 minor fixes 2020-09-27 17:15:36 +02:00
Olof hagsand
27bb0a1d2b * Fixed: Restconf failed put/post could leave residue in candidate causing errors in next put/post
* Added -v option for backend plugins to generate validation error
2020-09-10 18:09:17 +02:00
Olof hagsand
2c96cf71ea Changed main example: removed translate yang and replaced testcases w table/parameter 2020-09-08 11:39:55 +02:00
Olof hagsand
1db969d3a7 Main example: remove translate cli line, changed 'startup' to 'copy running startup' 2020-09-07 15:12:20 +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
0e4df0e8fc Added options for Restconf evhtp setting default bind socket address and ports CLICON_RESTCONF_IPV4_ADDR, CLICON_RESTCONF_IPV6_ADDR, CLICON_RESTCONF_HTTP_PORT, CLICON_RESTCONF_HTTPS_PORT 2020-08-21 13:13:20 +02:00
Olof hagsand
65733ffe69 * Added yang-binding yb parameter to xmldb_get0() and all xmldb get functions. 2020-08-03 13:57:04 +02:00
Olof hagsand
daeab85446 removed obsolete example yang, mod cli_dbxml to only append leaf in cli_set 2020-07-30 22:52:42 +02:00
Olof hagsand
593ed2ef3b Added const char * in multiple places 2020-07-02 19:25:48 +02:00
Olof hagsand
c049a397b0 Fixed ssl client certs for evhtp.
* Added SSL cert info as options: CLICON_SSL_SERVER_CERT, CLICON_SSL_SERVER_KEY, CLICON_SSL_CA_CERT
Added config.sh for testing for autotools
2020-07-01 15:11:22 +02:00
Olof hagsand
9c82e97072 Added http support for evhtp (not only https) 2020-06-29 14:41:08 +02:00
Olof hagsand
c2e459e8bb Three errors in new upgrade code: DEL didnt work, empty config did now work, neither did no yang files in a dir 2020-06-27 13:02:04 +02:00