Fixes for 4.4 release

This commit is contained in:
Olof hagsand 2020-03-24 16:41:30 +01:00
parent 09a2e09848
commit a7e0a30938
7 changed files with 22 additions and 11 deletions

View file

@ -44,6 +44,7 @@ features include optimized search functions and a repair callback.
[search](https://clixon-docs.readthedocs.io/en/latest/xml.html#searching-in-xml)
### API changes on existing protocol/config features
* Obsolete configuration options present in clixon configuration file will cause clixon application to exit at startup.
* JSON
* Empty values in JSON has changed to comply to RFC 7951
* empty values of yang type `empty` are encoded as: `{"x":[null]}`
@ -69,7 +70,7 @@ features include optimized search functions and a repair callback.
* On failed validation of leafrefs, error message changed from: `No such leaf` to `No leaf <name> matching path <path>`.
* CLI Error message (clicon_rpc_generate_error()) changed when backend returns netconf error to be more descriptive:
* Original: `Config error: Validate failed. Edit and try again or discard changes: Invalid argument`
* New (example): `Netconf error: application operation-failed Identityref validation failed, undefined not derived from acl-base . Validate failed. Edit and try again or discard changes"
* New (example): `Validate failed. Edit and try again or discard changes: application operation-failed Identityref validation failed, undefined not derived from acl-base"
### C-API changes on existing features (you may need to change your plugin C-code)
* `xml_new()` changed from `xml_new(name, xp, ys)` to `xml_new(name, xp, type)`

View file

@ -587,7 +587,11 @@ main(int argc, char **argv)
restarg = clicon_strjoin(argc, argv, " ");
/* If several cligen object variables match same preference, select first */
#if 0 /* New cligen version (not in 4.4) */
cligen_preference_mode_set(cli_cligen(h), 1);
#else
cligen_match_cgvar_same(1);
#endif
/* Call start function in all plugins before we go interactive
*/

View file

@ -77,8 +77,8 @@ struct err_state{
/*
* Variables
*/
int clicon_errno = 0; /* See enum clicon_err */
int clicon_suberrno = 0; /* Corresponds to errno.h */
int clicon_errno = 0; /* See enum clicon_err XXX: hide this and change to err_category */
int clicon_suberrno = 0; /* Corresponds to errno.h XXX: change to errno */
char clicon_err_reason[ERR_STRLEN] = {0, };
/*
@ -147,7 +147,7 @@ clicon_err_reset(void)
int clicon_err_fn(const char *fn,
const int line,
int category,
int err,
int suberr,
char *format, ...)
{
va_list args;
@ -157,7 +157,7 @@ int clicon_err_fn(const char *fn,
/* Set the global variables */
clicon_errno = category;
clicon_suberrno = errno;
clicon_suberrno = suberr;
/* first round: compute length of error message */
va_start(args, format);

View file

@ -3,7 +3,8 @@
***** BEGIN LICENSE BLOCK *****
Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
Copyright (C) 2017-2020 Olof Hagsand
Copyright (C) 2017-2019 Olof Hagsand
Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC
This file is part of CLIXON.
@ -48,6 +49,7 @@
#include <string.h>
#include <limits.h>
#include <stdint.h>
#include <syslog.h>
/* cligen */
#include <cligen/cligen.h>
@ -1535,8 +1537,11 @@ clixon_netconf_error_fn(const char *fn,
}
if (netconf_err2cb(xerr, cb) < 0)
goto done;
clicon_err_fn(fn, line, category, 0, "%s", cbuf_get(cb));
#if 0 /* More verbose output for debugging */
clicon_log(LOG_ERR, "%s: %d: %s", fn, line, cbuf_get(cb));
#else
clicon_log(LOG_ERR, "%s", cbuf_get(cb));
#endif
retval = 0;
done:
if (cb)

View file

@ -245,6 +245,7 @@ parse_configfile(clicon_handle h,
}
if (netconf_err2cb(xerr, cbret) < 0)
goto done;
/* Here one could make it more relaxing to not quit on unrecognized option? */
clixon_netconf_error(OE_CFG, xerr, NULL, NULL);
goto done;
}

View file

@ -73,7 +73,7 @@ new "cli configure using encoded chars name <&"
expectfn "$clixon_cli -1 -f $cfg set interfaces interface fddi&< type ianaift:ethernetCsmacd" 0 ""
new "cli failed validate"
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 255 "Netconf error: Validate failed. Edit and try again or discard changes: application missing-element Mandatory variable <bad-element>type</bad-element>"
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 255 "Validate failed. Edit and try again or discard changes: application missing-element Mandatory variable <bad-element>type</bad-element>"
new "cli configure ip addr"
expectfn "$clixon_cli -1 -f $cfg set interfaces interface eth/0/0 ipv4 address 1.2.3.4 prefix-length 24" 0 "^$"

View file

@ -253,14 +253,14 @@ new "CLI set wrong acl-type"
expectfn "$clixon_cli -1 -f $cfg -l o set acls acl x type undefined" 0 "^$"
new "cli validate acl-type"
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 255 " Netconf error: Validate failed. Edit and try again or discard changes: application operation-failed Identityref validation failed, undefined not derived from acl-base"
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 255 "Validate failed. Edit and try again or discard changes: application operation-failed Identityref validation failed, undefined not derived from acl-base"
# test empty identityref list
new "cli set empty"
expectfn "$clixon_cli -1 -f $cfg -l o set e undefined" 0 "^$"
new "cli validate empty"
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 255 "Netconf error: Validate failed. Edit and try again or discard changes: application operation-failed Identityref validation failed, undefined not derived from acl-base"
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 255 "Validate failed. Edit and try again or discard changes: application operation-failed Identityref validation failed, undefined not derived from acl-base"
new "netconf discard-changes"
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc><discard-changes/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"