Commit graph

58 commits

Author SHA1 Message Date
Olof hagsand
da2edceb7e * Added new functions: xml_tree_equal and xpath2xml
* RFC 8528 yang schema mount-points:
  * Made expand_dbvar and cli_dbxml mountpoint-aware (RFC 8528)
  * autocli supportgenerate
  * Made api_path2xml and xml2api_path mount-point-aware
  * Temporar fix in clixon_custom.h: XPATH_CANONICAL_SKIP_CHECK
* `xml2xpath()`: Added `apostrophe` as 4th parameter, default 0
* removed extra assert.h includes
2023-03-23 22:16:33 +01:00
Olof hagsand
5f2978d06c Files: Rearranged backend .h files: moved client_entry to clixon_backend_client.h 2023-03-03 16:05:31 +01:00
Olof hagsand
585e725aec Yang schema mount: replaced config --enable-yang-schame-mount with runtime option CLICON_YANG_SCHEMA_MOUNT
Added config and validation-level as parameters to ca_yang_mount
2023-02-17 16:39:39 +01:00
Olof hagsand
6681eb99d3 Netconf monitoring statistics frm RFC 6022 2023-02-04 17:13:45 +01:00
Olof hagsand
91034e5361 YANG schema mount, added configure option --enable-yang-schema-mount 2023-01-30 11:49:11 +01:00
Olof Hagsand
a8e13047fc * YANG schema mount RFC 8528, state data 2023-01-27 15:11:08 +01:00
Olof hagsand
51ebbdf12f * C-API: Added clicon_handle parameter to all xml_bind_* calls 2023-01-27 14:56:58 +01:00
Olof hagsand
da9bfcbb53 * Changed debug levels in clicon_debug() to be based on maskable flags
* Added flag names: `CLIXON_DBG_*`
  * Added maskable flags that can be combined when debugging:
    * `DEFAULT` = 1: Basic debug message, espcially initialization
    * `MSG` = 2: Input and output packets, read datastore
    * `DETAIL` = 4: Details: message dump in hex, xpath parse trees, etc
    * `EXTRA` = 8: Extra detailed logs
