* New "general-purpose" datastore upgrade callback added which i called once on startup, intended for lo

w-level general upgrades and as a complement to module-specific upgrade.
  * Called on startup after initial XML parsing, but before module-specific upgrades
  * Enabled by definign the `.ca_datastore_upgrade`
  * [General-purpose upgrade documentation](https://clixon-docs.readthedocs.io/en/latest/backend.html#ge
neral-purpose)
* JSON parse error messages change from ` on line x: syntax error,..` to `json_parse: line x: syntax err
or`
* Unknown-element error message is more descriptive, eg from `namespace is: urn:example:clixon` to: `Fai
led to find YANG spec of XML node: x with parent: xp in namespace urn:example:clixon`.
* C-API parse and validation API more capable
  * `xml_spec_populate` family of functions extended with three-value return values
    * -1: error, 0: parse OK, 1: parse and YANG binding OK.
  * `xml_parse` and `json_parse` API changes
    * Three value returns: -1: error, 0: parse OK, 1: parse and YANG binding OK.
    * Extended `xml_parse_file2` and `xml_parse_string2` extended API functions with all options available.
      * New concept called `yang_bind` that defines how XML symbols are bound to YANG after parsing
    * Existing API same except `xml_parse_file` `endtag` argument moved to `xml_parse_file2`
* C-API: Added instrumentation: `xml_size` and `xml_stats_get`.
* Fixed: Enabling modstate (CLICON_XMLDB_MODSTATE), changing a revision on a yang, and restarting made the backend daemon exit at start (thanks Matt)
  * Also: ensure to load `ietf-yang-library.yang ` if CLICON_XMLDB_MODSTATE is set
This commit is contained in:
Olof hagsand 2020-02-20 14:00:01 +01:00
parent d665992f7c
commit 9fa5e216c4
80 changed files with 2204 additions and 755 deletions

View file

@ -1,7 +1,8 @@
/*
***** BEGIN LICENSE BLOCK *****
Copyright (C) 2009-2020 Olof Hagsand
Copyright (C) 2009-2019 Olof Hagsand
Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC
This file is part of CLIXON.
@ -31,6 +32,7 @@
***** END LICENSE BLOCK *****
Custom file as boilerplate appended by clixon_config.h
Note that clixon_config.h is only included by clixon system files, not automatically by examples or apps
*/
#ifndef HAVE_STRNDUP
@ -72,11 +74,20 @@
#undef XML_EXPLICIT_INDEX
/*! Validate user state callback content
* User register state callbacks using the ca_statedata callback
* When this option is set, the XML returned from the callback is validated after merging with the
* running db. If it fails, an internal error is returned to the originating user.
* If the option is not set, the XML returned by the user is not validated. This could be useful if
* there is some error in the validation, as a safety catch.
* (Eventually this option will be permanently enabled)
* Users may register state callbacks using ca_statedata callback
* When this option is set, the XML returned from the callback is validated after merging with the running
* db. If it fails, an internal error is returned to the originating user.
* If the option is not set, the XML returned by the user is not validated.
* Note that enabling this option causes a large performance overhead for large lists, therefore it
* is recommended to enable it during development and debugging but disable it in production, until
* this has been resolved.
*/
#define VALIDATE_STATE_XML
/*! Treat <config> specially in a xmldb datastore.
* config is treated as a "neutral" tag that does not have a yang spec.
* In particulat when binding xml to yang, if <config> is encountered as top-of-tree, do not
* try to bind a yang-spec to this symbol.
*/
#define XMLDB_CONFIG_HACK