Commit graph

569 commits

Author SHA1 Message Date
Olof Hagsand
fcf9a8b0b0 C-API: Exposed diff function
Test: double leaf validate test
2023-02-13 20:23:18 +01:00
Olof hagsand
d358387d39 * Fixed: [State XML validation error when CLICON_MODULE_LIBRARY_RFC7895=true and ietf-yang-libra$
* Removed obsolete option: `CLICON_MODULE_LIBRARY_RFC7895'
  * Obsolete config options given in the confi file are considered an error
* Added section in CONTRIBUTING relating to optimzation
* Changed reset merge to implicit default values.
  * This avoids a potential overwriting of explicitly set default values in the existing config
* Adapted some code to [Make cligen_* functions const ](https://github.com/clicon/cligen/pull/83)
* Test: fixed test for * Fixed: [datamodel tree generated from basemodel tree is not proper when a list has more than one key and key is of enum type](https://github.com/clicon/clixon/issues/417)
2023-02-12 16:19:27 +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
000cb866c2 RFC 8525:
- Change from RFC 7805: Remove revision if empty instead of sending empty revision
RFC 6022
  - Added cli identity to RFC6022 transport
  - Added source-host for natove restconf, bit no other sessions
2023-01-15 22:44:00 +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
Olof hagsand
e27336e054 C-API change yang_print: print top-level and add pretty-print parameter
Test: Fix valgrind dlclose suppresion
2022-11-24 17:42:48 +01:00
Olof hagsand
a3bb271432 cli show config json: add {} clause for empty 2022-11-19 11:13:27 +01:00
Olof hagsand
caef594dbe Error handling for CLI
Continue, do not exit on read/expand errors
Accept -1 error without clicon_err in callbacks / expand
C-API: Three-value return of clicon_cliread
2022-11-19 11:11:08 +01:00
Olof hagsand
4b21a05bcc Fixed IDENTITYREF_KLUDGE removal #2 2022-11-07 09:19:29 +01:00
Olof hagsand
b0f898cf66 Fixed: [Yang identityref XML encoding is not general](https://github.com/clicon/clixon/issues/90)
* Revisiting this issue now seems to work, there are no regressions that fail when disabling IDENTITYREF_KLUDGE.
2022-11-05 12:07:44 +01:00
Olof hagsand
56f4bb45cc * Added PRETTYPRINT_INDENT compile-time option controlling indentation level for XML,JSON and TEXT
* Default value is `3`
2022-10-31 14:20:14 +01:00
Olof hagsand
c93f264215 Added final \n to JSON pretty-print output
This was a correction of fix to: [CLI Show config JSON with multiple top-level elements is broken](https://github.com/clicon/clixon/issues/381)
2022-10-29 16:06:15 +02:00
Olof hagsand
83f71529d7 Fixed: [CLI Show config JSON with multiple top-level elements is broken](https://github.com/clicon/clixon/issues/381)
C API: Added skiptop parameter to xml2json_vec
2022-10-28 15:19:41 +02: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
Olof hagsand
575429caa1 * Fixed: [Non-obvious behavior of clixon_snmp after snmpset command when transaction validation returns an error](https://github.com/clicon/clixon/issues/375)
* Changed `clicon_rpc_commit()` and `clicon_rpc_validate`: Added three-value return.
2022-10-08 17:17:04 +02:00
Phil Heller
284316b646 Initial implementation of NETCONF confirmed-commit 2022-10-03 21:44:35 -06:00
Olof hagsand
bae92488e9 * Added defaults parameter to clicon_rpc_get_pageable_list()
* Test: Replaced bash coverage script with binary
2022-09-28 15:16:02 +02:00
Olof hagsand
a6f67755b3 Refactor of cli show commands:
- Changed `cli_show_config()`
- Removed `cli_show_config_state()`
- Replaced `cli_auto_show()` with `cli_show_auto_mode()`
2022-09-15 17:42:57 +02:00
Olof hagsand
9a224ea4a0 Fixed: [All values in list don't appear when writing "show <list>" in cli](https://github.com/clicon/clixon/issues/359)
CLISPEC change:
* Changed signature of `cli_show_auto()`,
* remove: `cli_show_auto_state()`
2022-09-15 09:48:08 +02:00
Olof hagsand
c1e4595949 Refactoring of RESTCONF/TLS close code
Single closing function: restconf_close_ssl_socket
Added constant HTTP_ON_HTTPS_REPLY for http request on https socket
2022-09-13 23:01:19 +02: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
14cc88ca39 Added parameter defaults to library function clicon_rpc_get 2022-08-29 18:27:07 +02:00
Kristofer Hallin
6a367fa97b
Two minor fixes for building on macOS, HOST_VENDOR should be defined before trying to check its value. 2022-08-17 09:39:16 +02:00
Kristofer Hallin
68b528ac0b Make Clixon build on MacOS. 2022-08-16 08:40:04 +02:00
Olof hagsand
b0d38a513c Memory leak in cli load_config_file 2022-07-27 17:40:49 +02:00
Olof hagsand
57bc36d5ed Fixed: [Clixon CLI issue: when I try to print the value of the leaf node nothing appeared](https://github.com/clicon/clixon/issues/345) 2022-07-26 13:32:57 +02:00
Olof hagsand
4514f2a538 Fixed: ["autocli:hide-show" extension cause bug in xmldb_put method #343](https://github.com/clicon/clixon/issues/343)
As a side-effect, added extra "autocliext" parameter to:
- clixon_xml2file()
- clixon_json2file()
- clixon_json2cbuf()
- clixon_txt2file()
2022-07-22 16:06:28 +02:00
Olof hagsand
a846989569 Fixed: [Schema Ambiguity Error with openconfig-system re: NTP](https://github.com/clicon/clixon/issues/334) 2022-07-16 18:11:54 +02:00
Olof hagsand
1d78241115 Merge branch 'snmp' 2022-07-15 15:54:44 +02:00
Olof hagsand
9537596a67 Fixed again: [Nested YANG choice does not work #342](https://github.com/clicon/clixon/issues/342)
Previous fix only for some sub-cases. New fix should work for all reecursive cases
2022-07-14 22:24:44 +02:00
Olof hagsand
df687f7180 Clixon SNMP frontend
Added two new config options to clixon-config.yang: `CLICON_HTTP_DATA_ROOT`
Added new files: apps/snmp/snmp_mib_yang.[ch] for generic MIB/YANG handling
Test: killall quiet
Test: added specific MIB for generic code: <CLICON_SNMP_MIB>NET-SNMP-EXAMPLES-MIB</CLICON_SNMP_MIB>
2022-06-26 11:28:42 +02:00
Olof hagsand
87c65c3541 Fixed: [RPC edit-config payloads are not fully validated](https://github.com/clicon/clixon/issues/337) 2022-06-20 15:08:50 +02:00
Olof hagsand
b1cb774c9d TEXT output/parser: fix space-separated leaf/leaf-lists 2022-06-07 13:23:05 +02:00
Olof hagsand
625a0ed19a Cleaned up prettyprint->pretty, use yang_cvec_set access function 2022-06-03 14:01:56 +02:00
Olof hagsand
b6bfcb69f7 Text syntax parser/loader
Added support for list x y;
Uses a mechanism to parse as unknown XML body and post-parsing replace with list keys
Fixed example and test to work with new TEXT syntax
2022-06-02 19:28:49 +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
2ece0b8f51 * Experimental text syntax parser/loader
* Added new text syntax parsing and loading from CLI
  * Unified text output functions to `xml2txt` and moved to clixon_text_syntax.[ch]
    * The following are removed: `cli_xml2txt` and `xml2txt_cb`
  * Text output format changed:
    * Namespace/modulename added to top-level
  * See [Support performant load_config_file(...) for TEXT format](https://github.com/clicon/clixon/issues/324)
2022-06-01 11:07:15 +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
8e6ba7fa53 test of cligen expand bug #332 2022-05-30 15:27:19 +02:00
Olof hagsand
d153bfcd0c Test: restconf notification parallel disabled. start script -l removed 2022-05-12 16:17:26 +02:00
Olof hagsand
9cbe313712 * Fixed: [Keywords containing '-' hyphen are missing from the auto-completion list](https://github.com/clicon/clixon/issues/330)
* Fixed by disabling `cligen_preference_mode`. This may have other side effects.
2022-05-12 14:54:53 +02:00
Olof hagsand
a49cf41d1e * CLI expansion of leafrefs default behavior changed
* In the autocli and handcrafted CLI:s using `expand_dbvar()` the CLI expansion followed the leafrefs to the sources, ie the origin of the leafrefs
    * Instead leafref expansion now only looks at the leafrefs
2022-05-10 10:06:43 +02:00
Olof hagsand
5551d753ef Logging fixes
* Fixed: [Error message seen twice in some cases](https://github.com/clicon/clixon/issues/325)
* Extended `-l` command-line option to all clixon commands with a `none` option, eg `-l n` directs logging to `dev/null`
2022-04-30 11:31:51 +02:00
Olof hagsand
fa077839f0 Misc sanity checks and documentation 2022-04-19 14:19:29 +02:00
Olof hagsand
8c60d81ed2 - Disabled xpath optimization for hierarchical list
- Made cli show xpath command more capable
2022-04-14 15:21:25 +02:00
Olof hagsand
ecac027d18 CLI argument to shell example callback
Save state of netconf chunked framing between inputs
Treat EBADF in internal protocol (triggered by freebsd+notifications)
Test: chunked encoding: use printf instead of echo
2022-04-11 19:09:26 +02:00
Olof hagsand
1a9def2f6e [provide support for load config of cli format along with json and xml format as save config is supported for all 3 formats](https://github.com/clicon/clixon/issues/320) 2022-04-01 18:05:19 +02:00
Olof hagsand
dfeb7cef75 * CLI reconnects to backend if backend restarts with a warning
* Note that edits to the candidate database or locks will be lost
  * To force the CLI to exit if backend restarts, undef `PROTO_RESTART_RECONNECT`
  * This is an effect of the fix of [Broken pipe error seen in client (cli) when backend restarts and CLICON_SOCK is recreated](https://github.com/clicon/clixon/issues/312), the CLI behavior on backend restart is changed.
* Added `eof` parameter to `clicon_rpc()` and `clicon_rpc1()` and error handling modified
2022-03-16 18:30:21 +01:00