* Test: some errors in yang-lib where content-id was in wrong place
2023-01-27 14:56:58 +01:00
Olof Hagsand
b3dcee9639 * YANG schema mount RFC 8528, Initial commit (work in progress)
* Keep track of YANG unknowns with ys_cvec of EXTENSION
* C-API: Init ys_cvec to NULL, added yang_cvec_add() and adjusted code to use it
2023-01-20 16:16:02 +01:00
Olof Hagsand
bc6cc2b31f C-API: All calls to clicon_log_xml() changed to new function `clicon_debug_xml()\
Debugging, moved many detailed debugs from level 1 to 2
2023-01-15 13:17:58 +01:00
Olof hagsand
3916fa919c Netconf monitoring RFC 6022 Sessions (https://github.com/clicon/clixon/issues/370)
- statistics and transport/source-host parameters
  - extended internal NETCONF hello with transport and source-host attributes
clixon-lib,yang
  - Moved all extended internal NETCONF attributes to the clicon-lib namespace
C-API:
  - wrapped most attribute creation into new fn xml_add_attr()
2023-01-15 12:36:59 +01:00
Jan-Olof Carlson
e8048fa434 Conditional compilation to support report-all default retrieval 2022-12-20 10:14:09 +00:00
Jan-Olof Carlson
8883d012c7 Set basic mode retrieval to explicit by default. RFC6243 2022-12-19 20:30:11 +00:00
Olof hagsand
0d41d49fa9 Moved with-defaults processing from get(-config) to xmldb_get when reading db
With-defaults: fixed cornercase in xpath used in list pagination
C-API: Added `with-defaults` parameter (default 0) to `xmldb_get0()`
2022-12-18 19:59:02 +01:00
Olof hagsand
981d6f3797 Cleanup: vagrant typo 2022-12-03 18:48:08 +01:00
Olof hagsand
c94e9dad67 Feature Request: Support RFC 6022 (NETCONF Monitoring)
* Added capabilities and schema state, and get-schema rpc
* New `clixon-config@2022-11-01.yang` revision
  * Added option:
    * `CLICON_NETCONF_MONITORING`
    * `CLICON_NETCONF_MONITORING_LOCATION`
2022-11-28 15:53:24 +01:00
Olof hagsand
05cdbf5c4f * List-pagination: Adhere to ietf-draft: Removed list-pagination "presence"
* Remove default expansion in NETCONF client
* C-API: Added `expanddefault` parameter to `xml_yang_validate_rpc()`
2022-11-02 11:25:06 +01:00
Olof hagsand
d84c529ff1 [Code formatting: Change indentation style to space](https://github.com/clicon/clixon/issues/379)
* Applies to all c/h/y/l/sh files and .editorconfig
2022-10-27 14:21:17 +02:00
Jan-Olof Carlson
b63918ff08 with-defaults added as RESTCONF capability information 2022-09-19 11:02:59 +00:00
Olof hagsand
51fca05642 With-defaults tagged: move wd attribute from <data> to level under
show cli: remove empty container
2022-09-09 13:46:20 +02:00
Olof hagsand
743076b171 With-defaults CLI support
Extended cli_auto_show() with with-defaults argument, also changing its signature
Example: Added with-defaults argument to clispec
C-API: Added with-defaults argument to clicon_rpc_get_config
Replaced with-defaults prefix/namespace with constants
2022-09-09 13:46:20 +02:00
Jan-Olof Carlson
42d5b6fba2 remove containers holding only default values 2022-09-09 13:46:20 +02:00
Jan-Olof Carlson
2e3a5a6334 Minor adjustments to follow clixon programming style 2022-08-29 18:29:31 +02:00
Olof hagsand
ad7232d1ad Added top-level namespaces when pruning XML tree for client rpc calls and restconf GET
Added new xmlns_set_all()
2022-08-29 18:29:31 +02:00
Jan-Olof Carlson
9be83d6c7e Added support for with-defaults to list pagination 2022-08-29 18:29:31 +02:00
Jan-Olof Carlson
c8f98f7c3c Added namespace when with-defaults=report-all-tagged 2022-08-29 18:29:31 +02:00
Jan-Olof Carlson
2f0f1ef5a7 FC6243 with-defaults=report-all-tagged test cases and implementation added 2022-08-29 18:29:31 +02:00
Olof hagsand
f3ab3006e8 Fixed: [with-defaults=trim does not work due to dodgy handling of state data marked as default](https://github.com/clicon/clixon/issues/348) 2022-08-29 18:29:31 +02:00
Jan-Olof Carlson
71fe10a057 with-defaults=trim does not work due to dodgy handling of state data marked as default 2022-08-29 18:27:07 +02:00
Jan-Olof Carlson
9647177165 Correct NETCONF error-tag when operation not supported 2022-08-29 18:27:07 +02:00
Jan-Olof Carlson
0a20348b3b rfc6243 with-defaults Capability for NETCONF 2022-08-29 18:27:07 +02:00
Olof hagsand
33c77c8a09 Cleanup, debug stmts, diff vars and obsolete compile options 2022-06-23 15:40:47 +02:00
Olof hagsand
0c79298e76 Changed C-API for xml translation/print the internal cxobj tree data structure to other formats
New API is as follows:
  * `clixon_xml2file()` - Print internal tree as XML to file
  * `clixon_xml2cbuf()` - Print internal tree as XML to buffer
  * `clixon_json2file()` - Print internal tree as JSON to file
  * `clixon_json2cbuf()` - Print internal tree as JSON to buffer
  * `clixon_cli2file()` - Print internal tree as CLI format to file
  * `clixon_txt2file()` - Print internal tree as text format to file
2022-06-01 20:02:27 +02:00
Olof hagsand
43a57dad79 Changed C-API for xml translation/print to other formats.
* Added `skiptop` parameter, if set only apply to children of a node, skip top node
    * default is 0
* Functions are merged, ie removed and replaced with more generic functions
* `xml2json_cbuf()`: Added `skiptop` parameter: `xml2json_cbuf(..., int skiptop)`
* `xml2json()` and `xml2json_cb()` merged into `xml2json_file()` with `skiptop`
    * Replace `xml2json(...)` with `xml2json_file(..., stdout, 0)`
    * Replace `xml2json_cb(...)` with `xml2json_file(..., 0)`
* `clicon_xml2cbuf()`: Added `skiptop` parameter: `clicon_xml2cbuf(..., int skiptop)`
* `xml2cli()`: Added `skiptop` parameter: `xml2cli(..., int skiptop)`
2022-06-01 10:48:39 +02:00
Olof hagsand
dd2ac56af8 Module state upgrade: RFC7895 to RFC 8525
Changes to clixon-config:
  * Added option: 'CLICON_YANG_LIBRARY`
  * Changed default value: `CLICON_MODULE_LIBRARY_RFC7895` to false
