Commit graph

64 commits

Author SHA1 Message Date
Olof hagsand
0baebc93fd * Strict namespace setting can be a problem when upgrading existing database files, such as startup-db or persistent running-db, or any other saved XML file.
* For backward compatibility, load of startup and running set CLICON_XML_NS_STRICT to false temporarily.
* Added three-valued return values for several validate functions where -1 is fatal error, 0 is validation failed and 1 is validation OK.
  * This includes: `xmldb_put`, `xml_yang_validate_all`, `xml_yang_validate_add`, `xml_yang_validate_rpc`, `api_path2xml`, `api_path2xpath`
* Added new xml functions for specific types: `xml_child_nr_notype`, `xml_child_nr_notype`, `xml_child_i_type`, `xml_find_type`.
2019-01-02 15:18:29 +01:00
Olof hagsand
f872c7e295 * More precise Yang validation and better error messages
* For Example, adding bad-, missing-, or unknown-element error messages, etc instead of operation-failed
* Removed delete-config support for candidate db since it is not supported in RFC6241.
* Switched the order of `error-type` and `error-tag` in all netconf and restconf error messages to comply to RFC order.
* Added example_rpc RPC to example backend
* Renamed xml_namespace[_set]() to xml_prefix[_set]()
* Some restconf error messages contained "rpc-reply" or "rpc-error" which have now been removed.
* Netconf/Restconf RPC extra input arguments are ignored (https://github.com/clicon/clixon/issues/47)
2018-12-21 01:33:41 +01:00
Olof hagsand
ae1af8da9e * NACM extension (RFC8341)
* NACM module support (RFC8341 A1+A2)
   * Recovery user "_nacm_recovery" added.
     * Example use is restconf PUT when NACM edit-config is permitted, then automatic commit and discard are permitted using recovery user.
   * Example user changed adm1 to andy to comply with RFC8341 example

 * Yang code upgrade (RFC7950)
   * RPC method input parameters validated
     * see https://github.com/clicon/clixon/issues/4
* Correct XML namespace handling
   * XML multiple modules was based on "loose" semantics so that yang modules were found by iterating thorugh namespaces until a match was made. This did not adhere to proper [XML namespace handling](https://www.w3.org/TR/2009/REC-xml-names-20091208), and causes problems with overlapping names and false positives. Below see XML accepted (but wrong), and correct namespace declaration:
```
      <rpc><my-own-method></rpc> # Wrong but accepted
      <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> # Correct
        <my-own-method xmlns="http://example.net/me/my-own/1.0">
      </rpc>
```
   * To keep old loose semantics set config option CLICON_XML_NS_ITERATE (true by default)
   * XML to JSON translator support for mapping xmlns attribute to module name prefix.
   * Default namespace is still "urn:ietf:params:xml:ns:netconf:base:1.0"
   * See https://github.com/clicon/clixon/issues/49
* Changed all make tags --> make TAGS
* Keyvalue datastore removed (it has been disabled since 3.3.3)
* debug rpc added in example application (should be in clixon-config).
2018-12-16 19:49:19 +01:00
Olof hagsand
9c57902b96 * XML parser conformance to W3 spec
* Names lexically correct (NCName)
  * Syntactically Correct handling of '<?' (processing instructions) and '<?xml' (XML declaration)
  * XML prolog syntax for 'well-formed' XML
  * <!DOCTYPE (ie DTD) is not supported.
2018-11-18 13:22:08 +01:00
Olof hagsand
40cda7b6a4 * ietf-netconf yang module added with candidate, validate, startup and xpath features enabled.
* Added urn:ietf:params:netconf:capability:yang-library:1.0
* Thanks SCadilhac for helping out, see https://github.com/clicon/clixon/issues/39
* uri_percent_encode() and xml_chardata_encode() changed to use stdarg parameters
2018-10-17 22:36:59 +02:00
Olof hagsand
98f3cd0e32 * Major rewrite of event streams
* If you used old event callbacks API, you need to switch to the streams API
    * See clixon_stream.[ch]
  * Old streams API which needs to be removed include:
    * clicon_log_register_callback()
    * subscription_add() --> stream_register()
    * backend_notify() and backend_notify_xml() - use stream_notify() instead
* Example uses "NETCONF" stream instead of "ROUTING"
* Added timeout option -t for clixon_netconf - quit after max time.
2018-09-30 14:51:30 +02:00
Olof hagsand
bf728b37b8 * Full support of XPATH 1.0 according to https://www.w3.org/TR/xpath-10 using yacc/lex
* The previous XPATH imlementation was very restricted.
  * The only function implemented is the Yang extension "current()". No other functions are implemented (eg last(), count()).
2018-07-16 16:13:31 +02:00
Olof hagsand
5304acb086 remove xml x_cv; added makes to jenkinsfile 2018-06-17 23:09:36 +02:00
Olof hagsand
85c4782e36 Dedicated xml,json,yang and xsl parser utility programs added
Sanity check of stdarg (...) added
Cleanup of error messages.
2018-06-17 19:40:06 +02:00
Olof hagsand
0ad6703663 xmlns sanity check 2018-06-05 16:43:43 +02:00
Olof hagsand
849e46191e * Added xmlns validation
* for eg <a xmlns:x="uri"><x:b/></a>
2018-06-05 09:42:11 +02:00
Olof Hagsand
0622f6aafe xml/xsl test programs 2018-05-27 18:31:19 +00:00
Olof hagsand
602f5034b4 NACM external file support. CLICON_NACM_FILE config option, if CLICON_NACM_MODE is external 2018-04-23 23:09:55 +02:00
Olof hagsand
67c0abead7 Fixed issue https://github.com/clicon/clixon/issues/17 special character in strings can break RPCs 2018-04-21 16:32:46 +02:00
Olof hagsand
b9a54f07f3 Restructure and more generic plugin API for backend 2018-04-02 19:27:57 +02:00
Olof hagsand
efa72e9e6f * Proper RFC 6241 Netconf error handling
* New functions added in clixon_netconf_lib.[ch]
  * Datastore code modified for RFC 6241
  * Remaining: validate, generic restconf and netconf code
2018-03-18 18:06:02 +00:00
Olof hagsand
e40d785d5c * Added a "user" parameter to plugin_credentials() restconf callback.
To enable authentication and in preparation for access control a la RFC 6536.
* yang string length "max" keyword set to MAXPATHLEN
2018-02-08 15:24:05 +07:00
Olof hagsand
f6284ac933 restconf PUT delta 2018-01-17 22:59:54 +01:00
Olof hagsand
cd33380368 Fixed empty restconf data segv; error restconf quit; etc 2018-01-16 22:25:55 +01:00
Olof hagsand
38f0b446fa 2017->2018 2018-01-01 12:25:33 +01:00
Olof hagsand
19301ae240 sort xml children on parsing 2017-12-31 18:25:53 +01:00
Olof hagsand
174cfc02c6 Added CLICON_XMLDB_PRETTY option. If set to false, XML database files will be more compact.
Added CLICON_XMLDB_FORMAT option. Default is "xml". If set to "json", XML database files uses JSON format.
Escape " in JSON names and strings and values
Optimized search performance for large lists by sorting and binary search.
2017-12-29 18:09:26 +01:00
Olof hagsand
4b92dbdc10 Optimized search performance for large lists by sorting and binary search 2017-12-27 11:34:47 +01:00
Olof Hagsand
b743b0a080 minor edits 2017-12-22 19:02:20 +01:00
Olof Hagsand
0076a8b838 leafref bug 2017-12-09 20:48:29 +01:00
Olof Hagsand
4742fde1e9 XML creation and parse API changes 2017-12-09 14:14:40 +01:00
Olof hagsand
4cb00bedfa optimization 2017-12-03 20:22:05 +01:00
Olof hagsand
14faf93eec fixed datastore cache 2017-12-02 21:53:02 +01:00
Olof hagsand
e169485985 Datastore cache introduced; Added yang to XML API 2017-12-02 14:49:49 +01:00
Olof Hagsand
23e40384f7 JSON negative number patch 2017-11-13 17:11:31 +00:00
Olof Hagsand
44612c57d8 hardening cvvs due to errors 2017-10-29 10:32:00 +01:00
Olof Hagsand
e1b7ea8449 intptr to avoid warning 2017-10-01 12:41:32 +02:00
Olof hagsand
8494d29d6b config file has .xml ending, yang/clixon-config.yang is used as
model for an xml-based configuration file
2017-09-25 22:05:26 +02:00
Olof hagsand
7a7bfc48a4 experimental xml hash for better performance 2017-09-18 20:53:49 +02:00
Olof hagsand
624b949b3f netconf client was limited to 8K byte messages. Now limit is 2^32 2017-09-13 22:30:35 +02:00
Olof hagsand
fd91bb2933 restconf RPC 2017-07-30 16:16:10 +02:00
Olof hagsand
5ae1aeb427 Added support for YANG anyxml; Yang union CLI generation and validation; Removed yang string escaping 2017-07-27 11:54:28 +02:00
Olof hagsand
4e986d6660 Added new backend plugin callback: plugin_statedata() for getting state data; Added generic xml_merge() function. 2017-07-05 12:30:42 +02:00
Olof hagsand
f5c19d8586 Added state data 2017-07-01 17:42:39 +02:00
Olof hagsand
abd3eee17d Generic map_str2int generic mapping tables; Removed vector return values from xmldb_get() 2017-06-21 21:02:09 +02:00
Olof hagsand
69ff0e3891 Refined netconf none semantics in tests and text datastore 2017-05-01 12:46:09 +02:00
Olof hagsand
c2f52845f8 rm xml index; added xml util functions; further xmldb development 2017-04-23 22:32:53 +02:00
Olof hagsand
d02015f456 datastore text works with replace 2017-04-17 19:47:32 +02:00
Olof hagsand
ee9b74d735 formalizing xmldb api 2017-04-16 19:06:19 +02:00
Olof hagsand
d8fa7bc033 retval 2017-04-15 14:01:06 +02:00
Olof hagsand
d26a801bc0 Added connect/disconnect/getopt/setopt and handle to xmldb API; Added datastore 'text'; Moved apps/dbctrl to datastore/ 2017-04-15 13:53:58 +02:00
Olof hagsand
f6b3e95100 Created xmldb plugin api 2017-04-09 22:53:48 +02:00
Olof hagsand
31c45e5c62 removed cli single callback arg code 2017-04-06 10:26:10 +02:00
Olof hagsand
25d535703e testing 2017-03-28 21:01:57 +02:00
Olof hagsand
eec5896797 internal netconf mods 2017-03-25 18:24:52 +01:00