Restructured error,debug anf log API

Renamed functions clicon->clixon, replaced global variables w access functions
Unified clicon_netconf_error with clixon_err()
This commit is contained in:
Olof hagsand 2023-11-13 10:12:52 +01:00
parent 261469be16
commit 24a4991ec8
199 changed files with 4668 additions and 4158 deletions

View file

@ -74,13 +74,14 @@
/* cligen */
#include <cligen/cligen.h>
/* clicon */
#include "clixon_log.h"
#include "clixon_err.h"
/* clixon */
#include "clixon_string.h"
#include "clixon_queue.h"
#include "clixon_hash.h"
#include "clixon_handle.h"
#include "clixon_log.h"
#include "clixon_debug.h"
#include "clixon_err.h"
#include "clixon_file.h"
#include "clixon_yang.h"
#include "clixon_hash.h"
@ -154,7 +155,7 @@ ys_grouping_module_resolve(yang_stmt *ymod,
* @param[in] name Name of grouping to look for
* @param[out] ygrouping0 A found grouping yang structure as result
* @retval 0 OK, ygrouping may be NULL
* @retval -1 Error, with clicon_err called
* @retval -1 Error, with clixon_err called
*/
int
ys_grouping_resolve(yang_stmt *yuses,
@ -222,7 +223,7 @@ ys_grouping_resolve(yang_stmt *yuses,
* a special "when" struct to the yang statements being inserted.
*/
static int
yang_augment_node(clicon_handle h,
yang_augment_node(clixon_handle h,
yang_stmt *ys)
{
int retval = -1;
@ -238,7 +239,7 @@ yang_augment_node(clicon_handle h,
enum rfc_6020 childkey;
if ((ymod = ys_module(ys)) == NULL){
clicon_err(OE_YANG, 0, "My yang module not found");
clixon_err(OE_YANG, 0, "My yang module not found");
goto done;
}
schema_nodeid = yang_argument_get(ys);
@ -252,7 +253,7 @@ yang_augment_node(clicon_handle h,
/* Log a warning and proceed if augment target not found
* This may be necessary with some broken models
*/
clicon_log(LOG_WARNING, "Warning: Augment failed in module %s: target node %s not found",
clixon_log(h, LOG_WARNING, "Warning: Augment failed in module %s: target node %s not found",
yang_argument_get(ys_module(ys)),
schema_nodeid);
goto ok;
@ -261,7 +262,7 @@ yang_augment_node(clicon_handle h,
/* Fail with fatal error if augment target not found
* This is "correct"
*/
clicon_err(OE_YANG, 0, "Augment failed in module %s: target node %s not found",
clixon_err(OE_YANG, 0, "Augment failed in module %s: target node %s not found",
yang_argument_get(ys_module(ys)),
schema_nodeid);
goto done;
@ -302,7 +303,7 @@ yang_augment_node(clicon_handle h,
/* Special case if yc0 is disabled by if-feature=false, then it is transformed to ANYDATA
*/
if (yang_flag_get(yc0, YANG_FLAG_DISABLED) == 0)
clicon_log(LOG_WARNING, "Warning: Augment failed in module %s: node %s of type %s cannot be added to target node %s (see RFC 7950 Sec 17)",
clixon_log(h, LOG_WARNING, "Warning: Augment failed in module %s: node %s of type %s cannot be added to target node %s (see RFC 7950 Sec 17)",
yang_argument_get(ys_module(ys)),
yang_argument_get(yc0),
yang_key2str(childkey),
@ -321,7 +322,7 @@ yang_augment_node(clicon_handle h,
if (childkey != Y_CONTAINER && childkey != Y_LEAF && childkey != Y_LIST &&
childkey != Y_LEAF_LIST && childkey != Y_USES && childkey != Y_CHOICE &&
childkey != Y_UNKNOWN){
clicon_log(LOG_WARNING, "Warning: Augment failed in module %s: node %s %d cannot be added to target node %s",
clixon_log(h, LOG_WARNING, "Warning: Augment failed in module %s: node %s %d cannot be added to target node %s",
yang_argument_get(ys_module(ys)),
yang_key2str(childkey),
childkey,
@ -342,7 +343,7 @@ yang_augment_node(clicon_handle h,
childkey != Y_CHOICE && childkey != Y_CONTAINER && childkey != Y_LEAF &&
childkey != Y_LIST && childkey != Y_LEAF_LIST){
clicon_log(LOG_WARNING, "Warning: Augment failed in module %s: node %s %d cannot be added to target node %s",
clixon_log(h, LOG_WARNING, "Warning: Augment failed in module %s: node %s %d cannot be added to target node %s",
yang_argument_get(ys_module(ys)),
yang_key2str(childkey),
childkey,
@ -398,7 +399,7 @@ yang_augment_node(clicon_handle h,
* another module not yet augmented.
*/
static int
yang_augment_module(clicon_handle h,
yang_augment_module(clixon_handle h,
yang_stmt *ymod)
{
@ -558,7 +559,7 @@ yang_expand_uses_node(yang_stmt *yn,
if (ys_grouping_resolve(ys, prefix, id, &ygrouping) < 0)
goto done;
if (ygrouping == NULL){
clicon_log(LOG_NOTICE, "%s: Yang error : grouping \"%s\" not found in module \"%s\"",
clixon_log(NULL, LOG_NOTICE, "%s: Yang error : grouping \"%s\" not found in module \"%s\"",
__FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
goto done;
}
@ -567,7 +568,7 @@ yang_expand_uses_node(yang_stmt *yn,
yp = yn;
do {
if (yp == ygrouping){
clicon_err(OE_YANG, EFAULT, "Yang use of grouping %s in module %s is defined inside the grouping (recursion), see RFC 7950 Sec 7.12: A grouping MUST NOT reference itself",
clixon_err(OE_YANG, EFAULT, "Yang use of grouping %s in module %s is defined inside the grouping (recursion), see RFC 7950 Sec 7.12: A grouping MUST NOT reference itself",
yang_argument_get(ys),
yang_argument_get(ys_module(yn))
);
@ -609,7 +610,7 @@ yang_expand_uses_node(yang_stmt *yn,
size = (yang_len_get(yn) - i - 1)*sizeof(struct yang_stmt *);
yn->ys_len += glen;
if ((yn->ys_stmt = realloc(yn->ys_stmt, (yang_len_get(yn))*sizeof(yang_stmt *))) == 0){
clicon_err(OE_YANG, errno, "realloc");
clixon_err(OE_YANG, errno, "realloc");
goto done;
}
/* Here, glen last elements are not initialized.
@ -676,7 +677,7 @@ yang_expand_uses_node(yang_stmt *yn,
* If a key leaf is defined in a grouping that is used in a list, the
* "uses" statement MUST NOT have a "when" statement.
*/
clicon_err(OE_YANG, 0, "Key leaf '%s' defined in grouping '%s' is used in a 'uses' statement, This is not allowed according to RFC 7950 Sec 7.21.5",
clixon_err(OE_YANG, 0, "Key leaf '%s' defined in grouping '%s' is used in a 'uses' statement, This is not allowed according to RFC 7950 Sec 7.21.5",
yang_argument_get(yg),
yang_argument_get(ygrouping)
);
@ -795,7 +796,7 @@ yang_parse_str(char *str,
yang_stmt *ymod = NULL;
if (yspec == NULL){
clicon_err(OE_YANG, 0, "Yang parse need top level yang spec");
clixon_err(OE_YANG, 0, "Yang parse need top level yang spec");
goto done;
}
yy.yy_name = (char*)name;
@ -811,9 +812,9 @@ yang_parse_str(char *str,
if (yang_parse_init(&yy) < 0)
goto done;
if (clixon_yang_parseparse(&yy) != 0) { /* yacc returns 1 on error */
clicon_log(LOG_NOTICE, "Yang error: %s on line %d", name, yy.yy_linenum);
if (clicon_errno == 0)
clicon_err(OE_YANG, 0, "yang parser error with no error code (should not happen)");
clixon_log(NULL, LOG_NOTICE, "Yang error: %s on line %d", name, yy.yy_linenum);
if (clixon_err_category() == 0)
clixon_err(OE_YANG, 0, "yang parser error with no error code (should not happen)");
yang_parse_exit(&yy);
yang_scan_exit(&yy);
goto done;
@ -824,7 +825,7 @@ yang_parse_str(char *str,
goto done;
}
if ((ymod = yy.yy_module) == NULL){
clicon_err(OE_YANG, 0, "No module in YANG %s", name);
clixon_err(OE_YANG, 0, "No module in YANG %s", name);
goto done;
}
/* Add filename for debugging and errors, see also ys_linenum on (each symbol?) */
@ -860,21 +861,21 @@ yang_parse_file(FILE *fp,
len = BUFLEN; /* any number is fine */
if ((buf = malloc(len)) == NULL){
clicon_err(OE_XML, errno, "malloc");
clixon_err(OE_XML, errno, "malloc");
goto done;
}
memset(buf, 0, len);
i = 0; /* position in buf */
while (1){ /* read the whole file */
if ((ret = fread(&c, 1, 1, fp)) < 0){
clicon_err(OE_XML, errno, "read");
clixon_err(OE_XML, errno, "read");
break;
}
if (ret == 0)
break; /* eof */
if (i == len-1){
if ((buf = realloc(buf, 2*len)) == NULL){
clicon_err(OE_XML, errno, "realloc");
clixon_err(OE_XML, errno, "realloc");
goto done;
}
memset(buf+len, 0, len);
@ -909,7 +910,7 @@ filename2revision(const char *filename,
/* base = module name [+ @rev ] + .yang */
if ((base = strdup(filename)) == NULL){
clicon_err(OE_UNIX, errno, "strdup");
clixon_err(OE_UNIX, errno, "strdup");
goto done;
}
clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, base);
@ -943,7 +944,7 @@ filename2revision(const char *filename,
* @note for bootstrapping, dir may have to be set.
*/
int
yang_file_find_match(clicon_handle h,
yang_file_find_match(clixon_handle h,
const char *module,
const char *revision,
cbuf *fbuf)
@ -961,7 +962,7 @@ yang_file_find_match(clicon_handle h,
if ((x = clicon_conf_xml(h)) == NULL)
goto ok;
if ((regex = cbuf_new()) == NULL){
clicon_err(OE_YANG, errno, "cbuf_new");
clixon_err(OE_YANG, errno, "cbuf_new");
goto done;
}
/* RFC 6020: The name of the file SHOULD be of the form:
@ -1004,7 +1005,7 @@ yang_file_find_match(clicon_handle h,
(dir = xml_body(xc)) != NULL){
/* get all matching files in this directory recursively */
if ((cvv = cvec_new(0)) == NULL){
clicon_err(OE_UNIX, errno, "cvec_new");
clixon_err(OE_UNIX, errno, "cvec_new");
goto done;
}
if (clicon_files_recursive(dir, cbuf_get(regex), cvv) < 0)
@ -1055,7 +1056,7 @@ done:
* See top of file for diagram of calling order
*/
yang_stmt *
yang_parse_filename(clicon_handle h,
yang_parse_filename(clixon_handle h,
const char *filename,
yang_stmt *yspec)
{
@ -1065,11 +1066,11 @@ yang_parse_filename(clicon_handle h,
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, filename);
if (stat(filename, &st) < 0){
clicon_err(OE_YANG, errno, "%s not found", filename);
clixon_err(OE_YANG, errno, "%s not found", filename);
goto done;
}
if ((fp = fopen(filename, "r")) == NULL){
clicon_err(OE_YANG, errno, "fopen(%s)", filename);
clixon_err(OE_YANG, errno, "fopen(%s)", filename);
goto done;
}
if ((ymod = yang_parse_file(fp, filename, yspec)) < 0)
@ -1098,7 +1099,7 @@ yang_parse_filename(clicon_handle h,
* @note does not check wether the module is already loaded
*/
yang_stmt *
yang_parse_module(clicon_handle h,
yang_parse_module(clixon_handle h,
const char *module,
const char *revision,
yang_stmt *yspec,
@ -1114,7 +1115,7 @@ yang_parse_module(clicon_handle h,
cbuf *cb = NULL;
if ((fbuf = cbuf_new()) == NULL){
clicon_err(OE_UNIX, errno, "cbuf_new");
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
/* Match a yang file with or without revision in yang-dir list */
@ -1122,16 +1123,16 @@ yang_parse_module(clicon_handle h,
goto done;
if (nr == 0){
if ((cb = cbuf_new()) == NULL){
clicon_err(OE_UNIX, errno, "cbuf_new");
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
cprintf(cb, "%s", module);
if (revision)
cprintf(cb, "@%s", revision);
if (origname)
clicon_err(OE_YANG, ENOENT, "Yang \"%s\" not found in the list of CLICON_YANG_DIRs when loading %s.yang", cbuf_get(cb), origname);
clixon_err(OE_YANG, ENOENT, "Yang \"%s\" not found in the list of CLICON_YANG_DIRs when loading %s.yang", cbuf_get(cb), origname);
else
clicon_err(OE_YANG, ENOENT, "Yang \"%s\" not found in the list of CLICON_YANG_DIRs", cbuf_get(cb));
clixon_err(OE_YANG, ENOENT, "Yang \"%s\" not found in the list of CLICON_YANG_DIRs", cbuf_get(cb));
goto done;
}
filename = cbuf_get(fbuf);
@ -1142,7 +1143,7 @@ yang_parse_module(clicon_handle h,
* RFC 7950 Sec 5.2
*/
if (strcmp(yang_argument_get(ymod), module) != 0){
clicon_err(OE_YANG, EINVAL, "File %s contains yang module \"%s\" which does not match expected module %s",
clixon_err(OE_YANG, EINVAL, "File %s contains yang module \"%s\" which does not match expected module %s",
filename,
yang_argument_get(ymod),
module);
@ -1159,7 +1160,7 @@ yang_parse_module(clicon_handle h,
goto done;
/* Sanity check that file revision does not match internal rev stmt */
if (revf && revm && revm != revf){
clicon_err(OE_YANG, EINVAL, "Yang module file revision and in yang does not match: %s vs %u", filename, revm);
clixon_err(OE_YANG, EINVAL, "Yang module file revision and in yang does not match: %s vs %u", filename, revm);
ymod = NULL;
goto done;
}
@ -1183,7 +1184,7 @@ yang_parse_module(clicon_handle h,
* See top of file for diagram of calling order
*/
static int
yang_parse_recurse(clicon_handle h,
yang_parse_recurse(clixon_handle h,
yang_stmt *ymod,
yang_stmt *ysp)
{
@ -1222,11 +1223,11 @@ yang_parse_recurse(clicon_handle h,
if (keyw == Y_INCLUDE){
ybelongto = yang_find(subymod, Y_BELONGS_TO, NULL);
if (ybelongto == NULL){
clicon_err(OE_YANG, ENOENT, "Sub-module \"%s\" does not have a belongs-to statement", submodule); /* shouldnt happen */
clixon_err(OE_YANG, ENOENT, "Sub-module \"%s\" does not have a belongs-to statement", submodule); /* shouldnt happen */
goto done;
}
if (strcmp(yang_argument_get(ybelongto), yang_argument_get(yrealmod)) != 0){
clicon_err(OE_YANG, ENOENT, "Sub-module \"%s\" references module \"%s\" in its belongs-to statement but should reference \"%s\"",
clixon_err(OE_YANG, ENOENT, "Sub-module \"%s\" references module \"%s\" in its belongs-to statement but should reference \"%s\"",
submodule,
yang_argument_get(ybelongto),
yang_argument_get(yrealmod));
@ -1257,7 +1258,7 @@ yang_parse_recurse(clicon_handle h,
* Unless it is the "errors" rule of the ietf-restconf spec which seems to be a special case.
*/
static int
ys_list_check(clicon_handle h,
ys_list_check(clixon_handle h,
yang_stmt *ys)
{
int retval = -1;
@ -1281,7 +1282,7 @@ ys_list_check(clicon_handle h,
/* Except nokey exceptions such as rrc 8040 yang-data */
if (!yang_flag_get(yroot, YANG_FLAG_NOKEY)){
/* Note obsolete */
clicon_log(LOG_ERR, "Error: LIST \"%s\" in module \"%s\" lacks key statement which MUST be present (See RFC 7950 Sec 7.8.2)",
clixon_log(h, LOG_ERR, "Error: LIST \"%s\" in module \"%s\" lacks key statement which MUST be present (See RFC 7950 Sec 7.8.2)",
yang_argument_get(ys),
yang_argument_get(ymod)
);
@ -1325,7 +1326,7 @@ ys_visit(struct yang_stmt *yn,
if (yn == NULL ||
(yang_keyword_get(yn) != Y_MODULE && yang_keyword_get(yn) != Y_SUBMODULE)){
clicon_err(OE_YANG, EINVAL, "Expected module or submodule");
clixon_err(OE_YANG, EINVAL, "Expected module or submodule");
goto done;
}
yspec = ys_spec(yn);
@ -1334,7 +1335,7 @@ ys_visit(struct yang_stmt *yn,
return 0;
/* if n has a temporary mark then stop (not a DAG) */
if (yang_flag_get(yn, YANG_FLAG_TMP)){
clicon_err(OE_YANG, EFAULT, "Yang module %s import/include is circular", yang_argument_get(yn));
clixon_err(OE_YANG, EFAULT, "Yang module %s import/include is circular", yang_argument_get(yn));
goto done;
}
/* mark n with a temporary mark */
@ -1349,7 +1350,7 @@ ys_visit(struct yang_stmt *yn,
continue;
if ((ymod = yang_find(yspec, Y_MODULE, yang_argument_get(yi))) == NULL &&
(ymod = yang_find(yspec, Y_SUBMODULE, yang_argument_get(yi))) == NULL){
clicon_err(OE_YANG, EFAULT, "Yang module %s import/include not found",
clixon_err(OE_YANG, EFAULT, "Yang module %s import/include not found",
yang_argument_get(yi)); /* shouldnt happen */
goto done;
}
@ -1363,7 +1364,7 @@ ys_visit(struct yang_stmt *yn,
/* add n to head of L. NB reversed */
(*ylen)++;
if ((*ylist = realloc(*ylist, (*ylen)*sizeof(yang_stmt *))) == 0){
clicon_err(OE_YANG, errno, "realloc");
clixon_err(OE_YANG, errno, "realloc");
goto done;
}
(*ylist)[*ylen - 1] = yn;
@ -1404,7 +1405,7 @@ yang_sort_modules(yang_stmt *yspec,
}
}
if (*ylen != modmax-modmin){
clicon_err(OE_YANG, EFAULT, "Internal error: mismatch sort vector lengths");
clixon_err(OE_YANG, EFAULT, "Internal error: mismatch sort vector lengths");
}
retval = 0;
done:
@ -1434,7 +1435,7 @@ yang_sort_modules(yang_stmt *yspec,
* @retval -1 Error encountered
*/
int
yang_parse_post(clicon_handle h,
yang_parse_post(clixon_handle h,
yang_stmt *yspec,
int modmin)
{
@ -1445,7 +1446,7 @@ yang_parse_post(clicon_handle h,
int ylen = 0; /* Length of ylist */
if (modmin < 0){
clicon_err(OE_YANG, EINVAL, "modmin negative");
clixon_err(OE_YANG, EINVAL, "modmin negative");
goto done;
}
/* 1: Parse from text to yang parse-tree.
@ -1555,7 +1556,7 @@ yang_parse_post(clicon_handle h,
* @see yang_spec_parse_file
*/
int
yang_spec_parse_module(clicon_handle h,
yang_spec_parse_module(clixon_handle h,
const char *name,
const char *revision,
yang_stmt *yspec)
@ -1565,11 +1566,11 @@ yang_spec_parse_module(clicon_handle h,
char *base = NULL;;
if (yspec == NULL){
clicon_err(OE_YANG, EINVAL, "yang spec is NULL");
clixon_err(OE_YANG, EINVAL, "yang spec is NULL");
goto done;
}
if (name == NULL){
clicon_err(OE_YANG, EINVAL, "yang module not set");
clixon_err(OE_YANG, EINVAL, "yang module not set");
goto done;
}
/* Apply steps 2.. on new modules, ie ones after modmin. */
@ -1602,7 +1603,7 @@ yang_spec_parse_module(clicon_handle h,
* @see yang_spec_load_dir For loading all files in a directory
*/
int
yang_spec_parse_file(clicon_handle h,
yang_spec_parse_file(clixon_handle h,
char *filename,
yang_stmt *yspec)
{
@ -1614,11 +1615,11 @@ yang_spec_parse_file(clicon_handle h,
modmin = yang_len_get(yspec);
/* Find module, and do not load file if module already exists */
if (basename(filename) == NULL){
clicon_err(OE_YANG, errno, "No basename");
clixon_err(OE_YANG, errno, "No basename");
goto done;
}
if ((base = strdup(basename(filename))) == NULL){
clicon_err(OE_YANG, errno, "strdup");
clixon_err(OE_YANG, errno, "strdup");
goto done;
}
if (index(base, '@') != NULL)
@ -1654,7 +1655,7 @@ yang_spec_parse_file(clicon_handle h,
* the oldest module if 1-3 for some reason fails.
*/
int
yang_spec_load_dir(clicon_handle h,
yang_spec_load_dir(clixon_handle h,
char *dir,
yang_stmt *yspec)
{
@ -1737,7 +1738,7 @@ yang_spec_load_dir(clicon_handle h,
revm = cv_uint32_get(yang_cv_get(yrev));
/* Sanity check that file revision does not match internal rev stmt */
if (revf && revm && revm != revf){ /* XXX */
clicon_err(OE_YANG, EINVAL, "Yang module file revision and in yang does not match: %s(%u) vs %u", filename, revf, revm);
clixon_err(OE_YANG, EINVAL, "Yang module file revision and in yang does not match: %s(%u) vs %u", filename, revf, revm);
goto done;
}
/* If ym0 and ym exists, delete the yang with oldest revision
@ -1783,21 +1784,21 @@ ys_parse_date_arg(char *datearg,
uint32_t d = 0;
if (strlen(datearg) != 10 || datearg[4] != '-' || datearg[7] != '-'){
clicon_err(OE_YANG, EINVAL, "Revision date %s, but expected: YYYY-MM-DD", datearg);
clixon_err(OE_YANG, EINVAL, "Revision date %s, but expected: YYYY-MM-DD", datearg);
goto done;
}
if ((i = cligen_tonum(4, datearg)) < 0){
clicon_err(OE_YANG, EINVAL, "Revision date %s, but expected: YYYY-MM-DD", datearg);
clixon_err(OE_YANG, EINVAL, "Revision date %s, but expected: YYYY-MM-DD", datearg);
goto done;
}
d = i*10000; /* year */
if ((i = cligen_tonum(2, &datearg[5])) < 0){
clicon_err(OE_YANG, EINVAL, "Revision date %s, but expected: YYYY-MM-DD", datearg);
clixon_err(OE_YANG, EINVAL, "Revision date %s, but expected: YYYY-MM-DD", datearg);
goto done;
}
d += i*100; /* month */
if ((i = cligen_tonum(2, &datearg[8])) < 0){
clicon_err(OE_YANG, EINVAL, "Revision date %s, but expected: YYYY-MM-DD", datearg);
clixon_err(OE_YANG, EINVAL, "Revision date %s, but expected: YYYY-MM-DD", datearg);
goto done;
}
d += i; /* day */
@ -1827,15 +1828,15 @@ ys_parse(yang_stmt *ys,
yang_cv_set(ys, NULL);
}
if ((cv = cv_new(cvtype)) == NULL){
clicon_err(OE_YANG, errno, "cv_new");
clixon_err(OE_YANG, errno, "cv_new");
goto done;
}
if ((cvret = cv_parse1(yang_argument_get(ys), cv, &reason)) < 0){ /* error */
clicon_err(OE_YANG, errno, "parsing cv");
clixon_err(OE_YANG, errno, "parsing cv");
goto done;
}
if (cvret == 0){ /* parsing failed */
clicon_err(OE_YANG, errno, "Parsing CV: %s", reason);
clixon_err(OE_YANG, errno, "Parsing CV: %s", reason);
goto done;
}
yang_cv_set(ys, cv);
@ -1895,12 +1896,12 @@ ys_parse_sub(yang_stmt *ys,
if (ys_parse(ys, CGV_UINT8) == NULL)
goto done;
if ((cv = yang_cv_get(ys)) == NULL){
clicon_err(OE_YANG, ENOENT, "Unexpected NULL cv");
clixon_err(OE_YANG, ENOENT, "Unexpected NULL cv");
goto done;
}
fd = cv_uint8_get(cv);
if (fd < 1 || fd > 18){
clicon_err(OE_YANG, errno, "%u: Out of range, should be [1:18]", fd);
clixon_err(OE_YANG, errno, "%u: Out of range, should be [1:18]", fd);
goto done;
}
break;
@ -1914,7 +1915,7 @@ ys_parse_sub(yang_stmt *ys,
if (ys_parse_date_arg(arg, &date) < 0)
goto done;
if ((cv = cv_new(CGV_UINT32)) == NULL){
clicon_err(OE_YANG, errno, "cv_new");
clixon_err(OE_YANG, errno, "cv_new");
goto done;
}
yang_cv_set(ys, cv);
@ -1924,7 +1925,7 @@ ys_parse_sub(yang_stmt *ys,
if (strcmp(arg, "current") &&
strcmp(arg, "deprecated") &&
strcmp(arg, "obsolete")){
clicon_err(OE_YANG, errno, "Invalid status: \"%s\", expected current, deprecated, or obsolete", arg);
clixon_err(OE_YANG, errno, "Invalid status: \"%s\", expected current, deprecated, or obsolete", arg);
goto done;
}
@ -1932,7 +1933,7 @@ ys_parse_sub(yang_stmt *ys,
case Y_MAX_ELEMENTS:
case Y_MIN_ELEMENTS:
if ((cv = cv_new(CGV_UINT32)) == NULL){
clicon_err(OE_YANG, errno, "cv_new");
clixon_err(OE_YANG, errno, "cv_new");
goto done;
}
yang_cv_set(ys, cv);
@ -1941,11 +1942,11 @@ ys_parse_sub(yang_stmt *ys,
cv_uint32_set(cv, 0); /* 0 means unbounded for max */
else{
if ((ret = parse_uint32(arg, &minmax, &reason)) < 0){
clicon_err(OE_YANG, errno, "parse_uint32");
clixon_err(OE_YANG, errno, "parse_uint32");
goto done;
}
if (ret == 0){
clicon_err(OE_YANG, EINVAL, "element-min/max parse error: %s", reason);
clixon_err(OE_YANG, EINVAL, "element-min/max parse error: %s", reason);
if (reason)
free(reason);
goto done;
@ -1955,7 +1956,7 @@ ys_parse_sub(yang_stmt *ys,
break;
case Y_MODIFIER:
if (strcmp(yang_argument_get(ys), "invert-match")){
clicon_err(OE_YANG, EINVAL, "modifier %s, expected invert-match", yang_argument_get(ys));
clixon_err(OE_YANG, EINVAL, "modifier %s, expected invert-match", yang_argument_get(ys));
goto done;
}
break;
@ -1987,16 +1988,16 @@ ys_parse_sub(yang_stmt *ys,
if (extra == NULL)
break;
if ((cv = cv_new(CGV_STRING)) == NULL){
clicon_err(OE_YANG, errno, "cv_new");
clixon_err(OE_YANG, errno, "cv_new");
goto done;
}
yang_cv_set(ys, cv);
if ((ret = cv_parse1(extra, cv, &reason)) < 0){ /* error */
clicon_err(OE_YANG, errno, "parsing cv");
clixon_err(OE_YANG, errno, "parsing cv");
goto done;
}
if (ret == 0){ /* parsing failed */
clicon_err(OE_YANG, errno, "Parsing CV: %s", reason);
clixon_err(OE_YANG, errno, "Parsing CV: %s", reason);
goto done;
}
break;