Resolved conflict.
This commit is contained in:
commit
9ce20ea449
17 changed files with 310 additions and 40 deletions
|
|
@ -223,12 +223,27 @@ json_current_clone(clixon_json_yacc *jy)
|
|||
|
||||
clicon_debug(2, "%s", __FUNCTION__);
|
||||
if (jy->jy_current == NULL){
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
xn = jy->jy_current;
|
||||
json_current_pop(jy);
|
||||
if (jy->jy_current)
|
||||
json_current_new(jy, xml_name(xn));
|
||||
|
||||
if (jy->jy_current) {
|
||||
char* name = xml_name(xn);
|
||||
char* prefix = xml_prefix(xn);
|
||||
char* maybe_prefixed_name = NULL;
|
||||
|
||||
if (prefix) {
|
||||
char* name_parts[] = {prefix, name};
|
||||
maybe_prefixed_name = clicon_strjoin(2, name_parts, ":");
|
||||
} else {
|
||||
maybe_prefixed_name = strdup(name);
|
||||
}
|
||||
json_current_new(jy, maybe_prefixed_name);
|
||||
|
||||
if (maybe_prefixed_name)
|
||||
free(maybe_prefixed_name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ static const map_str2int cli_genmodel_map[] = {
|
|||
{"VARS", GT_VARS},
|
||||
{"ALL", GT_ALL},
|
||||
{"HIDE", GT_HIDE},
|
||||
{"OC_COMPRESS", GT_OC_COMPRESS},
|
||||
{NULL, -1}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ clixon_signal_restore(sigset_t *sigset,
|
|||
int retval = -1;
|
||||
int i;
|
||||
|
||||
if (sigprocmask(0, sigset, NULL) < 0){
|
||||
if (sigprocmask(SIG_SETMASK, sigset, NULL) < 0){
|
||||
clicon_err(OE_UNIX, errno, "sigprocmask");
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -581,10 +581,11 @@ xml_parent(cxobj *xn)
|
|||
return xn->x_up;
|
||||
}
|
||||
|
||||
/*! Set parent of xnode, parent is copied.
|
||||
/*! Set parent of xml node.
|
||||
* @param[in] xn xml node
|
||||
* @param[in] parent pointer to new parent xml node
|
||||
* @retval 0 OK
|
||||
* @see xml_child_rm remove child from parent
|
||||
*/
|
||||
int
|
||||
xml_parent_set(cxobj *xn,
|
||||
|
|
@ -1986,8 +1987,6 @@ xml_copy(cxobj *x0,
|
|||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! Create and return a copy of xml tree.
|
||||
*
|
||||
* @code
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ xml2cli_recurse(FILE *f,
|
|||
/* If presence container, then print as leaf (but continue to children) */
|
||||
if (prepend)
|
||||
(*fn)(f, "%s", prepend);
|
||||
if (gt == GT_ALL || gt == GT_VARS || gt == GT_HIDE)
|
||||
if (gt == GT_ALL || gt == GT_VARS || gt == GT_HIDE || gt == GT_OC_COMPRESS)
|
||||
(*fn)(f, "%s ", xml_name(x));
|
||||
if ((body = xml_body(x)) != NULL){
|
||||
if (index(body, ' '))
|
||||
|
|
|
|||
|
|
@ -2355,6 +2355,14 @@ ys_populate_unique(clicon_handle h,
|
|||
* RFC 7950 Sec 7.19:
|
||||
* If no "argument" statement is present, the keyword expects no argument when
|
||||
* it is used.
|
||||
* Note there is some complexity in different yang modules with unknown-statements.
|
||||
* y0) The location of the extension definition. E.g. extension autocli-op
|
||||
* y1) The location of the unknown-statement (ys). This is for example: cl:autocli-op hide.
|
||||
* Lookup of "cl" is lexically scoped in this context (to find (y0)).
|
||||
* y2) The unknown statement may be used by uses/grouping of (y1). But "cl" is declared
|
||||
* in y1 context. This is fixed by setting ys_mymodule to y1 which is then used in
|
||||
* lookups such as in yang_extension_value().
|
||||
* @see yang_extension_value Called on expanded YANG, eg in context of (y2)
|
||||
*/
|
||||
static int
|
||||
ys_populate_unknown(clicon_handle h,
|
||||
|
|
@ -2376,6 +2384,8 @@ ys_populate_unknown(clicon_handle h,
|
|||
clicon_err(OE_YANG, ENOENT, "Extension \"%s:%s\", module not found", prefix, id);
|
||||
goto done;
|
||||
}
|
||||
/* To find right binding eg after grouping/uses */
|
||||
ys->ys_mymodule = ys_module(ys);
|
||||
if ((yext = yang_find(ymod, Y_EXTENSION, id)) == NULL){
|
||||
clicon_err(OE_YANG, ENOENT, "Extension \"%s:%s\" not found", prefix, id);
|
||||
goto done;
|
||||
|
|
@ -3255,7 +3265,7 @@ yang_container_cli_hide(yang_stmt *ys,
|
|||
|
||||
keyw = yang_keyword_get(ys);
|
||||
/* HIDE mode */
|
||||
if (gt != GT_HIDE)
|
||||
if (gt != GT_HIDE && gt != GT_OC_COMPRESS)
|
||||
return 0;
|
||||
/* A container */
|
||||
if (yang_keyword_get(ys) != Y_CONTAINER)
|
||||
|
|
@ -3572,6 +3582,7 @@ yang_anydata_add(yang_stmt *yp,
|
|||
* // use extension value
|
||||
* }
|
||||
* @endcode
|
||||
* @see ys_populate_unknown Called when parsing YANGo
|
||||
*/
|
||||
int
|
||||
yang_extension_value(yang_stmt *ys,
|
||||
|
|
|
|||
|
|
@ -71,9 +71,13 @@ struct yang_stmt{
|
|||
|
||||
char *ys_argument; /* String / argument depending on keyword */
|
||||
uint16_t ys_flags; /* Flags according to YANG_FLAG_MARK and others */
|
||||
yang_stmt *ys_mymodule; /* Shortcut to "my" module. Augmented
|
||||
nodes can belong to other
|
||||
modules than the ancestor module */
|
||||
yang_stmt *ys_mymodule; /* Shortcut to "my" module. Used by:
|
||||
1) Augmented nodes "belong" to the module where the
|
||||
augment is declared, which may be differnt from
|
||||
the direct ancestor module
|
||||
2) Unknown nodes "belong" to where the extension is
|
||||
declared
|
||||
*/
|
||||
cg_var *ys_cv; /* cligen variable. See ys_populate()
|
||||
Following stmts have cv:s:
|
||||
leaf: for default value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue