From c80ddf0f964151a3cc2d35f0ef56df7cfaf5df1c Mon Sep 17 00:00:00 2001 From: Olof Hagsand Date: Thu, 28 Apr 2016 16:26:23 +0200 Subject: [PATCH 1/2] decimal64 generated cli --- apps/cli/cli_generate.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/cli/cli_generate.c b/apps/cli/cli_generate.c index cebd7731..8d66c0cf 100644 --- a/apps/cli/cli_generate.c +++ b/apps/cli/cli_generate.c @@ -163,24 +163,35 @@ cvtype_max2str_dup(enum cv_type type) * @param[in] ys yang_stmt of the node at hand * @param[in] cvtype Type of the cligen variable * @param[in] cb0 The string where the result format string is inserted. + * @param[in] options + * @param[in] fraction_digits + * @see expand_dbvar This is where the expand string is used + * @note XXX only fraction_digits handled,should also have mincv, maxcv, pattern */ static int cli_expand_var_generate(clicon_handle h, yang_stmt *ys, enum cv_type cvtype, - cbuf *cb0) + cbuf *cb0, + int options, + uint8_t fraction_digits + ) { int retval = -1; char *xkfmt = NULL; if (yang2xmlkeyfmt(ys, &xkfmt) < 0) goto done; - cprintf(cb0, "|<%s:%s %s(\"candidate %s\")>", - ys->ys_argument, - cv_type2str(cvtype), + cprintf(cb0, "|<%s:%s", ys->ys_argument, + cv_type2str(cvtype)); + if (options & YANG_OPTIONS_FRACTION_DIGITS) + cprintf(cb0, " fraction-digits:%u", fraction_digits); + cprintf(cb0, " %s(\"candidate %s\")>", GENERATE_EXPAND_XMLDB, xkfmt); + + retval = 0; done: if (xkfmt) @@ -327,7 +338,8 @@ yang2cli_var_sub(clicon_handle h, if (helptext) cprintf(cb0, "(\"%s\")", helptext); if (completion){ - if (cli_expand_var_generate(h, ys, cvtype, cb0) < 0) + if (cli_expand_var_generate(h, ys, cvtype, cb0, + options, fraction_digits) < 0) goto done; if (helptext) cprintf(cb0, "(\"%s\")", helptext); From 5aae4b93846d9761170c10f25b16515a5d843c9d Mon Sep 17 00:00:00 2001 From: Olof Hagsand Date: Fri, 29 Apr 2016 13:58:07 +0200 Subject: [PATCH 2/2] missing get-config xpath select attribute --- apps/netconf/netconf_rpc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/netconf/netconf_rpc.c b/apps/netconf/netconf_rpc.c index cb5dd206..14b97ec5 100644 --- a/apps/netconf/netconf_rpc.c +++ b/apps/netconf/netconf_rpc.c @@ -86,8 +86,8 @@ ]]>]]> * filter subnet + no config: ]]>]]> - * filter xpath + no select: - ]]>]]> + * filter xpath + select all: + ]]>]]> * filter subnet + config: ]]>]]> * filter xpath + select: @@ -152,7 +152,15 @@ netconf_filter_xmldb(clicon_handle h, clicon_xml2cbuf(cb, xc, 0, 1); break; case FILTER_XPATH: - selector = xml_find_value(xfilter, "select"); + if ((selector = xml_find_value(xfilter, "select")) == NULL){ + netconf_create_rpc_error(cb_err, xorig, + "missing-attribute", + "protocol", + "error", + NULL, + "select"); + goto done; + } if (xmldb_get(h, source, selector, 0, &xdb, NULL, NULL) < 0){ netconf_create_rpc_error(cb_err, xorig, "operation-failed",