Datastore modstate is backward compatible
Tests upgraded to RFC8525
2022-03-07 10:56:54 +01:00
Olof hagsand
77b4468eb3 Updated copyright statements to 2022 2022-01-18 16:36:00 +01:00
Olof hagsand
2bb5c23856 * [RPC get-conf method returned some content not specified by select filter](https://github.com/clicon/clixon/issues/281)
* Bug introduced when upgrading of list pagination
2021-11-13 22:38:23 +01:00
Olof hagsand
2dcc14a0db Added error handling in yang_path_arg triggered by no filter in get paginated
Fixed cornercase of restconf error return when no body
Fixed cornercase when exactly / given as xpath
Better error message when YANG not found: added which YANG file imports it
2021-11-10 18:35:24 +01:00
Olof hagsand
a4b4dc97ce Pagination updated
* Pagination is updated to new drafts:
  * [https://datatracker.ietf.org/doc/html/draft-wwlh-netconf-list-pagination-00>]
  * [https://datatracker.ietf.org/doc/html/draft-wwlh-netconf-list-pagination-nc-02]
  * [https://datatracker.ietf.org/doc/html/draft-wwlh-netconf-list-pagination-rc-02]
  * See also updated [https://clixon-docs.readthedocs.io/en/latest/pagination.html]
* Added IETF RFC:s (included by pagination):
  * ietf-netconf-nmda@2019-01-07.yang
  * ietf-origin@2018-02-14.yang
  * ietf-netconf-with-defaults@2011-06-01.yang
* Dropped pcvec parameter to many restconf api functions
2021-11-10 18:35:24 +01:00
Olof hagsand
52744c9301 Revert "List pagination locking for state-data changes"
This reverts commit eea6d549f6.
2021-10-30 15:49:23 +02:00
Olof hagsand
eea6d549f6 List pagination locking for state-data changes
Changed semantics of locking: instead of relying of locking running-db,
an automatic lock bound to a session is maintained. When the session closes
the lock is released.
2021-10-28 14:49:33 +02:00
Olof hagsand
a242cf47bd Pagination callback modifications: ensure xml is bound to yang, removed
code not used (eg remaining) and avoiding an extra xpath_vec call.
Moved debug prints from plugin-callback-one to plugin-callback-all
Fixed memory error in data-cvec access function
2021-10-14 14:06:01 +02:00
Olof hagsand
edbbb43e1f Removed remaining and replaced pagination-mode with locked parameter
Dispatcher: Added dispatcher_free(), fixed mem-leaks and malloc return
checks
2021-10-10 11:40:47 +02:00
Olof hagsand
ce06f25be7 Merge branch dispatcher and broke out pagination callbacks to use it
* Merge branch 'dcornejo-master'
* Broke out pagination callback API from state data callbacks
  * New pagination callback API uses new dispatcher from netgate, thanks @dcornejo
   * Register callback with: `clixon_pagination_cb_register()`
   * Use accessor functions `pagination_offset()`, `pagination_limit()`, etc
 * Reverted state data callback API to pre-5.3 (see C/CLI API changes below)
2021-10-08 15:19:37 +02:00
Olof hagsand
5a875e3152 Fix some LINKAGE=static compile issues:
- Makefile circularity by fixing .so suffix
- simplify example/main Makefile
2021-09-26 11:22:48 +02:00
Olof hagsand
c00162aec1 - Modified linkage constant in makefile to test for dynamic only
- CLIXON_STATIC_PLUGIN to support statically linked plugins
- Added -H option to clixon_netconf: Do not require hello before request
2021-09-25 16:36:37 +02:00
Olof hagsand
b70e22096e - Pagination: enabled LIST_PAGINATION and remobved constant
- Changed logic on how to find clixon_restconf in pseudo plugin
- Removed ==== in constants to avoid conflict with git merge
- Remove assert
- Added fuzzing for netconf
2021-09-23 13:33:26 +02:00
Olof hagsand
384ce70d7c memory leak and nacm recovery test fix 2021-09-21 13:24:34 +02:00
Olof hagsand
ff3f600920 Renamed paging to pagination 2021-09-21 11:28:29 +02:00
Olof hagsand
60193cca0d - Add remaining argument to state callback 2021-09-21 11:27:58 +02:00