1# Clixon Changelog
2
3* [4.8.0](#480) 18 October 2020
4* [4.7.0](#470) 14 September 2020
5* [4.6.0](#460) 14 August 2020
6* [4.5.0](#450) 12 May 2020
7* [4.4.0](#440) 5 April 2020
8* [4.3.0](#430) 1 January 2020
9  * [4.3.3](#433)
10  * [4.3.2](#432)
11  * [4.3.1](#431)
12* [4.2.0](#420) 27 October 2019
13* [4.1.0](#410) 18 August 2019
14* [4.0.0](#400) 13 July 2019
15  * [4.0.1](#401)
16* [3.9.0](#390) 21 Feb 2019
17* [3.8.0](#380) 6 Nov 2018
18* [3.7.0](#370) 22 July 2018
19* [3.6.0](#360) 30 April 2018
20  * [3.6.1](#361)
21* [3.5.0](#350) 12 February 2018
22* [3.4.0](#340) 1 January 2018
23* [3.3.3](#333) 25 November 2017
24* [3.3.2](#332) Aug 27 2017
25* [3.3.1](#331) June 7 2017
26
27## 4.8.0
2818 October 2020
29
30The Clixon 4.8 release features a new auto-cli implementation, a new "conf.d"-style configuration directory and more XPATH functionality.
31
32### New features
33
34* New YANG generated auto-cli feature with syntax modes
35  * The existing autocli does not support modes, complete paths must be given, eg: `set a b c d 42`.
36  * 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`
37  * 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()`.
38  * 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.
39  * See the [auto-cli documentation](https://clixon-docs.readthedocs.io/en/latest/cli.html#the-auto-cli) and main example.
40* Added support for the following XPATH functions:
41  * `count`, `name`, `contains`, `not`, as defined in [xpath 1.0](https://www.w3.org/TR/xpath-10)
42  * `deref`, `derived-from` and `derived-from-or-self` from RFC7950 Section 10.
43    * these are in particular used in YANG augment/when statements
44  * Improved error handling
45    * Verification of XPath functions is done at startup when yang modules are loaded, not when XPaths are evaluated.
46    * Separation of "not found" and "not implemented" XPath functions
47    * Both give a fatal error (backend does not start).
48* Configuration directory
49  * A new configuration option `CLICON_CONFIGDIR` has been added for loading of extra config files
50  * If not given, only the main configfile is loaded.
51  * If given, and if the directory exists, the files in this directory will be loaded alphabetically AFTER the main config file in the following way:
52    * leaf values are overwritten
53    * leaf-list values are appended
54  * You can override file setting with `-E <dir>` command-line option.
55
56### API changes on existing protocol/config features
57
58Users may have to change how they access the system
59
60* New clixon-config@2020-10-01.yang revision
61  * Added option for configuration directory: `CLICON_CONFIGDIR`
62* Not implemented XPath functions will cause a backend exit on startup, instead of being ignored.
63* More explanatory validation error messages for when and augments error messages.
64  * Example: error-message: `Mandatory variable` -> `Mandatory variable of edit-config in module ietf-netconf`.
65
66### Minor changes
67
68* Removed string limit on cli prompt and cli mode name
69* Added more sanity checks on incoming top-level rpc and hello messages, including verifying top-level namespace
70* Added inline state field to clixon-example.yang
71* Added stricter check on schema-node identifier checking, such as for augments.
72  * These checks are now made at YANG loading time
73* Added sanity check that a yang module name matches the filename
74
75### Corrected Bugs
76
77* Fixed: [namespace prefix nc is not supported](https://github.com/clicon/clixon/issues/143)
78* Fixed: [Crash seen with startup mode as running with the XML_DB format being set to JSON. [clixon : 4.7.0] #138](https://github.com/clicon/clixon/issues/138)
79* Fixed: Performance enhancement of unique list check (of duplicate keys)
80* Fixed: Validate/commit error with false positive yang choice changes detected in validation found in ietf-ipfix-psamp.yang.
81* Fixed: Accepted added subtrees containing lists with duplicate keys.
82* Fixed: [default state data returned with get-config](https://github.com/clicon/clixon/issues/140)
83  * Generalized default code for both config and state
84
85## 4.7.0
8614 September 2020
87
88This release is primarily a bugfix and usability improvement release, no major new features.
89
90### API changes on existing protocol/config features
91
92Users may have to change how they access the system
93
94* Netconf as default namespace has been disabled by default.
95  * Only requests on the form: `<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config>...` are accepted
96  * All replies are on the form: `<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">...`
97  * Requests such as: `<rpc><edit-config>...` are not accepted.
98  * You can revert this behaviour (to clixon pre-4.6 behaviour) by enabling `CLICON_NAMESPACE_NETCONF_DEFAULT`
99  * 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)
100* NACM datanode paths fixed to canonical namespace
101  * The fix of [Cannot create or modify NACM data node access rule with path using JSON encoding #129](https://github.com/clicon/clixon/issues/129) leads to that data-node paths, eg `<rule>...<path>ex:table/ex:parameter</path></rule>` instance-identifiers are restricted to canonical namespace identifiers for both XML and JSON encoding. That is, if a symbol (such as `table` above) is a symbol in a module with prefix `ex`, another prefix cannot be used, even though defined with a `xmlns:` rule.
102
103* New clixon-config@2020-08-17.yang revision
104  * Added options for Restconf evhtp setting default bind socket address and ports:
105    * `CLICON_RESTCONF_IPV4_ADDR`, `CLICON_RESTCONF_IPV6_ADDR`, `CLICON_RESTCONF_HTTP_PORT`, `CLICON_RESTCONF_HTTPS_PORT`
106  * Added option for using NETCONF default namespace: `CLICON_NAMESPACE_NETCONF_DEFAULT`
107  * Added options for better handling of long and multi-line CLI help strings:
108    * `CLICON_CLI_HELPSTRING_TRUNCATE`, `CLICON_CLI_HELPSTRING_LINES`
109  * Changed semantics of `CLICON_NACM_DISABLED_ON_EMPTY` to "disable NACM if there is no _NACM_ configuration", instead of "disable NACM if there is no _configuration_".
110
111### Minor changes
112
113* Debug messages
114  * Added cli command debug printf on debug level 1
115  * Moved all parse debug printfs to level 3
116* Added `-r` command-line option to restconf daemon to NOT lower privileges to wwwuser if started from root.
117* Changed CLI help strings behaviour on query (?) for long and multi-line help strings.
118  * If multiple strings (eg "\n" in text), indent before each new line
119  * Primarily for auto-cli where long help strings are generated from YANG descriptions, but applies as well for manual long/multi-line help strings
120  * New config option: `CLICON_CLI_HELPSTRING_TRUNCATE`: Truncate help string on right margin mode
121  * New config option: `CLICON_CLI_HELPSTRING_LINES`: Limit of number of help strings to show
122
123### Corrected Bugs
124
125* Fixed: Restconf failed put/post could leave residue in candidate causing errors in next put/post
126* Fixed: [clixon_netconf does not respond to hello #136](https://github.com/clicon/clixon/issues/136)
127  * The error showed only when CLICON_MODULE_LIBRARY_RFC7895 was disabled.
128* Fixed: Do not check min/max constraints on state data in config validate code
129* Fixed: [min-elements attribute prevents from deleting list entries #133](https://github.com/clicon/clixon/issues/133)
130* Fixed: [xmldb_get0 returns invalid candidate on startup transaction callbacks #126](https://github.com/clicon/clixon/issues/126). Always clear candidate-db before db initialization.
131* Fixed: YANG `uses` statements in sub-modules did not search for `grouping` statements in other submodules of the module it belongs to.
132* Fixed: [CLI crash if error-info is empty #134](https://github.com/clicon/clixon/issues/134)
133* Fixed: [copy-config's RPC cxobj parameter does not contain namespace #131](https://github.com/clicon/clixon/issues/131)
134  * See also "Netconf as default namespace has been disabled by default" above
135* Fixed: [Cannot create or modify NACM data node access rule with path using JSON encoding #129](https://github.com/clicon/clixon/issues/129). The evaluation of NACM datanode rule path is assumed to be canonical namespace and cannot be overruled with `xmlns` rules.
136* Corrected error message for list min/max-value to comply to RFC 7950: a proper path is now returned, previously only the final list symbol was returned. This error-path is also now exposed in the CLI error message correctly.
137  * Example: `<error-path>/c/a1</error-path>`
138* Fixed: [Yang modules skipped if the name is a proper prefix of other module name](https://github.com/clicon/clixon/issues/130)
139* Fixed an error in global default values. Global default values were not written to datastore after startup, but AFTER an edit/commit.
140* Fixed: [Type / Endianism problem in yang_parse_file #128](https://github.com/clicon/clixon/issues/128)
141* Fixed: [(CLI) the description of a used grouping is shown instead of the encapsulating container #124](https://github.com/clicon/clixon/issues/124)
142  * Uses/group and augments only copies *schemanodes*. This means reference/description/.. etc are not copied, the original is kept. Also, as a side-effect of the bugfix, a final cardinality sanity check is now made after all yang modifications, not only at the time the file is loaded.
143
144## 4.6.0
14514 August 2020
146
147The 4.6.0 release introduces a new RESTCONF solution using "native" http. An important API change is top-level default value assignment that may cause a NACM read-only dead-lock. The NACM recovery user handling has been improved for this case. Numerous bugfixes and improvements. Vagrant tests have been added.
148
149Thanks Netgate for making this possible.
150
151### Major New features
152
153* A new restconf configuration where Clixon restconf daemon is integrated with the [libevhtp](https://github.com/criticalstack/libevhtp) embedded web server.
154  * The existing FCGI restconf solution will continue to be supported for NGINX and other reverse proxies with a FCGI API and is still the default.
155  * The restconf code has been refactored to support both modes. Hopefully, it should be straightforward to add another embedded server, such as GNU microhttpd.
156  * The new restconf module is selected using a compile-time autotools configure as follows:
157    * `--with-restconf=fcgi    FCGI interface for stand-alone web rev-proxy eg nginx (default)`
158    * `--with-restconf=evhtp   Integrate restconf with libevhtp server`
159    * `--without-restconf      Disable restconf altogether`
160  * SSL server and client certificates are supported.
161  * SSE Stream notification is not yet supported.
162
163### API changes on existing protocol/config features
164
165Users may have to change how they access the system
166
167* New clixon-config@2020-06-17.yang revision
168  * Added `CLICON_CLI_LINES_DEFAULT` for setting window row size of raw terminals
169  * Added  enum HIDE to `CLICON_CLI_GENMODEL` for auto-cli
170  * Added SSL cert info for evhtp restconf https:
171    * `CLICON_SSL_SERVER_CERT`
172    * `CLICON_SSL_SERVER_KEY`
173    * `CLICON_SSL_CA_CERT`
174  * Added `CLICON_NACM_DISABLED_ON_EMPTY` to mitigate read-only "dead-lock" of empty startup configs.
175  * Removed default valude of `CLICON_NACM_RECOVERY_USER`
176* Top-level default leafs assigned.
177  * Enforcing RFC 7950 Sec 7.6.1 means unassigned top-level leafs (or leafs under non-presence containers) are assigned default values.
178  * In this process non-presence containers may be created.
179  * See also [default values don't show up in datastores #111](https://github.com/clicon/clixon/issues/111).
180  * If a default value is replaced by an actual value, RESTCONF return values have changed from `204 No Content` to `201 Created`
181* NACM default behaviour is read-only (empty configs are dead-locked)
182  * This applies if NACM is loaded and `CLICON_NACM_MODE` is `internal`
183  * Due to the previous bult (top-level default leafs)
184  * This means that empty configs or empty NACM configs are not writable (deadlocked).
185  * Workarounds:
186    1. Access the system with the recovery user, see clixon option `CLICON_NACM_RECOVERY_USER`
187    2. Edit the startup-db with a valid NACM config and restart the system
188    3. Enable clixon option `CLICON_NACM_DISABLED_ON_EMPTY`: if the config is empty, you can add a NACM config in a first edit.
189* NACM recovery user session is improved.
190  * If `CLICON_NACM_CREDENTIALS` is `except`, a specific `CLICON_NACM_RECOVERY_USER` can make any edits and bypass NACM rules.
191  * Either the recovery user exists as UNIX user and is logged in by the client (eg CLI/NETCONF), or
192  * The client is "trusted" (root/wwwuser) and the recovery user is used as a pseudo-user when accessing the backend.
193  * One can make the recovery user a proper authenticated (eg SSL client certs) user, or one may define root to be that user using local access.
194
195* Netconf lock/unlock behaviour changed to adhere to RFC 6241
196  * Changed commit lock error tag from "lock denied" to "in-use".
197  * Changed unlock error message from "lock is already held" to "lock not active" or "lock held by other session".
198  * See also related bugfix [lock candidate succeeded even though it is modified #110](https://github.com/clicon/clixon/issues/110)
199* Restconf FCGI (eg via nginx) have changed reply message syntax slightly as follows (due to refactoring and common code with evhtp):
200  * Bodies in error retuns including html code have been removed
201  * Some (extra) CRLF:s have been removed
202* Restconf and Netconf error handling
203  * Changed and enhanced several `bad-element` error replies to `unknown-element` with more detailed error-message.
204
205### C/CLI-API changes on existing features
206
207Developers may need to change their code
208
209* Added yang-binding `yb` parameter to `xmldb_get0()` and all xmldb get functions.
210* Simplified the _module-specific upgrade API.
211  * The new API is documented here: [Module-specific upgrade](https://clixon-docs.readthedocs.io/en/latest/upgrade.html#module-specific-upgrade)
212  * The change is not backward compatible. The API has been simplified which means more has to be done by the programmer.
213  * In summary, a user registers an upgrade callback per module. The callback is called at startup if the module is added, has been removed or if the revision on file is different from the one in the system.
214  * The register function has removed `from` and `rev` parameters: `upgrade_callback_register(h, cb, namespace, arg)`
215  * The callback function has a new `op` parameter with possible values: `XML_FLAG_ADD`, `XML_FLAG_CHANGE` or `XML_FLAG_CHANGE`: `clicon_upgrade_cb(h, xn, ns, op, from, to, arg, cbret)`
216
217* Added new cli show functions to work with cligen_output for cligen pageing to work. To achieve this, replace function calls as follows:
218  * `xml2txt(...)` --> `xml2txt_cb(..., cligen_output)`
219  * `xml2cli(...)` --> `xml2cli_cb(..., cligen_output)`
220  * `clicon_xml2file(...)` --> `clicon_xml2file_cb(..., cligen_output)`
221  * `xml2json(...)` --> `xml2json_cb(..., cligen_output)`
222  * `yang_print(...)` --> `yang_print_cb(..., cligen_output)`
223
224* Added prefix for `cli_show_config`/`cli_show_auto' so that it can produce parseable output
225* Replaced the global variable `debug` with access function: `clicon_debug_get()`.
226* Due to name collision with libevent, all clixon event functions prepended with `clixon_`. You need to rename your event functions as follows:
227  * `event_reg_fd()` -> `clixon_event_reg_fd()`
228  * `event_unreg_fd()` -> `clixon_event_unreg_fd()`
229  * `event_reg_timeout()` -> `clixon_event_reg_timeout()`
230  * `event_unreg_timeout()` -> `clixon_event_unreg_timeout()`
231  * `event_poll()` -> `clixon_event_poll()`
232  * `event_loop()` -> `clixon_event_loop()`
233  * `event_exit()` -> `clixon_event_exit()`
234
235### Minor changes
236
237These are new features that did not quite make it to the "Major features" list
238
239* Auto-CLI enhancements
240  * Traditionally the autocli has only been configuration-based. The autocli has now been extended with state, where a new syntax tree (`@datanodestate`) is also generated along with the config clispec tree.
241  * New mode `GT_HIDE` set by option `CLICON_CLI_GENMODEL_TYPE` to collapse non-presence containers that only contain a single list
242  * Added a prefix for cli_show_config/cli_show_auto so that it can produce parseable output
243  * Thanks dcornejo@netgate.com for trying it out and for suggestions
244
245* Bundle internal NETCONF messages
246  * A RESTCONF operation could produce several (up to four) internal NETCONF messages between RESTCONF server and backend. These have now been bundled into one.
247  * This improves performance for RESTCONF, especially latency.
248  * Added several extensions to clixon NETCONF to carry information between RESTCONF client and backend. The extensions are documented [here](https://clixon-docs.readthedocs.io/en/latest/misc.html#internal-netconf)This includes several attributes:
249* New backend switch: `-q` : Quit startup directly after upgrading and print result on stdout.
250  * This is useful when testing the upgrade functionality
251* Enhanced Clixon if-feature handling:
252  * If-feature now supports and/or lists, such as: `if-feature "a and b"` and `if-feature "a or b or c"`. However, full if-feature-expr including `not` and nested boolean experessions is still not supported.
253  * Sanity check: if an `if-feature` statement exists, a corresponding `feature` statement must exists that declares that feature.
254* Optimized get config xpath of large lists, such as `a[x=1000]` in a list of 100000s `a:s`.
255* Added docker support for three restconf modes: nginx/fcgi(default); evhtp ; and none.
256* Added [Vagrant tests](test/vagrant/README.md)
257* Added new function `clicon_xml2str()` to complement xml_print and others that returns a malloced string.
258* Added new function `xml_child_index_each()` to iterate over the children of an XML node according to the order defined by an explicit index variable. This is a complement to `xml_child_each()` which iterates using the default order.
259
260### Corrected Bugs
261
262* Fixed: [default values don't show up in datastores #111](https://github.com/clicon/clixon/issues/111).
263  * See also API changes since this changes NACM behavior for example.
264* Fixed: Don't call upgrade callbacks if no revision defined so there's no way to determine right way 'from' and 'to'
265* Fixed: [lock candidate succeeded even though it is modified #110](https://github.com/clicon/clixon/issues/110)
266* Fixed: [Need to add the possibility to use anchors around patterns #51](https://github.com/clicon/cligen/issues/51):
267  * Dont escape `$` if it is last in a regexp in translation from XML to POSIX.
268* Fixed `CLICON_YANG_UNKNOWN_ANYDATA` option for config and state data.
269  * Set this option of you want to treat unknwon XML as *anydata_.
270* Fixed: [Double free when using libxml2 as regex engine #117](https://github.com/clicon/clixon/issues/117)
271* 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
272* Fixed: The module `clixon-rfc5277` was always enabled, but should only be enabled when `CLICON_STREAM_DISCOVERY_RFC5277` is enabled.
273
274## 4.5.0
27512 May 2020
276
277The 4.5.0 release introduces XPaths in the NACM implementation thus
278completing the RPC and Data node access. There has also been several
279optimizations. Note that this version must be run with CLIgen 4.5, it
280cannot run with CLIgen 4.4 or earlier.
281
282Thanks to everyone at Netgate for making this possible
283
284### Major New features
285
286* NACM RFC8341 datanode read and write paths
287  * This completes the NACM RPC and Data node access checks (only remaining NACM access point is notification)
288* Added functionality to restart an individual plugin.
289  * New clixon-lib:restart-plugin RPC
290* Two new plugin callbacks added
291  * ca_daemon: Called just after a server has "daemonized", ie put in background.
292  * ca_trans_commit_done: Called when all plugin commits have been done.
293    * Note: If you have used "end" callback and using transaction data, you should probably use this instead.
294
295### API changes on existing protocol/config features (For users)
296
297* Stricter validation detecting duplicate container or leaf in XML.
298  * Eg `<x><a/><a/></x>` is invalid if `a` is a leaf or container.
299* New clixon-lib@2020-04-23.yang revision
300  * New RPC: `stats` for clixon XML and memory statistics.
301  * New RPC: `restart-plugin` for restarting individual plugins without restarting backend.
302* New clixon-config@2020-04-23.yang revision
303  * Removed xml-stats non-config data (replaced by rpc `stats` in clixon-lib.yang)
304  * Added option `CLICON_YANG_UNKNOWN_ANYDATA` to treat unknown XML (wrt YANG) as anydata.
305    * This is a way to loosen sanity checks if you need to accept eg unsynchronized YANG and XML
306* Stricter incoming RPC sanity checking, error messages may have changed.
307* Changed output of `clixon_cli -G` option to show generated CLI spec original text instead of resulting parse-tree, which gives better detail from a debugging perspective.
308
309### C-API changes on existing features (For developers)
310
311* Length of xml vector in many structs changed from `size_t` to `int`since it is a vector size, not byte size.
312  * Example: `transaction_data_t`
313* `xml_merge()` changed to use 3-value return: 1:OK, 0:Yang failed, -1: Error
314* Some function changed to use 3-value return: 1:OK, 0:Yang failed, -1: Error.
315  * Example: `xml_merge()`
316* `clixon_netconf_error(category, xerr, msg, arg)` removed first argument -> `clixon_netconf_error(xerr, msg, arg)`
317* CLI
318  * `clicon_parse()`: Changed signature due to new cligen error and result handling:
319  * Removed: `cli_nomatch()`
320
321### Optimzations
322* Optimized namespace prefix checks at xml parse time: using many prefixes slowed down parsing considerably
323* Optimized cbuf handling in parsing and xml2cbuf functions: use of new `cbuf_append()` function.
324* Optimized xml scanner to read strings rather than single chars
325* Identify early that trees are disjunct instead of recursively merge in `xml_merge`
326* Optimizations of `yang_bind` for large lists: use a "sibling/template" to use same binding as previous element.
327* Reduced memory for attribute and body objects, by allocating less memory in `xml_new()` than for elements, reducing XML storage with ca 25%
328* Cleared startup-db cache after restart, slashing datastore cache with (best-case) a third.
329* Removed nameserver binding cache for leaf/leaf-list objects.
330* Remove xml value cache after sorting (just use cligen value cache at sorting, remove after use)
331
332### Minor changes
333* Added decriptive error message when plugins produce invalid state XML.
334  * Example: `<error-tag>operation-failed</error-tag><error-info><bad-element>mystate</bad-element></error-info><error-message>No such yang module. Internal error, state callback returned invalid XML: example_backend</error-message>`
335  * Such a message means there is something wrong in the internal plugins or elsewehere, ie it is not a proper end-user error.
336* Adapted to CLIgen 4.5 API changes, eg: `cliread()` and `cliread_parse()`
337* Renamed utility function `clixon_util_insert()` to `clixon_util_xml_mod()` and added merge functionality.
338* Sanity check of duplicate prefixes in Yang modules and submodules as defined in RFC 7950 Sec 7.1.4
339
340### Corrected Bugs
341
342* Fixed: Insertion of subtree leaf nodes were not made in the correct place, always ended up last regardless of yang spec (if ordered-by system).
343
344## 4.4.0
3455 April 2020
346
347This release focusses on refactoring and bugfixing. Lots of
348changes to basic XML/YANG/RESTCONF code, including a tighter XML/YANG
349binding. Memory profiling and new buffer growth management. New
350features include optimized search functions and a repair callback.
351
352### Major New features
353
354* New "general-purpose" datastore upgrade/repair callback called once on startup, intended for low-level general upgrades and as a complement to module-specific upgrade.
355  * Called on startup after initial XML parsing, but before module-specific upgrades
356  * Enabled by defining the `.ca_datastore_upgrade`
357  * [General-purpose upgrade documentation](https://clixon-docs.readthedocs.io/en/latest/backend.html#general-purpose)
358* New and updated search functions using xpath, api-path and instance-id, and explicit indexes
359  * New search functions using api-path and instance_id:
360    * C search functions: `clixon_find_instance_id()` and `clixon_find_api_path()`
361  * Binary search optimization in lists for indexed leafs in all three formats.
362    * This improves search performance to O(logN) which is drastical improvements for large lists.
363  * You can also register explicit indexes for making binary search (not only list keys)
364  * For more info, see docs at [paths](https://clixon-docs.readthedocs.io/en/latest/paths.html) and
365[search](https://clixon-docs.readthedocs.io/en/latest/xml.html#searching-in-xml)
366
367### API changes on existing protocol/config features (You may have have to change how you use Clixon)
368* In the bbuild system, you dont need to do `make install-include` for installing include files for compiling. This is now included in the actions done by `make install`.
369* State data is now ordered-by system for performance reasons. For example, alphabetically for strings and numeric for integers
370  * Controlled by compile-time option `STATE_ORDERED_BY_SYSTEM`
371* Obsolete configuration options present in clixon configuration file will cause clixon application to exit at startup.
372* JSON
373  * Empty values in JSON has changed to comply to RFC 7951
374    * empty values of yang type `empty` are encoded as: `{"x":[null]}`
375    * empty string values are encoded as: `{"x":""}` (changed from `null` in 4.0 and `[null]` in 4.3)
376    * empty containers are encoded as: `{"x":{}}`
377    * empty elements in unknown/anydata/anyxml encoded as: `{"x":{}}` (changed from `{"x":null}`)
378  * JSON parse error messages change from `on line x: syntax error,..` to `json_parse: line x: syntax error`
379* State data
380  * Bugfix of `config false` statement may cause change of sorting of lists in GET opertions
381    * Lists were sorted that should not have been.
382* Config options
383  * New clixon-config@2020-02-22.yang revision
384    * Search index extension `search_index` for declaring which non-key variables are explicit search indexes (to support new optimized search API)
385    * Added `clixon-stats` state for clixon XML and memory statistics.
386    * Added: `CLICON_CLI_BUF_START` and `CLICON_CLI_BUF_THRESHOLD` so you can change the start and threshold of quadratic and linear growth of CLIgen buffers (cbuf:s)
387    * Added: CLICON_VALIDATE_STATE_XML for controling validation of user state XML
388  * Obsoleted and removed XMLDB format "tree". This function did not work. Only xml and json allowed.
389* CLI
390  * Session-id CLI functionality delayed: "lazy evaluation"
391    * From a cli perspective this is a revert to 4.1 behaviour, where the cli does not immediately exit on start if the backend is not running, but with the new session-id function
392* Error messages
393  * Unknown-element error message is more descriptive, eg from `namespace is: urn:example:clixon` to: `Failed to find YANG spec of XML node: x with parent: xp in namespace urn:example:clixon`.
394  * On failed validation of leafrefs, error message changed from: `No such leaf` to `No leaf <name> matching path <path>`.
395  * CLI Error message (clicon_rpc_generate_error()) changed when backend returns netconf error to be more descriptive:
396    * Original: `Config error: Validate failed. Edit and try again or discard changes: Invalid argument`
397    * New (example): `Validate failed. Edit and try again or discard changes: application operation-failed Identityref validation failed, undefined not derived from acl-base"
398
399### C-API changes on existing features (you may need to change your plugin C-code)
400* `xml_new()` changed from `xml_new(name, xp, ys)`  to `xml_new(name, xp, type)`
401  * If you have used, `ys`, add `xml_spec_set(x, ys)` after the statement
402  * If you have `xml_type_set(x, TYPE)`  after the statement, you can remove it and set it directly as: `xml_new(name, xp, TYPE)`
403* `xml_type_set()` has been removed in the API. The type must be set at creation time with `xml_new`
404* `clicon_rpc_generate_error()` renamed to `clixon_netconf_error()` and added a category parameter
405* All uses of `api_path2xpath_cvv()` should be replaced by `api_path2xpath()`
406   * `api_path2xpath()` added an `xerr` argument.
407* XML and JSON parsing functions have been rearranged/cleaned up as follows:
408   * Three value returns: -1: error, 0: parse OK, 1: parse and YANG binding OK.
409   * New concept called `yang_bind` that defines how XML symbols are bound to YANG after parsing (see below)
410   * New XML parsing API:
411      * `clixon_xml_parse_string()`
412      * `clixon_xml_parse_file()`
413   * New JSON parsing API, with same signature as XML parsing:
414      * `clixon_json_parse_string()`
415      * `clixon_xml_parse_file()`
416* Yang binding type has been introduced as a new concept and used in the API with the following values:
417   * `YB_MODULE` : Search for matching yang binding among top-level symbols of Yang modules
418   * `YB_PARENT` : Assume yang binding of existing parent and match its children by name
419   * `YB_NONE`   : Don't do YANG binding
420* XML YANG binding API have been rearranged as follows:
421   * `xml_bind_yang_rpc()`
422   * `xml_bind_yang_rpc_reply()`
423   * `xml_bind_yang()`
424   * `xml_bind_yang0()`
425   * All have three-value return values: -1: error, 0: YANG binding failed, 1: parse and YANG binding OK.
426
427### Minor changes
428
429* Moved hello example to [clixon-examples](https://github.com/clicon/clixon-examples)
430* Sanity check of mandatory key statement for Yang LISTs.
431  * If fails, exit with error message, eg: `Yang error: Sanity check failed: LIST vsDataContainer lacks key statement which MUST be present (See RFC 7950 Sec 7.8.2)`
432  * Can be disabled by setting `CLICON_CLICON_YANG_LIST_CHECK` to `false`
433* Replaced compile option `VALIDATE_STATE_XML` with runtime option `CLICON_VALIDATE_STATE_XML`.
434* Memory footprint
435  * Namespace cache is populated on-demand, see `xml2ns()`.
436  * CBUF start level is set to 256 (`CLICON_CLI_BUF_START` option)
437  * Reduced xml child vector default size from 4 to 1 with quadratic growth to 64K then linear
438* Test framework
439  * Added `-- -S <file>` command-line to main example to be able to return any state to main example.
440  * Added `test/cicd` test scripts for running on a set of other hosts
441* C-API:
442  * Added instrumentation: `xml_stats` and `xml_stats_global`.
443  * Added object-based `clixon_xvec` as a new programming construct for contiguous XML object vectors.
444    * See files: `clixon_xml_vec.[ch]`
445* C-code restructuring
446  * clixon_yang.c partitioned and moved code into clixon_yang_parse_lib.c and clixon_yang_module.c and move back some code from clixon_yang_type.c.
447    * partly to reduce size, but most important to limit code that accesses internal yang structures, only clixon_yang.c does this now.
448
449### Corrected Bugs
450
451* Fixed: Datastore read on startup got fixed default values.
452* Fixed: Default values only worked on leafs, not typedefs.
453* Fixed: NACM datanode write rules now follow NACM rules in the running db (not in the db being verified).
454* Fixed: NACM datanode write problem: read/write/exec default rules did not work.
455* Fixed [Makefile syntax error *** mixed implicit and normal rules #104](https://github.com/clicon/clixon/issues/104). Make operator `|=` seems not to work on GNU make version < 4.
456* Yang specs with recursive grouping/use statement is now fixed: instead of stack overflow, you get an error message and an exit
457* Fixed: Some state data was sorted but should not have been.
458  * Search function checked only own not for config false statement, should have checked all ancestors.
459* Fixed: Some restconf errors were wrongly formatted such as: `{"ietf-restconf:errors":{"error":{"rpc-error":` . There should be no `"rpc-error"` level.
460* Fixed: Enabling modstate (CLICON_XMLDB_MODSTATE), changing a revision on a yang, and restarting made the backend daemon exit at start (thanks Matt)
461  * Also: ensure to load `ietf-yang-library.yang ` if CLICON_XMLDB_MODSTATE is set
462* Fixed: Pretty-printed XML using prefixes not parsed correctly.
463  * eg `<a:x>   <y/></a:x>` could lead to errors, wheras (`<x>   <y/></x>`) works fine.
464* XML namespace merge bug fixed. Example: two xmlns attributes could both survive a merge whereas one should replace the other.
465* Compile option `VALIDATE_STATE_XML` introduced in `include/custom.h` to control whether code for state data validation is compiled or not.
466* Fixed: Validation of user state data led to wrong validation, if state relied on config data, eg leafref/must/when etc.
467* Fixed: No revision in yang module led to errors in validation of state data
468* Fixed: Leafref validation did not cover case of when the "path" statement is declared within a typedef, only if it was declared in the data part directly under leaf.
469* Fixed: Yang `must` xpath statements containing prefixes stopped working due to namespace context updates
470
471
472## 4.3.0
4731 January 2020
474
475There were several issues with multiple namespaces with augmented yangs in 4.2 that have been fixed in 4.3. Some other highlights include: several issues with XPaths including "canonical namespace context" support, a reorganization of the YANG files shipped with the release, and a wildchar in the CLICON_MODE variable.
476
477### API changes on existing features (you may need to change your code)
478* Yang files shipped with Clixon are reorganized into three classes: clixon, mandatory, optional, this is to enable users more flexibility in intergating with their own YANG files.
479  * Previously there was only  "standard" and "clixon", "standard" is now split into mandatory and optional.
480  * Clixon and mandatory yang spec are always installed
481  * Optional yang files are loaded only if configured with `--enable-optyangs` (flipped logic and changed from `disable-stdyangs`). NOTE: you must do this to run examples and tests.
482  * Optional yang files can be installed in a separate dir with `--with-opt-yang-installdir=DIR` (renamed from `with-std-yang-installdir`)
483* C-API
484  * Changed `clicon_rpc_generate_error(msg, xerr)` to `clicon_rpc_generate_error(xerr, msg, arg)`
485    * If you pass NULL as arg it produces the same message as before.
486  * Added namespace-context parameter `nsc` to `xpath_first` and `xpath_vec`, (`xpath_vec_nsc` and
487xpath_first_nsc` are removed).
488  * Added clicon_handle as parameter to all `clicon_connect_` functions to get better error message
489  * Added nsc parameter to `xmldb_get()`
490* The multi-namespace augment state may rearrange the XML namespace attributes.
491
492### Minor changes
493* Added experimental code for optimizing XPath search using binary search.
494  * Enable with XPATH_LIST_OPTIMIZE in include/clixon_custom.h
495  * Optimizes xpaths on the form: `a[b=c]` on sorted, yangified config lists.
496* Added "canonical" global namespace context: `nsctx_global`
497  * This is a normalized XML prefix:namespace pair vector computed from all loaded Yang modules. Useful when writing XML and XPATH expressions in callbacks.
498  * Get it with `clicon_nsctx_global_get(h)`
499* Added wildcard `*` as a mode to `CLICON_MODE` in clispec files
500  * If you set "CLICON_MODE="*";" in a clispec file it means that syntax will appear in all CLI spec modes.
501* State callbacks provided by user are validated. If they are invalid an internal error is returned, example, with error-tag: `operation-failed`and with error-message containing. `Internal error, state callback returned invalid XML`.
502* C-code:
503  * Added `xpath_first_localonly()` as an xpath function that skips prefix and namespace checks.
504  * Removed most assert.h includes
505  * Created two sub-files (clixon_validate.c and clixon_api_path.c) from large lib/src/clixon_xml_map.c source file.
506* Fixed multi-namespace for augmented state which was not covered in 4.2.0.
507* Main example yang changed to incorporate augmented state, new revision is 2019-11-15.
508
509### Corrected Bugs
510* XML parser failed on `]]]>` termination of CDATA.
511* [filter in netconf - one specific entry #100](https://github.com/clicon/clixon/issues/100)
512* [xpath_tree2cbuf() changes integers into floating point representations #99](https://github.com/clicon/clixon/issues/99)
513* [xml_parse_string() is slow for a long XML string #96](https://github.com/clicon/clixon/issues/96)
514* Mandatory variables can no longer be deleted.
515* [Add missing includes](https://github.com/clicon/clixon/pulls)
516
517
518## 4.3.1
5192 February 2020
520
521Patch release based on testing by Dave Cornejo, Netgate
522
523### Corrected Bugs
524* XML namespace merge bug fixed. Example: two xmlns attributes could both survive a merge whereas one should replace the other.
525* Compile option `VALIDATE_STATE_XML` introduced in `include/custom.h` to control whether code for state data validation is compiled or not.
526* Fixed: Validation of user state data led to wrong validation, if state relied on config data, eg leafref/must/when etc.
527* Fixed: No revision in yang module led to errors in validation of state data
528* Fixed: Leafref validation did not cover case of when the "path" statement is declared within a typedef, only if it was declared in the data part directly under leaf.
529* Fixed: Yang `must` xpath statements containing prefixes stopped working due to namespace context updates
530
531## 4.3.2
53215 February 2020
533
534### Major New features
535* New "general-purpose" datastore upgrade callback added which i called once on startup, intended for low-level general upgrades and as a complement to module-specific upgrade.
536  * Called on startup after initial XML parsing, but before module-specific upgrades
537  * Enabled by definign the `.ca_datastore_upgrade`
538  * [General-purpose upgrade documentation](https://clixon-docs.readthedocs.io/en/latest/backend.html#general-purpose)
539
540### API changes on existing features (you may need to change your code)
541* Session-id CLI functionality delayed: "lazy evaluation"
542  * C-api: Changed `clicon_session_id_get(clicon_handle h, uint32_t *id)`
543  * From a cli perspective this is a revert to 4.1 behaviour, where the cli does not immediately exit on start if the backend is not running, but with the new session-id function
544
545### Known Issues
546* If you retrieve state _and_ config data using RESTCONF or NETCONF `get`, a performance penalty occurs if you have large lists (eg ACLs). Workaround is: disable `VALIDATE_STATE_XML` in `include/clixon_custom.h` (disabled by default).
547
548### Corrected Bugs
549* Fixed: If you enabled modstate (CLICON_XMLDB_MODSTATE), changed a revision in a yang spec, and restarted the backend daemon, it exit at start (thanks Matt).
550  * Also: ensure to load `ietf-yang-library.yang ` if CLICON_XMLDB_MODSTATE is set
551* Fixed: Pretty-printed XML using prefixes not parsed correctly.
552  * eg `<a:x>   <y/></a:x>` could lead to errors, wheras (`<x>   <y/></x>`) works fine.
553
554## 4.3.3
55520 February 2020
556
557### Minor changes
558* Due to increased memory usage in internal XML trees, the [use cbuf for xml value code](https://github.com/clicon/clixon/commit/9575d10887e35079c4a9b227dde6ab0f6f09fa03) is reversed.
559
560## 4.2.0
56127 October 2019
562
563### Summary
564
565The main improvement in this release concerns security in terms of priveleges and credentials of accessing the clixon backend. There is also stricter multi-namespace checks which primarily effects where augmented models are used.
566
567### Major New features
568* The backend daemon can drop privileges after initialization to run as non-privileged user
569  * You can start as root and drop privileges either permanently or temporary
570    * use `-U <user>` clixon_backend command-line option to drop to `user`
571  * Generic options are the following:
572    * `CLICON_BACKEND_USER` drop of privileges to this user
573    * `CLICON_BACKEND_PRIVELEGES` can have the following values:
574      * `none` Make no drop/change in privileges. This is currently the default.
575      * `drop_perm`  After initialization, drop privileges permanently
576      * `drop_perm` After initialization, drop privileges temporarily (to a euid)
577  * If dropped temporary, you can restore privileges with `restore_priv()`
578* The backend socket has now support of credentials of peer clients
579  * NACM users are cross-checked with client credentials (cli/netconf/restconf)
580  * Only UNIX domain socket supports client credential checks (IP sockets do not).
581  * Controlled by option CLICON_NACM_CREDENTIALS
582    * `none` means credentials are not checked. Only option for IP sockets.
583    * `exact` means credentials of client user must match NACM user exactly.
584    * `except` means exact match is done except for root and www user.This is necessary for Restconf. This is default.
585* Stricter handling of multi-namespace handling
586  * This occurs in cases where there are more than one XML namespaces in a config tree, such as `augment`:ed trees.
587  * Affects all parts of the system, including datastore, backend, restconf and cli.
588  * Examples of a mandated stricter usage of a simple augment `b` of symbol `a`. Assume `a` is in module `mod1` with namespace `urn:example:a` and `b` is in module `mod2` with namespace `urn:example:b`:
589    * RESTCONF: `GET http://localhost/restconf/data/mod1:a/mod2:b`
590    * NETCONF: `<a xmlns="urn:example:a" xmlns:b="urn:example:b"><b:b>42</b:b></a>`
591    * XPATH (in edit-config filter): `<filter type="xpath" select="a:a/b:b" xmlns:
592
593### API changes on existing features (you may need to change your code)
594* The stricter multi-namespace handling (see above) may affect the API, if you used the more relaxed usage.
595* The credentials check (see above) may cause access denied if UNIX user does not match NACM user.
596* Changed "Demon error" to "Daemon error" in logs and debug. Output only.
597a="urn:example:a" xmlns:b="urn:example:b"/>`
598* RESTCONF error reporting
599  * Invalid api-path syntax (eg non-matching yang) error changed from 412 operation-failed to 400 Bad request invalid-value, or unknown-element.
600  * Changed so that `400 Bad Request` are for invalid api-path or unknown yang elements, `404 Not Found` for valid xml when object not found.
601* New clixon-config@2019-09-11.yang revision
602  * Added: CLICON_BACKEND_USER: Drop of privileges to this user, owner of backend socket (default: `clicon`)
603    * Therefore new installation should now add a UNIX `clicon` user
604  * Added: CLICON_BACKEND_PRIVELEGES: If and how to drop privileges
605  * Added: CLICON_NACM_CREDENTIALS: If and how to check backend socket priveleges with NACM
606  * Added: CLICON_NACM_RECOVERY_USER: Name of NACM recovery user.
607* Restconf top-level operations GET root resource modified to comply with RFC 8040 Sec 3.1
608  * non-pretty print remove all spaces, eg `{"operations":{"clixon-example:client-rpc":[null]`
609  * Replaced JSON `null` with `[null]` as proper empty JSON leaf/leaf-list encoding.
610* C-code change
611  * Changed `clicon_rpc_get` and `clicon_rpc_get_config` as follows:
612    * Added `username` as second parameter, default NULL
613    * Changed `namespace` to namespace context, which needs to be created
614    * Example new usage:
615    ```
616    cvec *nsc = xml_nsctx_init(NULL, "urn:example:clixon")
617    if (clicon_rpc_get_config(h, NULL, "running", "/interfaces", nsc, &xret) < 0)
618      err;
619    ```
620    See function reference how to make a call.
621  * C-code: added `id` parameter to `clicon_msg_encode()` and `clicon_msg_decode()` due to internal backend socket message change
622
623### Minor changes
624* Changed session-id handing. Instead of using pid of peer process, a proper session id generated by the server is used, following RFC6241.
625  * Clients query with a hello to the server at startup and expects a hello reply
626  back containing the session-id. Which is then used in further communication.
627  * Code in kill_session is removed where this fact was used to actually kill the client process. Now only the session endpoint is closed.
628* XPATH canonical form implemented for NETCONF get and get-config. This means that all callbacks (including state callbacks) will have the prefixes that corresponds to module prefixes. If an xpath have other prefixes (or null as default), they will be translated to canonical form before any callbacks.
629  * Example of a canonical form: `/a:x/a:y`, then symbols must belong to a yang module with prefix `a`.
630* FreeBSD modifications: Configure, makefiles and test scripts modification for Freebsd
631
632### Corrected Bugs
633* Fixed CLI error messages on wrong cli_set/merge xml-key to eg:
634  * `Config error: api-path syntax error \"/example:x/m1=%s\": rpc malformed-message List key m1 length mismatch : Invalid argument"`
635* Hello netconf candidate capability misspelled, mentioned in [Can clixon_netconf receive netconf packets as a server? #93](https://github.com/clicon/clixon/issues/93)
636* [Cannot write to config using restconf example #91](https://github.com/clicon/clixon/issues/91)
637  * Updated restconf documentation (the example was wrong)
638* [clixon-lib yang revision file name update #92](https://github.com/clicon/clixon/issues/92)
639  * Clixon-lib yang file had conflicting filename and internal yang revision.
640  * This was only detected in the use-case when a whole dir was loaded.
641  * Inserted sanity check in all yang parse routines.
642  * Committed updated clixon-lib yang file that triggered the error
643
644## 4.1.0
64518 August 2019
646
647### Summary
648
6494.1.0 is focussed on RFC 8040 RESTCONF features. Highlights include:
650- RFC8040 plain PATCH,
651- Query parameters: content, depth, insert, position
652- Standard return codes
653
654### Major New features
655* Restconf RFC 8040 increased feature compliance
656  * RESTCONF PATCH (plain patch) is implemented according to RFC 8040 Section 4.6.1
657    * Note RESTCONF plain patch is different from RFC 8072 "YANG Patch Media Type" which is not implemented
658  * RESTCONF "content" query parameter supported
659    * Extended Netconf with content attribute for internal use
660  * RESTCONF "depth" query parameter supported
661    * Extended Netconf with depth attribute for internal use
662  * RESTCONF "insert" and "point" query parameters supported
663    * Applies to ordered-by-user leaf and leaf-lists
664  * RESTCONF PUT/POST erroneously returned 200 OK. Instead restconf now returns:
665    * `201 Created` for created resources
666    * `204 No Content` for replaced resources.
667    * identity/identityref mapped between XML and JSON
668      * XML uses prefixes, JSON uses module-names (previously prefixes were used in both cases)
669    * See [RESTCONF: HTTP return codes are not according to RFC 8040](https://github.com/clicon/clixon/issues/56)
670    * Implementation detail: due to difference between RESTCONF and NETCONF semantics, a PUT first to make en internal netconf edit-config create operation; if that fails, a replace operation is tried.
671  * HTTP `Location:` fields added in RESTCONF POST replies
672  * HTTP `Cache-Control: no-cache` fields added in HTTP responses (RFC Section 5.5)
673  * Restconf monitoring capabilities (RFC Section 9.1)
674* Yang Netconf leaf/leaf-list insert support
675  * For "ordered-by user" leafs and leaf-lists, the insert and value/key attributes are supported according to RFC7950 Sections 7.7.9 and 7.8.6
676* Yang extensions support
677  * New plugin callback: ca_extension
678  * The main example explains how to implement a Yang extension in a backend plugin.
679
680### API changes on existing features (you may need to change your code)
681* C API changes:
682  * Added `depth` parameter to function `clicon_xml2cbuf`, default is -1.
683  * Added two parameters to function `clicon_rpc_get`
684    * `content`: to select state or config. Allowed values: CONTENT_CONFIG,CONTENT_NOCONFIG, CONTENT_ALL (default)
685    * `depth`: Get levels of XML in get function: -1 is unbounded, 0 is nothing, 1 is top-level node only.
686* Netconf edit-config "operation" attribute namespace check is enforced
687  * E.g.: `<a xmlns="uri:example" operation="merge">` --> `<a xmlns="uri:example" nc:operation="merge" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">`
688* RESTCONF NACM access-denied error code changed from "401 Unauthorized" to "403 Forbidden"
689  * See RFC 8040 (eg 4.4.1, 4.4.2, 4.5, 4.6, 4.7)
690* RESTCONF PUT/POST erroneously returned 200 OK. Instead restconf now returns:
691  * `201 Created` for created resources
692  * `204 No Content` for replaced resources.
693* RESTCONF PUT/POST `Content-Type` is enforced
694  * Before accepted JSON as default, now Content-Type must be explicit, such as `Content-Type: application/yang-data+json`
695  * If not, you will get 415 unsupported media type
696* RESTCONF identities has changed to use module names instead of prefixes following RFC8040:
697  * Eg, `curl -X POST -d '{"type":"ex:eth"}` --> `curl -X POST -d '{"type":"ietf-interfaces:eth"`}
698* JSON changes
699  * Non-pretty-print output removed all extra spaces.
700    * Example: `{"nacm-example:x": 42}` --> `{"nacm-example:x":42}`
701  * Empty JSON values changed from `null` to:
702    * Empty yang container encoded as `{}`
703    * Empty leaf/leaf-list of type empty encoded as `[null]`
704    * Other empty values remain as `null`
705
706### Minor changes
707* New [clixon-doc sphinx/read-the-docs](https://clixon-docs.readthedocs.io) started
708  * The goal is to move all clixon documentation there
709* Added experimental binary search API function: `xml_binsearch` that can be used by plugin developers.
710  * This provides binary search of list/leaf-lists as described here: <https://en.wikipedia.org/wiki/Binary_search_algorithm>
711* Removed unnecessary configure dependencies
712  * libnsl, libcrypt, if_vlan,...
713* "pseudo-plugins" added, ie virtual plugins to enable callbacks also for main programs. Useful for extensions.
714  * See `clixon_pseudo_plugin`
715
716### Corrected Bugs
717* If `ietf-netconf.yang` was imported from any yang module, client/backend communication stops working.
718  * Fixed by adding supported netconf features before loading other yang modules
719* RESTCONF JSON identity had wrong namespace in sub-objetcs
720  * Showed if you GET an object with JSON encoding that have identities
721* Fixed Segv in nacm write when MERGE and creating object
722  * Should only be applicable on netconf MERGE and restconf PATCH
723* Corrected problem with namespace context cache, was not always cleared when adding new subtrees.
724* Corrected CLI bug with lists of multiple keys (netconf/restconf works).
725  * Worked in 3.10, but broke in 4.0.0. Fixed in 4.0.1
726  * Example: `yang list x { key "a b";...}`
727    CLI error example:
728    ```
729      set x a 1 b 1; #OK
730      set x a 1 b 2; #OK
731      set x a 1 b <anything> # Error
732    ```
733* Fixed RESTCONF api-path leaf-list selection was not made properly
734  * Requesting eg `mod:x/y=42` returned the whole list: `{"y":[41,42,43]}` whereas it should only return one element: `{"y":42}`
735* Fixed [RESTCONF: HTTP return codes are not according to RFC 8040](https://github.com/clicon/clixon/issues/56)
736  * See also API changes above
737* Yang Unique statements with multiple schema identifiers did not work on some platforms due to memory error.
738
739
740## 4.0.0
74113 July 2019
742
743### Summary
744
745This release is a major uplift of Yang and XML features which
746motivates a major version number increment.
747
748In short, I consider the Yang and XML support good enough for most
749use-cases. There are still features not supported, but hopefully they
750are relatively uncommon (see [README](https://github.com/clicon/clixon/#yang).
751
752The next task for uplifting is RESTCONF where several use-cases are
753not supported. There is also a need for NETCONF modernization and
754added optional features.
755
756Going forward I plan to make more regular minor releases. With the
757current Trevor CI in place, making releases should not be a large
758thing, and it is also safer to just pull a master commit. However, for
759synchronizing and tracing I will try to make monthly releases.
760
761Thanks to Netgate for that enabled me to spend full time on Clixon!
762
763Stockholm 13 July 2019
764Olof Hagsand
765
766### Major New features
767* Yang "refine" feature supported
768  * According to RFC 7950 7.13.2
769* Yang "min-element" and "max-element" feature supported
770  * According to RFC 7950 7.7.4 and 7.7.5
771  * See (tests)[test/test_minmax.sh]
772  * The following cornercases are not supported:
773    * Check for min-elements>0 for empty lists on top-level
774    * Check for min-elements>0 for empty lists in choice/case
775* Yang "unique" feature supported
776  * According to RFC 7950 7.8.3
777  * See (tests)[test/test_unique.sh]
778* Improvements of yang pattern (regular expressions)
779  * Support for multiple patterns as described in RFC7950 Section 9.4.7
780  * Support for inverted patterns as described in RFC7950 Section 9.4.6
781  * Libxml2 support for full XSD matching as alternative to Posix translation
782    * Configure with: `./configure --with-libxml2`
783    * Set `CLICON_YANG_REGEXP` to libxml2 (default is posix)
784    * Note you need to configure cligen as well with `--with-libxml2`
785  * Better compliance with XSD regexps in the default Posix translation regex mode
786    * Added `\p{L}` and `\p{N}`
787    * Added escaping of `$`
788  * Added clixon_util_regexp utility function
789  * Added extensive regexp test [test/test_pattern.sh] for both posix and libxml2
790  * Added regex cache to type resolution
791* Optimization work
792  * Removed O(n^2) in cli expand/completion code
793  * Improved performance of validation of (large) lists
794  * A scaling of [large lists](doc/scaling) report is added
795  * New xmldb_get1() returning actual cache - not a copy. This has lead to some householding instead of just deleting the copy
796  * xml_diff rewritten to work linearly instead of O(2)
797  * New xml_insert function using tree search. The new code uses this in insertion xmldb_put and defaults. (Note previous xml_insert renamed to xml_wrap_all)
798  * A yang type regex cache added, this helps the performance by avoiding re-running the `regcomp` command on every iteration.
799  * An XML namespace cache added (see `xml2ns()`)
800  * Better performance of XML whitespace parsing/scanning.
801* Persistent CLI history supported
802  * See [Preserve CLI command history across sessions. The up/down arrows](https://github.com/clicon/clixon/issues/79)
803  * The design is similar to bash history:
804      * The CLI loads/saves its complete history to a file on entry and exit, respectively
805      * The size (number of lines) of the file is the same as the history in memory
806      * Only the latest session dumping its history will survive (bash merges multiple session history).
807      * Tilde-expansion is supported
808      * Files not found or without appropriate access will not cause an exit but will be logged at debug level
809  * New config options: CLICON_CLI_HIST_FILE with default value `~/.clixon_cli_history`
810  * New config options: CLICON_CLI_HIST_SIZE with default value 300.
811* New backend startup and upgrade support,
812  * See (doc/startup.md) for details
813  * Enable with CLICON_XMLDB_MODSTATE config option
814  * Check modules-state tags when loading a datastore at startup
815    * Check which modules match, and which do not.
816  * Loading of "extra" XML, such as from a file.
817  * Detection of in-compatible XML and Yang models in the startup configuration.
818  * A user can register upgrade callbacks per module/revision when in-compatible XML is encountered (`update_callback_register`).
819    * See the [example](example/example_backend.c) and [test](test/test_upgrade_interfaces.sh].
820  * A "failsafe" mode allowing a user to repair the startup on errors or failed validation.
821  * Major rewrite of `backend_main.c` and a new module `backend_startup.c`
822* Datastore files contain RFC7895 module-state information
823  * Added modules-state diff parameter to xmldb_get datastore function
824  * Set config option `CLICON_XMLDB_MODSTATE` to true
825    * Enable this if you wish to use the upgrade feature in the new startup functionality.
826  * Note that this adds bytes to your configs
827* New xml changelog experimental feature for automatic upgrade
828  * Yang module clixon-xml-changelog@2019-03-21.yang based on draft-wang-netmod-module-revision-management-01
829  * Two config options control:
830    * CLICON_XML_CHANGELOG enables the yang changelog feature
831    * CLICON_XML_CHANGELOG_FILE where the changelog resides
832
833### API changes on existing features (you may need to change your code)
834
835* RESTCONF strict namespace validation of data in POST and PUT.
836  * Accepted:
837  ```
838    curl -X PUT http://localhost/restconf/data/mod:a -d {"mod:a":"x"}
839  ```
840  * Not accepted (must prefix "a" with module):
841  ```
842    curl -X PUT http://localhost/restconf/data/mod:a -d {"a":"x"}
843  ```
844* XPATH API is extended with namespaces, in the following cases (see [README](README.md#xml-and-xpath)):
845  * CLIspec functions have added optional namespace parameter:
846    * `cli_show_config <db> <format> <xpath>` --> `cli_show_config <db> <format> <xpath> <namespace>`
847    * `cli_copy_config <db> <xpath> ...` --> `cli_copy_config <db> <xpath> <namespace> ...`
848  * Change the following XPATH API functions (xpath_first and xpath_vec remain as-is):
849    * `xpath_vec_flag(x, format, flags, vec, veclen, ...)` --> `xpath_vec_flag(x, nsc, format, flags, vec, veclen, ...)`
850    * `xpath_vec_bool(x, format, ...)` --> `xpath_vec_bool(x, nsc, format, ...)`
851    * `xpath_vec_ctx(x, xpath, xp)` --> `xpath_vec_ctx(x, nsc, xpath, xp)`
852  * New Xpath API functions with namespace contexts:
853    * `xpath_first_nsc(x, nsc, format, ...)`
854    * `xpath_vec_nsc(x, nsc, format, vec, veclen, ...)`
855  * Change xmldb_get0 with added `nsc` parameter:
856    * `xmldb_get0(h, db, xpath, copy, xret, msd)` --> `xmldb_get0(h, db, nsc, xpath, copy, xret, msd)`
857  * The plugin statedata callback (ca_statedata) has been extended with an nsc parameter:
858    * `int example_statedata(clicon_handle h, cvec *nsc, char *xpath, cxobj *xstate);`
859  * rpc get and get-config api function has an added namespace argument:
860    * `clicon_rpc_get_config(clicon_handle h, char *db, char *xpath, char *namespace, cxobj **xt);`
861    * `int clicon_rpc_get(clicon_handle h, char *xpath, char *namespace, cxobj **xt);`
862* Error messages for invalid number ranges and string lengths have been uniformed and changed.
863  * Error messages for invalid ranges are now on the form:
864  ```
865    Number 23 out of range: 1 - 10
866    String length 23 out of range: 1 - 10
867  ```
868* On validation callbacks, XML_FLAG_ADD is added to all nodes at startup validation, not just the top-level. This is the same behaviour as for steady-state validation.
869* All hash_ functions have been prefixed with `clicon_` to avoid name collision with other packages (frr)
870  * All calls to the following functions must be changed: `hash_init`, `hash_free`, `hash_lookup`, `hash_value`, `hash_add`, `hash_del`, `hash_dump`, and `hash_keys`.
871* Replaced `CLIXON_DATADIR` with two configurable options defining where Clixon installs Yang files.
872  * use `--with-yang-installdir=DIR` to install Clixon yang files in DIR
873  * use `--with-std-yang-installdir=DIR` to install standard yang files that Clixon may use in DIR
874  * Default is (as before) `/usr/local/share/clixon`
875* New clixon-config@2019-06-05.yang revision
876  * Added: `CLICON_YANG_REGEXP, CLICON_CLI_TAB_MODE, CLICON_CLI_HIST_FILE, CLICON_CLI_HIST_SIZE, CLICON_XML_CHANGELOG, CLICON_XML_CHANGELOG_FILE`.
877  * Renamed: `CLICON_XMLDB_CACHE` to `CLICON_DATASTORE_CACHE` and type changed.
878  * Deleted: `CLICON_XMLDB_PLUGIN, CLICON_USE_STARTUP_CONFIG`;
879* New clixon-lib@2019-06-05.yang revision
880  * Added: ping rpc added (for liveness)
881* Added compiled regexp parameter as part of internal yang type resolution functions
882  * `yang_type_resolve()`, `yang_type_get()`
883* All internal `ys_populate_*()` functions (except ys_populate()) have switched parameters: `clicon_handle, yang_stmt *)`
884* Added clicon_handle as parameter to all validate functions
885  * Just add `clixon_handle h` to all calls.
886* Clixon transaction mechanism has changed which may affect your backend plugin callbacks:
887  * Validate-only transactions are terminated by an `end` or `abort` callback. Now all started transactions are terminated either by an `end` or `abort` without exceptions
888    * Validate-only transactions used to be terminated by `complete`
889  * If a commit user callback fails, a new `revert` callback will be made to plugins that have made a succesful commit.
890    * Clixon used to play the (already made) commit callbacks in reverse order
891* Many validation functions have changed error parameter from cbuf to xml tree.
892  * XML trees are more flexible for utility tools
893  * If you use these(mostly internal), you need to change the error function: `generic_validate, from_validate_common, xml_yang_validate_all_top, xml_yang_validate_all, xml_yang_validate_add, xml_yang_validate_rpc, xml_yang_validate_list_key_only`
894* Datastore cache and xmldb_get() changes:
895  * You need to remove `msd` (last) parameter of `xmldb_get()`:
896    * `xmldb_get(h, "running", "/", &xt, NULL)` --> `xmldb_get(h, "running", "/", &xt)`
897  * New suite of API functions enabling zero-copy: `xmldb_get0`. You can still use `xmldb_get()`. The call sequence of zero-copy is (see reference for more info):
898```
899   xmldb_get0(xh, "running", "/interfaces/interface[name="eth"]", 0, &xt, NULL);
900   xmldb_get0_clear(h, xt);     # Clear tree from default values and flags
901   xmldb_get0_free(h, &xt);     # Free tree
902```
903  * Clixon config option `CLICON_XMLDB_CACHE` renamed to `CLICON_DATASTORE_CACHE` and changed type from `boolean` to `datastore_cache`
904  * Type `datastore_cache` have values: nocache, cache, or cache-zerocopy
905  * Change code from: `clicon_option_bool(h, "CLICON_XMLDB_CACHE")` to `clicon_datastore_cache(h) == DATASTORE_CACHE`
906  * `xmldb_get1` removed (functionality merged with `xmldb_get`)
907* Non-key list now not accepted in edit-config (before only on validation)
908* Changed return values in internal functions
909  * These functions are affected: `netconf_trymerge`, `startup_module_state`, `yang_modules_state_get`
910  * They now comply to Clixon validation: Error: -1; Invalid: 0; OK: 1.
911* New Clixon Yang RPC: ping. To check if backup is running.
912  * Try with `<rpc xmlns="http://clicon.org/lib"><ping/></rpc>]]>]]>`
913* Restconf with startup feature will now copy all edit changes to startup db (as it should according to RFC 8040)
914* Netconf Startup feature is no longer hardcoded, you need to explicitly enable it (See RFC 6241, Section 8.7)
915  * Enable in config file with: `<CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>`, or use `*:*`
916* The directory `docker/system` has been moved to `docker/main`, to reflect that it runs the main example.
917* xmldb_get() removed "config" parameter:
918  * Change all calls to dbget from: `xmldb_get(h, db, xpath, 0|1, &xret, msd)` to `xmldb_get(h, db, xpath, &xret, msd)`
919* Structural change: removed datastore plugin and directory, and merged into regular clixon lib code.
920  * The CLICON_XMLDB_PLUGIN config option is obsolete, you should remove it from your config file
921  * All references to plugin "text.so" should be removed.
922  * The datastore directory is removed, code is moved to lib/src/clixon_datastore*.c
923  * Removed clixon_backend -x <plugin> command-line options
924* Structural C-code change of yang statements:
925  * Merged yang_spec and yang_node types into yang_stmt
926    * Change all references to types yang_node/yang_spec to yang_stmt
927    * Change all yang struct field accesses yn_* and yp_* to ys_* (but see next item for access functions).
928  * Added yang access functions
929    * Change all y->ys_parent to yang_parent_get(y)
930    * Change all y->ys_keyword to yang_keyword_get(y)
931    * Change all y->ys_argument to yang_argument_get(y)
932    * Change all y->ys_cv to yang_cv_get(y)
933    * Change all y->ys_cvec to yang_cvec_get(y) or yang_cvec_set(y, cvv)
934  * Removed external direct access to the yang_stmt struct.
935* xmldb_get() removed unnecessary config option:
936  * Change all calls to dbget from: `xmldb_get(h, db, xpath, 0|1, &xret, msd)` to `xmldb_get(h, db, xpath, &xret, msd)`
937
938* Moved out code from clixon_options.[ch] into a new file: clixon_data.[ch] where non-option data resides.
939* Directory change: Moved example to example/main to make room for other examples.
940* Removed argc/argv parameters from ca_start plugin API function:
941  * You may need to change signatures of your startup in your plugins, eg from:
942  ```
943    int xxx_start(clicon_handle h, int argc, char **argv)
944    {
945	return 0;
946    }
947    static clixon_plugin_api xxx_api = {
948        ...
949	.ca_start = xxx_start,
950  ```
951    to:
952  ```
953    int xxx_start(clicon_handle h)
954    {
955	return 0;
956    }
957    static clixon_plugin_api xxx_api = {
958        ...
959	.ca_start = xxx_start,
960  ```
961    * If you use argv/argc use `clicon_argv_get()` in the init function instead.
962* Changed hash API for better error handling
963  * hash_dump, hash_keys, clicon_option_dump have new signatures
964* Renamed `xml_insert` to `xml_wrap_all`.
965* Added modules-state diff parameter to xmldb_get datastore function for startup scenarios. Set this to NULL in normal cases.
966* `rpc_callback_register` added a namespace parameter. Example:
967   ```
968     rpc_callback_register(h, empty_rpc, NULL, "urn:example:clixon", "empty");
969   ```
970* Clixon configuration file top-level symbols has changed to `clixon-config`and namespace check is enforced. This means all Clixon configuration files must change from:
971  ```
972    <config>...</config>
973  to:
974    <clixon-config xmlns="http://clicon.org/config">...</clixon-config>
975  ```
976* Strict XML prefixed namespace check. This means all XML namespaces must always be declared by default or prefixed attribute name. There were some cases where this was not enforced. Example, `y` must be declared:
977```
978  <a><y:b/></a> -->    <a xmlns:y="urn:example:y"><y:b/></a>
979```
980
981### Minor changes
982
983* Documented bug [Yang identityref XML encoding is not general #90](https://github.com/clicon/clixon/issues/90)
984* Added new API function `xpath_parse()` to split parsing and xml evaluation.
985* Rewrote `api_path2xpath` to handle namespaces.
986* `api_path2xml_vec` strict mode check added if list key length mismatch
987* `startup_extraxml` triggers unnecessary validation
988  * Renamed startup_db_reset -> xmldb_db_reset (its a general function)
989  * In startup_extraxml(), check if reset callbacks or extraxml file actually makes and changes to the tmp db.
990* Print CLICON_YANG_DIR and CLICON_FEATURE lists on startup with debug flag
991* Extended `util/clixon_util_xml` with yang and validate functionality so it can be used as a stand-alone utility for validating XML/JSON files
992* JSON parse and print improvements
993  * Integrated parsing with namespace translation and yang spec lookup
994* Added CLIgen tab-modes in config option CLICON_CLI_TAB_MODE, which means you can control the behaviour of `<tab>` in the CLI.
995* Yang state get improvements
996  * Integrated state and config into same tree on retrieval, not separate trees
997  * Added cli functions `cli_show_config_state()` and `cli_show_auto_state()` for showing combined config and state info.
998  * Added integrated state in the main example: `interface/oper-state`.
999  * Added performance tests for getting state, see [test/test_perf_state.sh].
1000* Improved submodule implementation (as part of [Yang submodule import prefix restrictions #60](https://github.com/clicon/clixon/issues/60)).
1001  * Submodules share same namespace as modules, which means that functions looking for symbols under a module were extended to also look in that module's included submodules, also recursively (submodules can include submodules in Yang 1.0).
1002  * Submodules are no longer merged with modules in the code. This is necessary to have separate local import prefixes, for example.
1003  * New function `ys_real_module()` complements `ys_module()`. The latter gets the top module or submodule, whereas the former gets the ultimate module that a submodule belongs to.
1004  * See [test/test_submodule.sh]
1005* New XMLDB_FORMAT added: `tree`. An experimental record-based tree database for
1006 direct access of records.
1007* Netconf error handling modified
1008  * New option -e added. If set, the netconf client returns -1 on error.
1009* A new minimal "hello world" example has been added
1010* Experimental customized error output strings, see [lib/clixon/clixon_err_string.h]
1011* Empty leaf values, eg <a></a> are now checked at validation.
1012  * Empty values were skipped in validation.
1013  * They are now checked and invalid for ints, dec64, etc, but are treated as empty string "" for string types.
1014* Added syntactic check for yang status: current, deprecated or obsolete.
1015* Added `xml_wrap` function that adds an XML node above a node as a wrapper
1016  * also renamed `xml_insert` to `xml_wrap_all`.
1017* Added `clicon_argv_get()` function to get the user command-line options, ie the args in `-- <args>`. This is an alternative to using them passed to `plugin_start()`.
1018* Made Makefile concurrent so that it can be compiled with -jN
1019* Added flags to example backend to control its behaviour:
1020  * Start with `-- -r` to run the reset plugin
1021  * Start with `-- -s` to run the state callback
1022* Rewrote yang dir load algorithm to follow the algorithm in [FAQ](FAQ(doc/FAQ.md#how-are-yang-files-found) with more precise timestamp checks, etc.
1023* Ensured you can add multiple callbacks for any RPC, including basic ones.
1024  * Extra RPC:s will be called _after_ the basic ones.
1025  * One specific usecase is hook for `copy-config` (see [doc/ROADMAP.md](doc/ROADMAP.md) that can be implemented this way.
1026* Added "base" as CLI default mode and "cli> " as default prompt.
1027* clixon-config YAML file has new revision: 2019-03-05.
1028  * New URN and changed top-level symbol to `clixon-config`
1029* Removed obsolete `_CLICON_XML_NS_STRICT` variable and `CLICON_XML_NS_STRICT` config option.
1030* Removed obsolete `CLICON_CLI_MODEL_TREENAME_PATCH` constant
1031* Added specific clixon_suberrno code: XMLPARSE_ERRNO to identify XML parse errors.
1032* Removed all dependency on strverscmp
1033* Added libgen.h for baseline()
1034
1035### Corrected Bugs
1036
1037* Fixed: Return 404 Not found error if restconf GET does not return requested instance
1038* Fixed [Wrong yang-generated cli code for typeref identityref combination #88](https://github.com/clicon/clixon/issues/88)
1039* Fixed [identityref validation fails when using typedef #87](https://github.com/clicon/clixon/issues/87)
1040* Fixed a problem with some netconf error messages caused restconf daemon to exit due to no XML encoding
1041* Check cligen tab mode, dont start if CLICON_CLI_TAB_MODE is undefined
1042* Startup transactions did not mark added tree with XML_FLAG_ADD as it should.
1043* Restconf PUT different keys detected (thanks @dcornejo) and fixed
1044  * This was accepted but shouldn't be: `PUT http://restconf/data/A=hello/B -d '{"B":"goodbye"}'`
1045  * See RFC 8040 Sec 4.5
1046* Yang Enumeration including space did not generate working CLIgen code, see [Choice with space is not working in CLIgen code](https://github.com/olofhagsand/cligen/issues/24)
1047* Fixed: [Yang submodule import prefix restrictions #60](https://github.com/clicon/clixon/issues/60)
1048* Fixed support for multiple datanodes in a choice/case statement. Only single datanode was supported.
1049* Fixed an ordering problem showing up in validate/commit callbacks. If two new items following each order (yang-wise), only the first showed up in the new-list. Thanks achernavin!
1050* Fixed a problem caused by recent sorting patches that made "ordered-by user" lists fail in some cases, causing multiple list entries with same keys. NACM being one example. Thanks vratnikov!
1051* [Restconf does not handle startup datastore according to the RFC](https://github.com/clicon/clixon/issues/74)
1052* Failure in startup with -m startup or running left running_db cleared.
1053  * Running-db should not be changed on failure. Unless failure-db defined. Or if SEGV, etc. In those cases, tmp_db should include the original running-db.
1054* Backend plugin returning NULL was still installed - is now logged and skipped.
1055* [Parent list key is not validated if not provided via RESTCONF #83](https://github.com/clicon/clixon/issues/83), thanks achernavin22.
1056* [Invalid JSON if GET /operations via RESTCONF #82](https://github.com/clicon/clixon/issues/82), thanks achernavin22
1057* List ordering bug - lists with ints as keys behaved wrongly and slow.
1058* NACM read default rule did not work properly if nacm was enabled AND no groups were defined
1059* Re-inserted `cli_output_reset` for what was erroneuos thought to be an obsolete function
1060  * See in 3.9.0 minor changes: Replaced all calls to (obsolete) `cli_output` with `fprintf`
1061* Allowed Yang extended Xpath functions (syntax only):
1062  * re-match, deref, derived-from, derived-from-or-self, enum-value, bit-is-set
1063* XSD regular expression handling of dash(`-`)
1064  *: Translate XDS `[xxx\-yyy]` to POSIX `[xxxyyy-]`.
1065* YANG Anydata treated same as Anyxml
1066* Bugfix: [Nodes from more than one of the choice's branches exist at the same time](https://github.com/clicon/clixon/issues/81)
1067  * Note it may still be possible to load a file with multiple choice elements via netconf, but it will not pass validate.
1068* Bugfix: Default NACM policies applied even if NACM is disabled
1069* [Identityref inside augment statement](https://github.com/clicon/clixon/issues/77)
1070  * Yang-stmt enhanced with "shortcut" to original module
1071* Yang augment created multiple augmented children (no side-effect)
1072* XML prefixed attribute names were not copied into the datastore
1073* [yang type range statement does not support multiple values](https://github.com/clicon/clixon/issues/59)
1074  * Remaining problem was mainly CLIgen feature. Strengthened test cases in [test/test_type.sh].
1075  * Also in: [Multiple ranges support](https://github.com/clicon/clixon/issues/78)
1076* Fixed numeric ordering of lists (again) [https://github.com/clicon/clixon/issues/64] It was previously just fixed for leaf-lists.
1077* There was a problem with ordered-by-user for XML children that appeared in some circumstances and difficult to trigger. Entries entered by the user did not appear in the order they were entered. This should now be fixed.
1078
1079## 4.0.1
10805 Aug 2019
1081
1082This is a hotfix for a multi-key CLI bug that appeared in 4.0.0
1083(worked in 3.10).
1084
1085### Corrected Bugs
1086* Corrected CLI bug with lists of multiple keys (netconf/restconf works).
1087  * Example: `yang list x { key "a b";...}`
1088    CLI error example:
1089    ```
1090      set x a 1 b 1; #OK
1091      set x a 1 b 2; #OK
1092      set x a 1 b <anything> # Error
1093    ```
1094
1095## 3.9.0
109621 Feb 2019
1097
1098Thanks for all bug reports, feature requests and support! Thanks to [Netgate](https://www.netgate.com) and other sponsors for making Clixon a better tool!
1099
1100### Major New features
1101* Correct [W3C XML 1.0 names spec](https://www.w3.org/TR/2009/REC-xml-names-20091208) namespace handling in Restconf and Netconf.
1102  * See [https://github.com/clicon/clixon/issues/49]
1103  * The following features are exceptions and still do not support namespaces:
1104    * Netconf `edit-config xpath select` statement, and all xpath statements
1105    * Notifications
1106    * CLI syntax (ie generated commands)
1107  * The default namespace is ietf-netconf base syntax with uri: `urn:ietf:params:xml:ns:netconf:base:1.0` and need not be explicitly given.
1108  * The following example shows changes in netconf and restconf:
1109    * Accepted pre 3.9 (now not valid):
1110    ```
1111     <rpc>
1112       <my-own-method/>
1113     </rpc>
1114     <rpc-reply>
1115       <route>
1116         <address-family>ipv4</address-family>
1117       </route>
1118     </rpc-reply>
1119    ```
1120    * Correct 3.9 Netconf RPC:
1121    ```
1122     <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> # xmlns may be ommitted
1123       <my-own-method xmlns="urn:example:my-own">
1124     </rpc>
1125     <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
1126       <route xmlns="urn:ietf:params:xml:ns:yang:ietf-routing">
1127         <address-family>ipv4</address-family>
1128       </route>
1129     </rpc-reply>
1130    ```
1131    * Correct 3.9 Restconf request/ reply
1132    ```
1133    POST http://localhost/restconf/operations/example:example)
1134    Content-Type: application/yang-data+json
1135    {
1136      "example:input":{
1137        "x":0
1138      }
1139    }
1140    HTTP/1.1 200 OK
1141    {
1142      "example:output": {
1143        "x": "0",
1144        "y": "42"
1145      }
1146    }
1147    ```
1148  * To keep previous non-strict namespace handling (backwards compatible), set CLICON_XML_NS_STRICT to false. Note that this option will be removed asap after 3.9.0.
1149
1150* An uplift of Yang to conform to RFC7950
1151  * YANG parser cardinality checked (https://github.com/clicon/clixon/issues/48)
1152  * More precise Yang validation and better error messages
1153    * RPC method input parameters validated (https://github.com/clicon/clixon/issues/47)
1154    * Added bad-, missing-, or unknown-element error messages, instead of operation-failed.
1155    * Validation of mandatory choice and recursive mandatory containers
1156  * Support of YANG `submodule, include and belongs-to` and improved `unknown` handling
1157  * Parsing of standard yang files supported, such as:
1158    * https://github.com/openconfig/public - except [https://github.com/clicon/clixon/issues/60]. See [test/test_openconfig.sh]
1159    * https://github.com/YangModels/yang - except vendor-specific specs. See [test/test_yangmodels.sh].
1160  * Yang load file configure options changed
1161    * `CLICON_YANG_DIR` is changed from a single directory to a path of directories
1162      * Note `CLIXON_DATADIR` (=/usr/local/share/clixon) need to be in the list
1163    * `CLICON_YANG_MAIN_FILE` Provides a filename with a single module filename.
1164    * `CLICON_YANG_MAIN_DIR` Provides a directory where all yang modules should be loaded.
1165* NACM (RFC8341)
1166  * Incoming RPC Message validation is supported (See sec 3.4.4 in RFC8341)
1167  * Data Node Access validation is supported (3.4.5), _except_:
1168    * rule-type data-node `path` statements
1169  * Outgoing notification authorization is _not_ supported (3.4.6)
1170  * RPC:s are supported _except_:
1171    * `copy-config`for other src/target combinations than running/startup (3.2.6)
1172    * `commit` - NACM is applied to candidate and running operations only (3.2.8)
1173  * Client-side RPC:s are _not_ supported. That is, RPC code that runs in Netconf, Restconf or CLI clients.
1174  * Recovery user `_nacm_recovery` added.
1175  * The NACM support is ongoing work and needs performance enhancements and further testing.
1176* Change GIT branch handling to a single working master branch
1177  * Develop branched abandoned
1178  * [Clixon Travis CI]([https://travis-ci.org/clicon/clixon]) continuous integration is now supported.
1179* Clixon Alpine-based containers
1180  * [Clixon base container](docker/base).
1181  * [Clixon system and test container](docker/system) used in Travis CI.
1182  * See also: [Clixon docker hub](https://hub.docker.com/u/clixon)
1183
1184### API changes on existing features (you may need to change your code)
1185* XML namespace handling is corrected (see [#major-changes])
1186  * For backward compatibility set config option  CLICON_XML_NS_LOOSE
1187  * You may have to manually upgrade existing database files, such as startup-db or persistent running-db, or any other saved XML file.
1188* Stricter Yang validation (see (#major-changes)):
1189  * Many hand-crafted validation messages have been removed and replaced with generic validations, which may lead to changed rpc-error messages.
1190  * Choice validation. Example: In `choice c{ mandatory true; leaf x; }`, `x` was not previously enforced but is now.
1191* Change all `@datamodel:tree` to `@datamodel` in all CLI specification files
1192  * More specifically, to the string in new config option: CLICON_CLI_MODEL_TREENAME which has `datamodel` as default.
1193  * Only applies if CLI code is generated, ie, `CLIXON_CLI_GENMODEL` is true.
1194* Add `<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>` to your configuration file, or corresponding CLICON_DATADIR directory for Clixon system yang files.
1195* Date-and-time type now properly uses ISO 8601 UTC timezone designators.
1196  * Eg `2008-09-21T18:57:21.003456` is changed to `2008-09-21T18:57:21.003456Z`
1197* CLICON_XML_SORT option (in clixon-config.yang) has been removed and set to true permanently. Unsorted XML lists leads to slower performance and old obsolete code can be removed.
1198* Added `username` argument to `xmldb_put()` datastore function for NACM data-node write checks
1199* Rearranged yang files
1200  * Moved and updated all standard ietf and iana yang files from example and yang/ to `yang/standard`.
1201  * Moved clixon yang files from yang to `yang/clixon`
1202  * New configure option to disable standard yang files: `./configure --disable-stdyangs`
1203    * This is to make it easier to use standard IETF/IANA yang files in separate directory
1204  * Renamed example yang from example.yang -> clixon-example.yang
1205* Switched the order of `error-type` and `error-tag` in all netconf and restconf error messages to comply to RFC order.
1206* Removed `delete-config` support for candidate db since it is not supported in RFC6241.
1207* Renamed yang file `ietf-netconf-notification.yang` to `clixon-rfc5277.yang`.
1208  * Fixed validation problems, see [https://github.com/clicon/clixon/issues/62]
1209  * Name confusion, the file is manually constructed from the rfc.
1210  * Changed prefix to `ncevent`
1211* Yang parser functions have changed signatures. Please check the source if you call these functions.
1212
1213### Minor changes
1214* Better XML parser conformance to W3 spec
1215  * Names lexically correct (NCName)
1216  * Syntactically Correct handling of '<?' (processing instructions) and '<?xml' (XML declaration)
1217  * XML prolog syntax for 'well-formed' XML
1218  * `<!DOCTYPE` (ie DTD) is not supported.
1219* Command-line options:
1220  * Added -o "<option>=<value>" command-line option to all programs: backend, cli, netconf, restconf. Any config option from file can be overrided by giving them on command-line.
1221  * Added -p <dir> command-line option to all programs: backend, cli, netconf, restconf. Adds a new dir to the yang path dir. (same as -o CLICON_YANG_DIR=<dir>)
1222    * `clixon_cli -p` (printspec) obsolete and replaced
1223  * `clixon_cli -x` is obsolete and removed.
1224* Added experimental config option `CLICON_CLI_UTF8` default set to 0. Does not work with scrolling and control editing, see (https://github.com/olofhagsand/cligen/issues/21)
1225* Added valgrind memory leak tests in testmem.sh for cli, netconf, restconf and backend
1226  * To run with backend for example: `mem.sh backend`
1227* Keyvalue datastore removed (it has been disabled since 3.3.3)
1228* Added clicon_socket_set() and clicon_socket_get() functions for cleaning up backend server and restconf FCGI socket on termination.
1229* clixon-config YAML file has new revision: 2019-02-06.
1230* Added new log function: `clicon_log_xml()` for logging XML tree to syslog
1231* Replaced all calls to (obsolete) `cli_output` with `fprintf`
1232* Added `make test` from top-level Makefile
1233* Added `xml_rootchild_node()` lib function as variant of `xml_rootchild()`
1234* Added new clixon-lib yang module for internal netconf protocol. Currently only extends the standard with a debug RPC.
1235* Added three-valued return values for several validate functions where -1 is fatal error, 0 is validation failed and 1 is validation OK.
1236  * This includes: `xmldb_put`, `xml_yang_validate_all`, `xml_yang_validate_add`, `xml_yang_validate_rpc`, `api_path2xml`, `api_path2xpath`
1237* Added new xml functions for specific types: `xml_child_nr_notype`, `xml_child_nr_notype`, `xml_child_i_type`, `xml_find_type`.
1238* Added `example_rpc` RPC to example backend
1239* Renamed `xml_namespace()` and `xml_namespace_set()` to `xml_prefix()` and `xml_prefix_set()`, respectively.
1240* Changed all make tags --> make TAGS
1241
1242### Corrected Bugs
1243* [Issue with bare axis names](https://github.com/clicon/clixon/issues/54)
1244* Did not check for missing keys in validate. [Key of a list isn't mandatory](https://github.com/clicon/clixon/issues/73)
1245  * Problem here is that you can still add keys via netconf - since validation is a separate step, but in cli or restconf it should not be possible.
1246* Partially corrected: [yang type range statement does not support multiple values](https://github.com/clicon/clixon/issues/59).
1247  * Should work for netconf and restconf, but not for CLI.
1248* [Range parsing is not RFC 7950 compliant](https://github.com/clicon/clixon/issues/71)
1249* `xml_cmp()` compares numeric nodes based on string value [https://github.com/clicon/clixon/issues/64]
1250* `xml_cmp()` respects 'ordered-by user' for state nodes, which violates RFC 7950 [https://github.com/clicon/clixon/issues/63]. (Thanks JDL)
1251* XML<>JSON conversion problems [https://github.com/clicon/clixon/issues/66]
1252  * CDATA sections stripped from XML when converted to JSON
1253* Restconf returns error when RPC generates "ok" reply [https://github.com/clicon/clixon/issues/69]
1254* XSD regular expression support for character classes [https://github.com/clicon/clixon/issues/68]
1255  * Added support for \c, \d, \w, \W, \s, \S.
1256* Removing newlines from XML data [https://github.com/clicon/clixon/issues/65]
1257* Fixed [ietf-netconf-notification@2008-07-01.yang validation problem #62](https://github.com/clicon/clixon/issues/62)
1258* Ignore CR(\r) in yang files for DOS files
1259* Keyword "min" (not only "max") can be used in built-in types "range" and "length" statements.
1260* Support for empty yang string added, eg `default "";`
1261* Removed CLI generation for yang notifications (and other non-data yang nodes)
1262* Some restconf error messages contained `rpc-reply` or `rpc-error` which have now been removed.
1263* getopt return value changed from char to int (https://github.com/clicon/clixon/issues/58)
1264* Netconf/Restconf RPC extra input arguments are ignored (https://github.com/clicon/clixon/issues/47)
1265
1266## 3.8.0
12676 Nov 2018
1268
1269### Major New features
1270* YANG Features
1271  * Yang 1.1 feature and if-feature according to RFC 7950 7.20.1 and 7.20.2.
1272  * See https://github.com/clicon/clixon/issues/41
1273  * Features are declared via CLICON_FEATURE in the configuration file. Example below shows enabling (1) a specific feature; (2) all features in a module; (3) all features in all modules:
1274   ```
1275      <CLICON_FEATURE>ietf-routing:router-id</CLICON_FEATURE>
1276      <CLICON_FEATURE>ietf-routing:*</CLICON_FEATURE>
1277      <CLICON_FEATURE>*:*</CLICON_FEATURE>
1278   ```
1279  * logical combination of features not implemented, eg if-feature "not foo or bar and baz";
1280  * ietf-netconf yang module added with candidate, validate, startup and xpath features enabled.
1281* YANG module library
1282  * YANG modules according to RFC 7895 and implemented by ietf-yang-library.yang
1283  * Enabled by configuration option CLICON_MODULE_LIBRARY_RFC7895 - enabled by default
1284  * RFC 7895 defines a module-set-id. Configure option CLICON_MODULE_SET_ID is set and changed when modules change.
1285* Yang 1.1 notification support (RFC 7950: Sec 7.16)
1286* New event streams implementation with replay
1287  * Generic stream support (both CLI, Netconf and Restconf)
1288  * Added stream discovery according to RFC 5277 for netconf and RFC 8040 for restconf
1289    * Enabled by configure options CLICON_STREAM_DISCOVERY_RFC5277 and CLICON_STREAM_DISCOVERY_RFC8040
1290  * Configure option CLICON_STREAM_RETENTION is default number of seconds before dropping replay buffers
1291  * See clicon_stream.[ch] for details
1292  * Restconf stream notification support according to RFC8040
1293    * start-time and stop-time query parameters
1294
1295    * Fork fcgi handler for multiple concurrent streams
1296    * Set access/subscribe base URL with: CLICON_STREAM_URL (default "https://localhost") and CLICON_STREAM_PATH (default "streams")
1297    * Replay support: start-time and stop-time query parameter support
1298    * See [apps/restconf/README.md] for more details.
1299  * Alternative restconf streams using pub/sub enabled by ./configure --enable-publish
1300    * Set publish URL base with: CLICON_STREAM_PUB (default http://localhost/pub)
1301  * RFC5277 Netconf replay supported
1302  * Replay support is only in-memory and not persistent. External time-series DB could be added.
1303
1304### API changes on existing features (you may need to change your code)
1305* Netconf hello capability updated to YANG 1.1 RFC7950 Sec 5.6.4
1306  * Added urn:ietf:params:netconf:capability:yang-library:1.0
1307  * Thanks @SCadilhac for helping out, see https://github.com/clicon/clixon/issues/39
1308* Major rewrite of event streams (as described above)
1309  * If you used old event callbacks API, you need to switch to the streams API
1310    * See clixon_stream.[ch]
1311  * Old streams API which needs to be modified:
1312    * clicon_log_register_callback() removed
1313    * subscription_add() --> stream_add()
1314    * stream_cb_add() --> stream_ss_add()
1315    * stream_cb_delete() --> stream_ss_delete()
1316    * backend_notify() and backend_notify_xml() - use stream_notify() instead
1317  * Example uses "NETCONF" stream instead of "ROUTING"
1318* clixon_restconf and clixon_netconf changed command-line option from -D to -D `<level>`  aligning with cli and backend
1319
1320* Unified log handling for all clicon applications using command-line option: `-l e|o|s|f<file>`.
1321  * The options stand for e:stderr, o:stdout, s: syslog, f:file
1322  * Added file logging (`-l f` or `-l f<file>`) for cases where neither syslog nor stderr is usefpul.
1323  * clixon_netconf -S is obsolete. Use `clixon_netconf -l s` instead.
1324* Comply to RFC 8040 3.5.3.1 rule: api-identifier = [module-name ":"] identifier
1325  * The "module-name" was a no-op before.
1326  * This means that there was no difference between eg: GET /restconf/data/ietf-yang-library:modules-state and GET /restconf/data/foobar:modules-state
1327* Generilized top-level yang parsing functions
1328  * Clarified semantics of main yang module:
1329    * Command-line option -y MUST specify a filename
1330    * Configure option CLICON_YANG_MODULE_MAIN MUST specify a module name
1331    * yang_parse() changed to take either filename or module name and revision.
1332  * Removed clicon_dbspec_name() and clicon_dbspec_name_set().
1333  * Replace calls to yang_spec_main() with yang_spec_parse_module(). See for
1334    example backend_main() and others if you need details.
1335
1336### Minor changes
1337* Added cache for modules-state RFC7895 to avoid building new XML every get call
1338* Renamed test/test_auth*.sh tests to test/test_nacm*.sh
1339* YANG keywords "action" and "belongs-to" implemented by syntactically by parser (but not proper semantics).
1340* clixon-config YAML file has new revision: 2018-10-21.
1341* Allow new lines in CLI prompts
1342* uri_percent_encode() and xml_chardata_encode() changed to use stdarg parameters
1343* Added Configure option CLIXON_DEFAULT_CONFIG=/usr/local/etc/clixon.xml as option and in example (so you dont need to provide -f command-line option).
1344* New function: clicon_conf_xml() returns configuration tree
1345* Obsoleted COMPAT_CLIV and COMPAT_XSL that were optional in 3.7
1346* Added command-line option `-t <timeout>` for clixon_netconf - quit after max time.
1347
1348### Corrected Bugs
1349* No space after ampersand escaped characters in XML https://github.com/clicon/clixon/issues/52
1350  * Thanks @SCadilhac
1351* Single quotes for XML attributes https://github.com/clicon/clixon/issues/51
1352  * Thanks @SCadilhac
1353* Fixed https://github.com/clicon/clixon/issues/46 Issue with empty values in leaf-list
1354  * Thanks @achernavin22
1355* Identity without any identityref:s caused SEGV
1356* Memory error in backend transaction revert
1357* Set dir /www-data with www-data as owner, see https://github.com/clicon/clixon/issues/37
1358
1359### Known issues
1360* Netconf/Restconf RPC extra input arguments are ignored
1361  * https://github.com/clicon/clixon/issues/47
1362* Yang sub-command cardinality not checked.
1363  * https://github.com/clicon/clixon/issues/48
1364* Issue with bare axis names (XPath 1.0)
1365  * https://github.com/clicon/clixon/issues/54
1366* Top-level Yang symbol cannot be called "config" in any imported yang file.
1367  * datastore uses "config" as reserved keyword for storing any XML whoich collides with code for detecting Yang sanity.
1368* Namespace name relabeling is not supported.
1369  * Eg: if "des" is defined as prefix for an imported module, then a relabeling using xmlns is not supported, such as:
1370```
1371    <crypto xmlns:x="urn:example:des">x:des3</crypto>
1372```
1373
1374## 3.7.0
137522 July 2018
1376
1377### Major New features
1378
1379* YANG "must" and "when" Xpath-basedconstraints according to RFC 7950 Sec 7.5.3 and 7.21.5.
1380  * Must and when Xpath constrained checked at validation/commit.
1381* YANG "identity" and "identityref", according to RFC 7950 Sec 7.18 and 9.10.
1382  * Identities checked at validation/commit.
1383  * CLI completion support of identity values.
1384  * Example extended with iana-if-type RFC 7224 interface identities.
1385* Improved support for XPATH 1.0 according to https://www.w3.org/TR/xpath-10 using yacc/lex,
1386  * Full suport of boolean constraints for "when"/"must", not only nodesets.
1387  * See also API changes below.
1388* CDATA XML support (patch by David Cornejo, Netgate)
1389  * Encode and decode (parsing) support
1390* Added cligen variable translation. Useful for processing input such as hashing, encryption.
1391  * More info in example and FAQ.
1392  * Example:
1393```
1394cli> translate value HAL
1395cli> show configuration
1396translate {
1397    value IBM;
1398}
1399```
1400### API changes on existing features (you may need to change your code)
1401
1402* YANG identity, identityref, must, and when validation support may cause applications that had not strictly enforced identities and constraints before.
1403* Restconf operations changed from prefix to module name.
1404  * Proper specification for an operation is POST /restconf/operations/<module_name>:<rpc_procedure> HTTP/1.1
1405  * See https://github.com/clicon/clixon/issues/31, https://github.com/clicon/clixon/pull/32 and https://github.com/clicon/clixon/issues/30
1406  * Thanks David Cornejo and Dmitry Vakhrushev of Netgate for pointing this out.
1407* New XPATH 1.0 leads to some API changes and corrections
1408  * Due to an error in the previous implementation, all XPATH calls on the form `x[a=str]` where `str` is a string (not a number or XML symbol), must be changed to: `x[a='str'] or x[a="str"]`
1409  * This includes all calls to `xpath_vec, xpath_first`, etc.
1410  * In CLI specs, calls to cli_copy_config() must change 2nd argument from `x[%s=%s]` to `x[%s='%s']`
1411  * In CLI specs, calls to cli_show_config() may need to change third argument, eg
1412    * `cli_show_config("running","text","/profile[name=%s]","name")` to `cli_show_config("running","text","/profile[name='%s']","name")`
1413  * xpath_each() is removed
1414  * The old API can be enabled by setting COMPAT_XSL in include/clixon_custom.h and recompile.
1415
1416* Makefile change: Removed the make include file: clixon.mk and clixon.mk.in
1417  * These generated the Makefile variables: clixon_DBSPECDIR, clixon_SYSCONFDIR, clixon_LOCALSTATEDIR, clixon_LIBDIR, clixon_DATADIR which have been replaced by generic autoconf variables instead.
1418
1419* Removed cli callback vector functions. Set COMPAT_CLIV if you need to keep these functions in include/clixon_custom.h.
1420  * Replace functions as follows in CLI SPEC files:
1421  * cli_setv --> cli_set
1422  * cli_mergev --> cli_merge
1423  * cli_delv --> cli_del
1424  * cli_debug_cliv --> cli_debug_cli
1425  * cli_debug_backendv --> cli_debug_backend
1426  * cli_set_modev --> cli_set_mode
1427  * cli_start_shellv --> cli_start_shell
1428  * cli_quitv --> cli_quit
1429  * cli_commitv --> cli_commit
1430  * cli_validatev --> cli_validate
1431  * compare_dbsv --> compare_dbs
1432  * load_config_filev --> load_config_file
1433  * save_config_filev --> save_config_file
1434  * delete_allv --> delete_all
1435  * discard_changesv --> discard_changes
1436  * cli_notifyv --> cli_notify
1437  * show_yangv --> show_yang
1438  * show_confv_xpath --> show_conf_xpath
1439
1440* Changed `plugin_init()` backend return semantics: If returns NULL, _without_ calling clicon_err(), the module is disabled.
1441
1442### Minor changes
1443
1444* Clixon docker upgrade
1445  * Updated the docker image build and example to a single clixon docker image.
1446  * Example pushed to https://hub.docker.com/r/olofhagsand/clixon_example/
1447* Added systemd example files under example/systemd
1448* Added util subdir, with dedicated standalone xml, json, yang and xpath parser utility test programs.
1449* Validation of yang bits type space-separated list value
1450* Added -U <user> command line to clixon_cli and clixon_netconf for changing user.
1451  * This is primarily for NACM pseudo-user tests
1452* Added a generated CLI show command that works on the generated parse tree with auto completion.
1453  * A typical call is: 	show @datamodel:example, cli_show_auto("candidate", "json");
1454  * The example contains a more elaborate example.
1455  * Thanks ngashok for request, see https://github.com/clicon/clixon/issues/24
1456* Added XML namespace (xmlns) validation
1457  * for eg <a xmlns:x="uri"><x:b/></a>
1458* ./configure extended with --enable-debug flag
1459  * CFLAGS=-g ./configure deprecated
1460
1461### Corrected Bugs
1462* Prefix of rpc was ignored (thanks Dmitri at netgate)
1463  * https://github.com/clicon/clixon/issues/30
1464* Added cli return value also for single commands (eg -1)
1465* Fixed JSON unbalanced braces resulting in assert.
1466
1467### Known issues
1468* Namespace name relabeling is not supported.
1469  * Eg: if "des" is defined as prefix for an imported module, then a relabeling using xmlns is not supported, such as:
1470```
1471  <crypto xmlns:x="urn:example:des">x:des3</crypto>
1472```
1473
1474
1475## 3.6.0
147630 April 2018
1477
1478### Major changes:
1479* Experimental NACM RFC8341 Network Configuration Access Control Model, see [NACM](README_NACM.md).
1480  * New CLICON_NACM_MODE config option, default is disabled.
1481  * New CLICON_NACM_FILE config option, if CLICON_NACM_MODE is "external"
1482  * Added username attribute to all internal RPC:s from frontend to backend
1483  * Added NACM backend module in example
1484* Restructure and more generic plugin API for cli, backend, restconf, and netconf. See example further down and the [example](example/README.md)
1485  * Changed `plugin_init()` to `clixon_plugin_init()` returning an api struct with function pointers. There are no other hardcoded plugin functions.
1486  * Master plugins have been removed. Plugins are loaded alphabetically. You can ensure plugin load order by prefixing them with an ordering number, for example.
1487  * Plugin RPC callback interface have been unified between backend, netconf and restconf.
1488    * Backend RPC register callback function (Netconf RPC or restconf operation POST) has been changed from:
1489           `backend_rpc_cb_register()` to `rpc_callback_register()`
1490    * Backend RPC callback signature has been changed from:
1491           `int cb(clicon_handle h, cxobj *xe, struct client_entry *ce, cbuf *cbret, void *arg)`
1492       to:
1493            `int cb(clicon_handle h, cxobj *xe, struct client_entry *ce, cbuf *cbret, void *arg)`
1494    * Frontend netconf and restconf plugins can register callbacks as well with same API as backends.
1495  * Moved specific plugin functions from apps/ to generic functions in lib/
1496  * New config option CLICON_BACKEND_REGEXP to match backend plugins (if you do not want to load all).
1497  * Added authentication plugin callback (ca_auth)
1498    * Added clicon_username_get() / clicon_username_set()
1499  * Removed some obscure plugin code that seem not to be used (please report if needed!)
1500    * CLI parse hook
1501    * CLICON_FIND_PLUGIN
1502    * clicon_valcb()
1503    * CLIXON_BACKEND_SYSDIR
1504    * CLIXON_CLI_SYSDIR
1505    * CLICON_MASTER_PLUGIN config variable
1506  * Example of migrating a backend plugin module:
1507    * Add all callbacks in a clixon_plugin_api struct
1508    * Rename plugin_init() -> clixon_plugin_init() and return api as function value
1509    * Rename backend_rpc_cb_register() -> rpc_callback_register() for any RPC/restconf operation POST calls
1510```
1511/* This is old style with hardcoded function names (eg plugin_start) */
1512int plugin_start(clicon_handle h, int argc, char **argv)
1513{
1514    return 0;
1515}
1516int
1517plugin_init(clicon_handle h)
1518{
1519   return 0;
1520}
1521
1522/* This is new style with all function names in api struct */
1523clixon_plugin_api *clixon_plugin_init(clicon_handle h);
1524
1525static clixon_plugin_api api = {
1526    "example",           /* name */
1527    clixon_plugin_init,  /* init */
1528    NULL,                /* start */
1529    NULL,                /* exit */
1530    .ca_auth=plugin_credentials   /* restconf specific: auth */
1531};
1532
1533clixon_plugin_api *clixon_plugin_init(clicon_handle h)
1534{
1535    return &api; /* Return NULL on error */
1536}
1537```
1538
1539* Builds and installs a new restconf library: `libclixon_restconf.so` and clixon_restconf.h
1540  * The restconf library can be included by a restconf plugin.
1541  * Example code in example/Makefile.in and example/restconf_lib.c
1542* Restconf error handling for get, put and post. (thanks Stephen Jones, Netgate)
1543  * Available both as xml and json (set accept header).
1544* Proper RFC 6241 Netconf error handling
1545  * New functions added in clixon_netconf_lib.[ch]
1546  * Datastore code modified for RFC 6241
1547
1548### Minor changes:
1549
1550* INSTALLFLAGS added with default value -s(strip).
1551  * For debug do: CFLAGS=-g INSTALLFLAGS= ./configure
1552* plugin_start() callbacks added for restconf
1553* Authentication
1554  * Example extended with http basic authentication for restconf
1555  * Documentation in FAQ.md
1556* Updated ietf-netconf-acm to ietf-netconf-acm@2018-02-14.yang from RFC 8341
1557* The Clixon example has changed name from "routing" to "example" affecting all config files, plugins, tests, etc.
1558  * Secondary backend plugin added
1559* Removed username to rpc calls (added below)
1560* README.md extended with new yang, netconf, restconf, datastore, and auth sections.
1561* The key-value datastore is no longer supported. Use the default text datastore.
1562* Added username to rpc calls to prepare for authorization for backend:
1563  * clicon_rpc_config_get(h, db, xpath, xt) --> clicon_rpc_config_get(h, db, xpath, username, xt)
1564  * clicon_rpc_get(h, xpath, xt) --> clicon_rpc_get(h, xpath, username, xt)
1565* Experimental: Added CLICON_TRANSACTION_MOD configuration option. If set,
1566  modifications in validation and commit callbacks are written back
1567  into the datastore. Requested by Stephen Jones, Netgate.
1568* Invalid key to api_path2xml gives warning instead of error and quit.
1569* Added restconf/operations get, see RFC8040 Sec 3.3.2:
1570* yang_find_topnode() and api_path2xml() schemanode parameter replaced with yang_class. Replace as follows: 0 -> YC_DATANODE, 1 -> YC_SCHEMANODE
1571
1572* xml2json: include prefix in translation, so <a:b> is translated to {"a:b" ..}
1573* Use `<config>` instead of `<data>` when save/load configuration to file. This
1574enables saved files to be used as datastore without any editing. Thanks Matt, Netgate.
1575
1576* Added Yang "extension" statement. This includes parsing unknown
1577  statements and identifying them as extensions or not. However,
1578  semantics for specific extensions must still be added.
1579
1580* Renamed ytype_id and ytype_prefix to yarg_id and yarg_prefix, respectively
1581
1582* Added cli_show_version()
1583
1584### Corrected Bugs
1585* Showing syntax using CLI commands was broekn and is fixed.
1586* Fixed issue https://github.com/clicon/clixon/issues/18 RPC response issues reported by Stephen Jones at Netgate
1587* Fixed issue https://github.com/clicon/clixon/issues/17 special character in strings can break RPCs reported by David Cornejo at Netgate.
1588  * This was a large rewrite of XML parsing and output due to CharData not correctly encoded according to https://www.w3.org/TR/2008/REC-xml-20081126.
1589* Fixed three-key list entry problem (reported by jdl@netgate)
1590* Translate xml->json \n correctly
1591* Fix issue: https://github.com/clicon/clixon/issues/15 Replace whole config
1592
1593## 3.6.1
159429 May 2018
1595
1596### Corrected Bugs
1597* https://github.com/clicon/clixon/issues/23 clixon_cli failing with error
1598  * The example included a reference to nacm yang file which did not exist and was not used
1599* Added clixon-config@2018-04-30.yang
1600
1601## 3.5.0
160212 February 2018
1603
1604### Major changes:
1605* Major Restconf feature update to comply to RFC 8040. Thanks Stephen Jones of Netgate for getting right.
1606  * GET: Always return object referenced (and nothing else). ie, GET /restconf/data/X returns X.
1607  * GET Added support for the following resources: Well-known, top-level resource, and yang library version,
1608  * GET Single element JSON lists use {list:[element]}, not {list:element}.
1609  * PUT Whole datastore
1610
1611### Minor changes:
1612
1613* Changed signature of plugin_credentials() restconf callback. Added a "user" parameter. To enable authentication and in preparation for access control a la RFC 6536.
1614* Added RFC 6536 ietf-netconf-acm@2012-02-22.yang access control (but not implemented).
1615* The following backward compatible options to configure have been _obsoleted_. If you havent already migrated this code you must do this now.
1616  * `configure --with-startup-compat`. Configure option CLICON_USE_STARTUP_CONFIG is also obsoleted.
1617  * `configure --with-config-compat`. The template clicon.conf.cpp files are also removed.
1618  * `configure --with-xml-compat`
1619
1620* New configuration option: CLICON_RESTCONF_PRETTY. Default true. Set to false to get more compact Restconf output.
1621
1622* Default configure file handling generalized by Renato Botelho/Matt Smith. Config file FILE is selected in the following priority order:
1623  * Provide -f FILE option when starting a program (eg clixon_backend -f FILE)
1624  * Provide --with-configfile=FILE when configuring
1625  * Provide --with-sysconfig=<dir> when configuring, then FILE is <dir>/clixon.xml
1626  * Provide --sysconfig=<dir> when configuring then FILE is <dir>/etc/clixon.xml
1627  * FILE is /usr/local/etc/clixon.xml
1628
1629### Corrected Bugs
1630* yang max keyword was not supported for string type. Corrected by setting "max" to MAXPATHLEN
1631* Corrected "No yang spec" printed on tty when using leafref in CLI.
1632* Fixed error in xml2cvec. If a (for example) int8 value has range error (eg 1000), it was treated as an error and the program terminated. Now this is just logged and skipped. Reported by Fredrik Pettai.
1633
1634### Known issues
1635
1636## 3.4.0
16371 January 2018
1638
1639### Major changes:
1640* Optimized search performance for large lists by sorting and binary search.
1641  * New CLICON_XML_SORT configuration option. Default is true. Disable by setting to false.
1642  * Added yang ordered-by user. The default (ordered-by system) will now sort lists and leaf-lists alphabetically to increase search performance. Note that this may change outputs.
1643  * If you need legacy order, either set CLICON_XML_SORT to false, or set that list to "ordered-by user".
1644  * This replaces XML hash experimental code, ie xml_child_hash variables and all xmlv_hash_ functions have been removed.
1645  * Implementation detail: Cached keys are stored in in yang Y_LIST nodes as cligen vector, see ys_populate_list()
1646
1647* Datastore cache introduced: cache XML tree in memory for faster get access.
1648  * Reads are cached. Writes are written to disk.
1649  * New CLICON_XMLDB_CACHE configuration option. Default is true. To disable set to false.
1650  * With cache, you cannot have multiple backends (with single datastore). You need to have a single backend.
1651  * Thanks netgate for proposing this.
1652
1653* Changed C functional API for XML creation and parsing for better coherency and closer YANG/XML integration. This may require your action.
1654  * New yang spec parameter has been added to most functions (default NULL) and functions have been removed and renamed. You may need to change the XML calls as follows.
1655  * xml_new(name, parent) --> xml_new(name, xn_parent, yspec)
1656  * xml_new_spec(name, parent, spec) --> xml_new(name, parent, spec)
1657  * clicon_xml_parse(&xt, format, ...) --> xml_parse_va(&xt, yspec, format, ...)
1658  * clicon_xml_parse_file(fd, &xt, endtag) --> xml_parse_file(fd, endtag, yspec, &xt)
1659  * clicon_xml_parse_string(&str, &xt) --> xml_parse_string(str, yspec, &xt)
1660  * clicon_xml_parse_str(str, &xt) --> xml_parse_string(str, yspec, &xt)
1661  * xml_parse(str, xt) --> xml_parse_string(str, yspec, &xt)
1662  * Backward compatibility is enabled by (will be removed in 3.5.0:
1663  ```
1664      configure --with-xml-compat
1665  ```
1666
1667### Minor changes:
1668* Better semantic versioning, eg MAJOR/MINOR/PATCH, where increment in PATCH does not change API.
1669* Added CLICON_XMLDB_PRETTY option. If set to false, XML database files will be more compact.
1670* Added CLICON_XMLDB_FORMAT option. Default is "xml". If set to "json", XML database files uses JSON format.
1671* Clixon_backend now returns -1/255 on error instead of 0. Useful for systemd restarts, for example.
1672* Experimental: netconf yang rpc. That is, using ietf-netconf@2011-06-01.yang
1673  formal specification instead of hardcoded C-code.
1674
1675### Corrected Bugs
1676* Fixed bug that deletes running on startup if backup started with -m running.
1677  When clixon starts again, running is lost.
1678  The error was that the running (or startup) configuration may fail when
1679  clixon backend starts.
1680  The fix now makes a copy of running and copies it back on failure.
1681* datastore/keyvalue/Makefile was left behind on make distclean. Fixed by conditional configure. Thanks renato@netgate.com.
1682* Escape " in JSON names and strings and values
1683
1684### Known issues
1685* Please use text datastore, key-value datastore no up-to-date
1686
1687## 3.3.3
168825 November 2017
1689
1690Thanks to Matthew Smith, Joe Loeliger at Netgate; Fredrik Pettai at
1691SUNET for support, requests, debugging, bugfixes and proposed solutions.
1692
1693### Major changes:
1694* Performance improvements
1695  * Added xml hash lookup instead of linear search for better performance of large lists. To disable, undefine XML_CHILD_HASH in clixon_custom.h
1696  * Netconf client was limited to 8K byte messages. New limit is 2^32 bytes.
1697
1698* XML and YANG-based configuration file.
1699  * New configuration files have .xml suffix, old have .conf.
1700  * The yang model is yang/clixon-config.yang.
1701  * You can run backward compatible mode using `configure --with-config-compat`
1702  * In backward compatible mode both .xml and .conf works
1703  * For migration from old to new, a utility is clixon_cli -x to print new format. Run the command and save in configuration file with .xml suffix instead.
1704  ```
1705    > clixon_cli -f /usr/local/etc/example.conf -1x
1706    <config>
1707        <CLICON_CONFIGFILE>/usr/local/etc/example.xml</CLICON_CONFIGFILE>
1708        <CLICON_YANG_DIR>/usr/local/share/example/yang</CLICON_YANG_DIR>
1709        <CLICON_BACKEND_DIR>/usr/local/lib/example/backend</CLICON_BACKEND_DIR>
1710	...
1711   </config>
1712  ```
1713
1714* Simplified backend daemon startup modes.
1715  * The flags -IRCr are replaced with command-line option -s <mode>
1716  * You use the -s to select the mode. Example: `clixon_backend -s running`
1717  * You may also add a default method in the configuration file: `<CLICON_STARTUP_MODE>init</CLICON_STARTUP_MODE>`
1718  * The configuration option CLICON_USE_STARTUP_CONFIG is obsolete
1719  * Command-ine option `-I` is replaced with `-s init`
1720  * `-CIr` is replaced with `-s running`
1721  * Use `-s none` if you request no action on startu
1722  * Backward compatibility is enabled by:
1723  ```
1724      configure --with-startup-compat
1725  ```
1726  * You can run in backward compatible mode where both -IRCr and -s options works. But if -s is given, -IRCr options willbe ignored.
1727
1728* Extra XML has been added along with the new startup modes. Requested by Netgate.
1729  * You can add extra XML with the -c option to the backend daemon on startup:
1730  ```
1731      clixon_backend ... -c extra.xml
1732   ```
1733  * You can also add extra XML by programming the plugin_reset() in the backend
1734plugin. The example application shows how.
1735
1736* Clixon can now be compiled and run on Apple Darwin. Thanks SUNET.
1737
1738### Minor changes:
1739* Fixed DESTDIR make install/uninstall and break immediately on errors
1740* Disabled key-value datastore. Enable with --with-keyvalue
1741* Removed mandatory requirements for BACKEND, NETCONF, RESTCONF and CLI dirs in the configuration file. If these are not given, no plugins will be loaded of that type.
1742
1743* Restconf: http cookie sent as attribute in rpc restconf_post operations to backend as "id" XML attribute.
1744* Added option CLICON_CLISPEC_FILE as complement to CLICON_CLISPEC_DIR to
1745  specify single CLI specification file, not only directory containing files.
1746
1747* Replaced the following cli_ functions with their original cligen_functions:
1748	cli_exiting, cli_set_exiting, cli_comment,
1749	cli_set_comment, cli_tree_add, cli_tree_active,
1750	cli_tree_active_set, cli_tree.
1751
1752* Added a format parameter to clicon_rpc_generate_error() and changed error
1753  printouts for backend errors, such as commit and validate. (Thanks netgate).
1754  Example of the new format:
1755
1756```
1757  > commit
1758  Sep 27 18:11:58: Commit failed. Edit and try again or discard changes:
1759  protocol invalid-value Missing mandatory variable: type
1760```
1761
1762* Added event_poll() function to check if data is available on specific file descriptor.
1763
1764* Support for non-line scrolling in CLI, eg wrap lines. Thanks to Jon Loeliger for proposed solution. Set in configuration file with:
1765  <CLICON_CLI_LINESCROLLING>0</CLICON_CLI_LINESCROLLING>
1766
1767### Corrected Bugs
1768* Added floating point and negative number support to JSON
1769* When user callbacks such as statedata() call returns -1, clixon_backend no
1770  longer silently exits. Instead a log is printed and an RPC error is returned.
1771  Cred to Matt, netgate for pointing this out.
1772
1773## 3.3.2
1774Aug 27 2017
1775
1776### Known issues
1777* Please use text datastore, key-value datastore no up-to-date
1778* leafref occuring within lists: cli expansion does not work
1779
1780### Major changes:
1781* Added support for YANG anyxml.
1782
1783* Changed top-level netconf get-config and get to return `<data>` instead of `<data><config>` to comply to the RFC.
1784  * If you use direct netconf get or get-config calls, you may need to handle the return XML differently.
1785  * RESTCONF and CLI is not affected.
1786  * Example:
1787
1788```
1789  Query:
1790    <rpc><get/></rpc>
1791  New reply:
1792    <rpc-reply>
1793       <data>
1794          <a/> # Example data model
1795       </data>
1796    </rpc-reply>
1797
1798  Old reply:
1799    <rpc-reply>
1800       <data>
1801          <config>  # Removed
1802             <a/>
1803          </config> # Removed
1804       </data>
1805    </rpc-reply>
1806```
1807
1808* Added support for yang presence and no-presence containers. Previous default was "presence".
1809  * Empty containers will be removed unless you have used the "presence" yang declaration.
1810  * Example YANG without presence:
1811
1812```
1813     container
1814        nopresence {
1815          leaf j {
1816             type string;
1817          }
1818     }
1819```
1820
1821If you submit "nopresence" without a leaf, it will automatically be removed:
1822
1823```
1824     <nopresence/> # removed
1825     <nopresence>  # not removed
1826        <j>hello</j>
1827     </nopresence>
1828```
1829
1830* Added YANG RPC support for netconf, restconf and CLI. With example rpc documentation and testcase. This replaces the previous "downcall" mechanism.
1831  * This means you can make netconf/restconf rpc calls
1832  * However you need to register an RPC backend callback using the backend_rpc_cb_register() function. See documentation and example for more details.
1833  * Example, the following YANG RPC definition enables you to run a netconf rpc.
1834```
1835    YANG:
1836      rpc myrpc {
1837         input {
1838	   leaf name {
1839	      type string;
1840           }
1841         }
1842      }
1843    NETCONF:
1844      <rpc><myrpc><name>hello</name><rpc>
1845    RESTCONF:
1846      curl -sS -X POST -d {"input":{"name":"hello"}} http://localhost/restconf/operations/myroute'
1847```
1848
1849* Enhanced leafref functionality:
1850  * Validation for leafref forward and backward references;
1851  * CLI completion for generated cli leafrefs for both absolute and relative paths.
1852  * Example, relative path:
1853
1854```
1855         leaf ifname {
1856             type leafref {
1857                 path "../../interface/name";
1858             }
1859         }
1860```
1861
1862* Added state data: Netconf `<get>` operation, new backend plugin callback: "plugin_statedata()" for retreiving state data.
1863  * You can use netconf: `<rpc><get/></rpc>` and it will return both config and state data.
1864  * Restconf GET will return state data also, if defined.
1865  * You need to define state data in a backend callback. See the example and documentation for more details.
1866
1867### Minor Changes
1868* Added xpath support for predicate: current(), eg /interface[name=current()/../name]
1869* Added prefix parsing of xpath, allowing eg /p:x/p:y, but prefix ignored.
1870* Corrected Yang union CLI generation and type validation. Recursive unions did not work.
1871* Corrected Yang pattern type escaping problem, ie '\.' did not work properly. This requires update of cligen as well.
1872* Compliance with RFC: Rename yang xpath to schema_nodeid and syntaxnode to datanode.
1873* Main yang module (CLICON_YANG_MODULE_MAIN or -y) can be an absolute file name.
1874* Removed 'margin' parameter of yang_print().
1875* Extended example with ietf-routing (not only ietf-ip) for rpc operations.
1876* Added yang dir with ietf-netconf and clixon-config yang specs for internal usage.
1877* Fixed bug where cli set of leaf-list were doubled, eg cli set foo -> foofoo
1878* Restricted yang (sub)module file match to match RFC6020 exactly
1879* Generic map_str2int generic mapping tables
1880* Removed vector return values from xmldb_get()
1881* Generalized yang type resolution to all included (sub)modules not just the topmost
1882
1883## 3.3.1
1884June 7 2017
1885
1886* Fixed yang leafref cli completion for absolute paths.
1887
1888* Removed non-standard api_path extension from the internal netconf protocol so that the internal netconf is now fully standard.
1889
1890* Strings in xmldb_put not properly encoded, eg eth/0 became eth.00000
1891
1892## 3.3.0 (May 2017)
1893
1894* Datastore text module is now default.
1895
1896* Refined netconf "none" semantics in tests and text datastore
1897
1898* Moved apps/dbctrl to datastore/
1899
1900* Added connect/disconnect/getopt/setopt and handle to xmldb API
1901
1902* Added datastore 'text'
1903
1904* Configure (autoconf) changes
1905  Removed libcurl dependency
1906  Disable restconf (and fastcgi) with configure --disable-restconf
1907  Disable keyvalue datastore (and qdbm) with configure --disable-keyvalue
1908
1909* Created xmldb plugin api
1910  Moved qdbm, chunk and  xmldb to datastore keyvalue directories
1911  Removed all other clixon dependency on chunk code
1912
1913* cli_copy_config added as generic cli command
1914* cli_show_config added as generic cli command
1915  Replace all show_confv*() and show_conf*() with cli_show_config()
1916  Example: replace:
1917     show_confv_as_json("candidate","/sender");
1918  with:
1919     cli_show_config("candidate","json","/sender");
1920* Alternative yang spec option -y added to all applications
1921* Many clicon special string functions have been removed
1922* The netconf support has been extended with lock/unlock
1923* clicon_rpc_call() has been removed and should be replaced by extending the
1924  internal netconf protocol.
1925  See downcall() function in example/routing_cli.c and
1926  routing_downcall() in example/routing_backend.c
1927* Replace clicon_rpc_xmlput with clicon_rpc_edit_config
1928* Removed xmldb daemon. All xmldb acceses is made backend daemon.
1929  No direct accesses by clients to xmldb API.
1930  Instead use the rpc calls in clixon_proto_client.[ch]
1931  In clients (eg cli/netconf) replace xmldb_get() in client code with
1932  clicon_rpc_get_config().
1933  If you use the vector arguments of xmldb_get(), replace as follows:
1934    xmldb_get(h, db, api_path, &xt, &xvec, &xlen);
1935  with
1936    clicon_rpc_get_config(h, dbstr, api_path, &xt);
1937    xpath_vec(xt, api_path, &xvec, &xlen)
1938
1939* clicon_rpc_change() is replaced with clicon_rpc_edit_config().
1940  Note modify argument 5:
1941     clicon_rpc_change(h, db, op, apipath, "value")
1942  to:
1943     clicon_rpc_edit_config(h, db, op, apipath, `"<config>value</config>"`)
1944
1945* xmdlb_put_xkey() and xmldb_put_tree() have been folded into xmldb_put()
1946  Replace xmldb_put_xkey with xmldb_put as follows:
1947     xmldb_put_xkey(h, "candidate", cbuf_get(cb), str, OP_REPLACE);
1948  with
1949     clicon_xml_parse(&xml, `"<config>%s</config>"`, str);
1950     xmldb_put(h, "candidate", OP_REPLACE, cbuf_get(cb), xml);
1951     xml_free(xml);
1952
1953* Change internal protocol from clicon_proto.h to netconf.
1954  This means that the internal protocol defined in clixon_proto.[ch] is removed
1955
1956* Netconf startup configuration support. Set CLICON_USE_STARTUP_CONFIG to 1 to
1957  enable. Eg, if backend_main is started with -CIr startup will be copied to
1958  running.
1959
1960* Added ".." as valid step in xpath
1961
1962* Use restconf format for internal xmldb keys. Eg /a/b=3,4
1963
1964* List keys with special characters RFC 3986 encoded.
1965
1966* Replaced cli expand functions with single to multiple args
1967  This change is _not_ backward compatible
1968  This effects all calls to expand_dbvar() or user-defined
1969  expand callbacks
1970
1971* Replaced cli callback functions with single arg to multiple args
1972  This change is _not_ backward compatible.
1973  You are affected if you
1974  (1) use system callbacks (i.e. in clixon_cli_api.h)
1975  (2) write your own cli callbacks
1976
1977  If you use cli callbacks, you need to rewrite cli callbacks from eg:
1978     `load("Comment") <filename:string>,load_config_file("filename replace");`
1979  to:
1980     `load("Comment") <filename:string>,load_config_file("filename", "replace");`
1981
1982  If you write your own, you need to change the callback signature from;
1983```
1984    int cli_callback(clicon_handle h, cvec *vars, cg_var *arg)
1985```
1986  to:
1987```
1988    int cli_callback(clicon_handle h, cvec *vars, cvec *argv)
1989```
1990  and rewrite the code to handle argv instead of arg.
1991  These are the system functions affected:
1992  cli_set, cli_merge, cli_del, cli_debug_backend, cli_set_mode,
1993  cli_start_shell, cli_quit, cli_commit, cli_validate, compare_dbs,
1994  load_config_file, save_config_file, delete_all, discard_changes, cli_notify,
1995  show_yang, show_conf_xpath
1996
1997* Added --with-cligen and --with-qdbm configure options
1998* Added union type check for non-cli (eg xml) input
1999* Empty yang type. Relaxed yang types for unions, eg two strings with different length.
2000
2001## (Dec 2016)
2002* Dual license: both GPLv3 and APLv2
2003
2004## (Feb 2016)
2005* Forked new clixon repository from clicon
2006
2007