Commit graph

61 commits

Author SHA1 Message Date
Olof hagsand
f112580546 SNMP MIB->YANG translation file handling.
Added configure option  --with-mib-generated-yang-dir=DIR with
default value /usr/share/mibyang where generated YANGs from MIBs
should be placed so that SNMP tests know where to find the YANGs.
2022-06-26 11:28:42 +02:00
Olof hagsand
a00e36caa2 * Full RFC 7950 if-feature-expr support (Section 7.20.2)
* Previous implementation did not handle nested if-feature expressions
  * As part of fixing: [YANG if-feature does not support nested boolean expression](https://github.com/clicon/clixon/issues/341)
  * Added new yacc/lex parser for if-feature-expr string
2022-06-26 10:58:43 +02:00
Olof hagsand
bdb516fec9 YANG Action (RFC 7950 Section 7.15)
See [Support for "action" statement](https://github.com/clicon/clixon/issues/101)
2022-06-21 15:44:02 +02:00
Olof hagsand
fa077839f0 Misc sanity checks and documentation 2022-04-19 14:19:29 +02:00
Olof hagsand
f1300d7a12 * [Adding feature to top level container doesn't work](https://github.com/clicon/clixon/issues/322)
* Instead of removing YANG which is disabled by `if-feature`, replace it with an yang `anydata` node.
  * This means XML specified by such YANG is ignored, and it is not an error to access it
  * Note the similarity with `CLICON_YANG_UNKNOWN_ANYDATA`
2022-04-06 14:04:11 +02:00
Olof hagsand
77b4468eb3 Updated copyright statements to 2022 2022-01-18 16:36:00 +01:00
Olof hagsand
3117332ddd Changes in clixon-config.yang:
* Removed obsolete options:
    * `CLICON_YANG_LIST_CHECK`
    * `CLICON_RESTCONF_PATH` (moved to restconf/fcgi-path)
  * Fixed: Configure option `CLICON_RESTCONF_PRETTY` was marked as obsolete but was still used.
    * `CLICON_RESTCONF_PRETTY` is now obsolete for sure
    * Instead restconf/pretty is used with API function restconf_pretty_get()
2021-12-28 11:44:19 +01:00
Olof hagsand
339b744835 * Optional yangs for testing have been removed from the Clixon repo
* These were included for testing
  * If you want to run the Clixon test suite you need to point `YANGMODELS`, see test/README.md
  * The following configure options have been removed:
    * `configure --with-opt-yang-installdir=DIR`
    * `configure   --enable-optyangs`
  * You may need to specify standard YANGs using configure option `--with-yang-standard-dir=DIR`
* Updated yang ietf models with fetures for tet
* Added option `CLICON_YANG_AUGMENT_ACCEPT_BROKEN` to accept broken yangmodels.
  * This is a debug option for CI testcases where standard YANG models are broken
2021-11-29 10:28:34 +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
baa6e821a8 Fixed [yang in CLICON_YANG_MAIN_DIR can't import module's in CLICON_YANG_DIR recursively](https://github.com/clicon/clixon/issues/286)
Which was a PR for [Recursive search CLIXON_YANG_DIR](https://github.com/clicon/clixon/issues/284)
2021-11-10 18:32:17 +01:00
Kristofer Hallin
057abe56e0
Fix for issue #284, do recursive lookup when reading YANG files from directory. 2021-11-08 20:09:19 +01: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
77bacc93bb - Updated code to clixon 5.2 status
- Added LIST_PAGINATION clixon_custom constant
- Fix: leafs added as augments on rpc input/output lacked cv:s
2021-09-21 11:22:40 +02:00
Olof hagsand
9aad253f1e Move Yang patterns: \n match from yang parse to regex compile stage 2021-08-05 12:53:26 +02:00
Olof hagsand
dcaeb581a1 * Fixed: Yang patterns: \n and other non-printable characters were broken
* Example: Clixon interpereted them two characters: `\\ n` instead of ascii 10
2021-08-05 09:59:20 +02:00
Olof hagsand
00645ee52b * Added linenumbers to all YANG symbols for better debug and errors
* Improved error messages for YANG identityref:s and leafref:s by adding original line numbers
2021-08-03 12:53:37 +02:00
Olof hagsand
e0ee365958 * Fixed: RFC 8040 yang-data extension allows non-key lists
* Added YANG_FLAG_NOKEY as exception to mandatory key lists
2021-07-19 11:15:49 +02:00
Olof hagsand
6bb6faadc9 * Fixed: mandatory leaf in a uses statement caused abort
* Occurence was in ietf-yang-patch.yang
2021-07-19 08:14:10 +02:00
Olof hagsand
ed1d5698e8 fix the belongs-to test 2021-07-08 16:53:45 +02:00
Olof hagsand
1925ac68cd * Fixed: [RESTConf GET for a specific list instance retrieves data from other submodules that have same list name and key value #244](https://github.com/clicon/clixon/issues/244)
* Fixed: Double clixon error messages in yang2cli code
* Sanity checks for submodule belongs-to
2021-07-08 16:26:39 +02:00
Olof hagsand
783b0a4857 * YANG when statement in conjunction with grouping/uses/augment
* Several cases were not implemented fully according to RFC 7950
    * Do not extend default values if when statements evaluate to false
    * Do not allow edit-config of nodes if when statements evaluate to false (Sec 8.3.2)
    * If a key leaf is defined in a grouping that is used in a list, the "uses" statement MUST NOT have a "when" statement. (See 7.21.5)
  * See [yang uses's substatement when has no effect #218](https://github.com/clicon/clixon/issues/2$
2021-05-13 14:26:02 +02:00
Olof hagsand
0225488c39 - Moved deviation actions to include grouped/uses statements. See https://github.com/clicon/clixon/issues/211 2021-05-06 16:23:50 +02:00
Olof hagsand
5a72626aa4 - Yang deviation [deviation statement not yet support #211](https://github.com/clicon/clixon/issues/211)
- Added "depth" parameter to yang_apply
- Added extra API function to yang_cardinality to check individual relation
2021-05-03 14:34:35 +02:00
Olof hagsand
c43e216d67 - Restconf bind: continue with other sockets if bind fails, print address on log
- Multi-yang: Look in CLICON_YANG_MAIN_DIR, not only CLICON_MAIN_DIRs for old yangs
  - Backend -q quit option enhanced for multi-yang case
2021-04-13 18:00:27 +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
9840e248c6 * Augment target node check strict, instead of printing a warning, it will terminate with error.
* Fixed: [Augment that reference a submodule as target node fails #178](https://github.com/clicon/clixon/issues/178)
* Fixed a memory error that was reported in slack by Pawel Maslanka
  * The crash printout was: `realloc(): invalid next size Aborted`
2021-02-19 15:46:55 +01:00
Olof hagsand
0b1e4ab0e9 Fixed: unknown nodes (for extenstions) did not work when placed directly under a grouping clause 2021-01-28 09:02:29 +01:00
Olof hagsand
96b50b88e8 Copyright 2021 2021-01-13 14:40:34 +01:00
Olof hagsand
b8641f30bd * More YANG extension functionality,
* See [Augment auto-cli for hiding/modifying cli syntax #156](https://github.com/clicon/clixon/issues/156) and [hiding auto-generated CLI entries #153](https://github.com/clicon/clixon/issues/153)
  * Extensions can be used in augmentations
  * Extension `autocli-op` has been added to add "hidden" commands in the autocli
  * Documentation: https://clixon-docs.readthedocs.io/en/latest/misc.html#extensions
2020-12-08 17:21:37 +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
daaf3f17df revert clixon-err on XML
restconf backend config
2020-11-18 13:57:25 +01:00
Olof hagsand
4eee00101c Disabling IPv6 per default due to failing docker tests 2020-11-15 18:16:06 +01: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
1db43ca45b yang augment sanity checks 2020-10-05 15:49:22 +02:00
Olof hagsand
b3545871c0 * Added stricter check on schema-node identifier checking, such as for augments.
* These checks are now made at YANG loading time
2020-09-29 20:53:24 +02:00
Olof hagsand
101a8cb6e0 minor fixes 2020-09-27 17:15:36 +02:00
Olof hagsand
da54dae396 Added sanity check that a yang module name matches the filename 2020-09-25 13:39:13 +02:00
Olof hagsand
21ac47915b More XPath function support
* `count`, `name`, `contains`, `not`, as defined in [xpath 1.0](https://www.w3.org/TR/xpath-10)
  * `deref`, `derived-from` and `derived-from-or-self` from RFC7950 Section 10.
    * in particular in augment/when statements
  * Improved error handling
    * Verification of XPath functions is done at startup when yang modules are loaded, not when XPaths are evaluated.
    * Separation of "not found" and "not implemented" XPath functions
    * Both give a fatal error (backend does not start).
2020-09-25 11:52:06 +02:00
Olof hagsand
c616aa1569 Added support for XPATH functions:
* `contains`,
  * `derived-from` and `derived-from-or-self`
    * in particular in augment/when statements as shown in eg RFC 7950.
2020-09-22 22:40:42 +02:00
Olof hagsand
6c22935463 code comments 2020-09-12 13:04:59 +02:00
Olof hagsand
658fffb931 mem leak in yang filename function 2020-09-07 10:19:38 +02:00
Olof hagsand
f524a89b2d * Fixed: YANG uses statements in sub-modules did not search for grouping statements in other submodules of the module it belongs to. 2020-09-04 16:23:18 +02:00
Olof hagsand
96a8192cd2 Fixed: [Yang modules skipped if the name is a proper prefix of other module name](https://github.com/clicon/clixon/issues/130) 2020-08-27 11:55:42 +02:00
Olof hagsand
576533ed82 Changed singnature of ys_real_module and improved error handling 2020-08-27 11:01:09 +02:00
Olof hagsand
2e23856676 fixed memory leaks in restconf evhtp module 2020-08-22 18:02:08 +02:00
Olof hagsand
6be4b18391 Fixed: [Type / Endianism problem in yang_parse_file #128](https://github.com/clicon/clixon/issues/128) 2020-08-21 13:33:38 +02:00
Olof hagsand
25f67d1eb9 Fixed: [(CLI) the description of a used grouping is shown instead of the encapsulating container #124](https://github.com/clicon/clixon/issues/124) 2020-08-19 15:55:55 +02:00
Olof hagsand
3ecc259ec7 misc documentation 2020-07-28 16:15:02 +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
Olof hagsand
fade9dcfd5 Fixed: Reading in a yang-spec file exactly the same size as the buffer (1024/2048/4096/...) could leave the buffer not terminated with a 0 byte 2020-06-18 09:54:51 +02:00