Adapted to CLIgen 4.5 API changes, eg: and
This commit is contained in:
parent
8897df202e
commit
1dff0e681b
7 changed files with 27 additions and 18 deletions
|
|
@ -26,7 +26,7 @@ Expected: May 2020
|
||||||
|
|
||||||
### Major New features
|
### Major New features
|
||||||
|
|
||||||
* NACM RFC341 datanode read and write paths
|
* NACM RFC8341 datanode read and write paths
|
||||||
* This completes the NACM RPC and Data node access checks (notification still remains)
|
* This completes the NACM RPC and Data node access checks (notification still remains)
|
||||||
|
|
||||||
### API changes on existing protocol/config features (You may have have to change how you use Clixon)
|
### API changes on existing protocol/config features (You may have have to change how you use Clixon)
|
||||||
|
|
@ -43,6 +43,7 @@ Expected: May 2020
|
||||||
|
|
||||||
### Minor changes
|
### Minor changes
|
||||||
|
|
||||||
|
* Adapted to CLIgen 4.5 API changes, eg: `cliread()` and `cliread_parse()`
|
||||||
* Renamed utility function `clixon_util_insert()` to `clixon_util_xml_mod()` and added merge functionality.
|
* Renamed utility function `clixon_util_insert()` to `clixon_util_xml_mod()` and added merge functionality.
|
||||||
* Sanity check of duplicates prefixes in Yang modules and submodules as defined in RFC 7950 Sec 7.1.4
|
* Sanity check of duplicates prefixes in Yang modules and submodules as defined in RFC 7950 Sec 7.1.4
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -220,15 +220,17 @@ cli_interactive(clicon_handle h)
|
||||||
/* Loop through all commands */
|
/* Loop through all commands */
|
||||||
while(!cligen_exiting(cli_cligen(h))) {
|
while(!cligen_exiting(cli_cligen(h))) {
|
||||||
new_mode = cli_syntax_mode(h);
|
new_mode = cli_syntax_mode(h);
|
||||||
if ((cmd = clicon_cliread(h)) == NULL) {
|
cmd = NULL;
|
||||||
cligen_exiting_set(cli_cligen(h), 1); /* EOF */
|
if (clicon_cliread(h, &cmd) < 0)
|
||||||
goto ok; /* EOF should not be -1 error? */
|
goto done;
|
||||||
|
if (cmd == NULL) { /* EOF */
|
||||||
|
cligen_exiting_set(cli_cligen(h), 1);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (clicon_parse(h, cmd, &new_mode, &result, NULL) < 0)
|
if (clicon_parse(h, cmd, &new_mode, &result, NULL) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
/* Why not check result? */
|
/* Why not check result? */
|
||||||
}
|
}
|
||||||
ok:
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
||||||
|
|
@ -603,14 +603,16 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Read command from CLIgen's cliread() using current syntax mode.
|
/*! Read command from CLIgen's cliread() using current syntax mode.
|
||||||
* @param[in] h Clicon handle
|
* @param[in] h Clicon handle
|
||||||
* @retval string char* buffer containing CLIgen command
|
* @param[out] stringp Pointer to command buffer or NULL on EOF
|
||||||
* @retval NULL Fatal error
|
* @retval 0 OK
|
||||||
|
* @retval -1 Error
|
||||||
*/
|
*/
|
||||||
char *
|
int
|
||||||
clicon_cliread(clicon_handle h)
|
clicon_cliread(clicon_handle h,
|
||||||
|
char **stringp)
|
||||||
{
|
{
|
||||||
char *ret;
|
int retval = -1;
|
||||||
char *pfmt = NULL;
|
char *pfmt = NULL;
|
||||||
cli_syntaxmode_t *mode;
|
cli_syntaxmode_t *mode;
|
||||||
cli_syntax_t *stx;
|
cli_syntax_t *stx;
|
||||||
|
|
@ -632,10 +634,15 @@ clicon_cliread(clicon_handle h)
|
||||||
else
|
else
|
||||||
cli_prompt_set(h, cli_prompt(pfmt ? pfmt : mode->csm_prompt));
|
cli_prompt_set(h, cli_prompt(pfmt ? pfmt : mode->csm_prompt));
|
||||||
cligen_tree_active_set(cli_cligen(h), mode->csm_name);
|
cligen_tree_active_set(cli_cligen(h), mode->csm_name);
|
||||||
ret = cliread(cli_cligen(h));
|
if (cliread(cli_cligen(h), stringp) < 0){
|
||||||
|
clicon_err(OE_FATAL, errno, "CLIgen");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
retval = 0;
|
||||||
|
done:
|
||||||
if (pfmt)
|
if (pfmt)
|
||||||
free(pfmt);
|
free(pfmt);
|
||||||
return ret;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ int clicon_eval(clicon_handle h, char *cmd, cg_obj *match_obj, cvec *vr);
|
||||||
|
|
||||||
int clicon_parse(clicon_handle h, char *cmd, char **mode, cligen_result *result, int *evalres);
|
int clicon_parse(clicon_handle h, char *cmd, char **mode, cligen_result *result, int *evalres);
|
||||||
|
|
||||||
char *clicon_cliread(clicon_handle h);
|
int clicon_cliread(clicon_handle h, char **stringp);
|
||||||
|
|
||||||
int cli_plugin_finish(clicon_handle h);
|
int cli_plugin_finish(clicon_handle h);
|
||||||
|
|
||||||
|
|
|
||||||
2
configure
vendored
2
configure
vendored
|
|
@ -4606,7 +4606,7 @@ if test "x$ac_cv_header_cligen_cligen_h" = xyes; then :
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
else
|
else
|
||||||
as_fn_error $? "cligen missing. Try: git clone https://github.com/olofhagsand/cligen.git" "$LINENO" 5
|
as_fn_error $? "CLIgen missing. Try: git clone https://github.com/olofhagsand/cligen.git" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ if test "$ac_enable_publish" = "yes"; then
|
||||||
AC_DEFINE(CLIXON_PUBLISH_STREAMS, 1, [Enable publish of notification streams using SSE and curl])
|
AC_DEFINE(CLIXON_PUBLISH_STREAMS, 1, [Enable publish of notification streams using SSE and curl])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_HEADERS(cligen/cligen.h,, AC_MSG_ERROR(cligen missing. Try: git clone https://github.com/olofhagsand/cligen.git))
|
AC_CHECK_HEADERS(cligen/cligen.h,, AC_MSG_ERROR([CLIgen missing. Try: git clone https://github.com/olofhagsand/cligen.git]))
|
||||||
|
|
||||||
AC_CHECK_LIB(cligen, cligen_init,, AC_MSG_ERROR([CLIgen missing. Try: git clone https://github.com/olofhagsand/cligen.git]))
|
AC_CHECK_LIB(cligen, cligen_init,, AC_MSG_ERROR([CLIgen missing. Try: git clone https://github.com/olofhagsand/cligen.git]))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -411,8 +411,7 @@ yang2api_path_fmt(yang_stmt *ys,
|
||||||
* 2 : ip = "1.2.3.4"
|
* 2 : ip = "1.2.3.4"
|
||||||
* api_path: /interfaces/interface=e/ipv4/address=1.2.3.4
|
* api_path: /interfaces/interface=e/ipv4/address=1.2.3.4
|
||||||
* @param[in] api_path_fmt XML key format, eg /aaa/%s/name
|
* @param[in] api_path_fmt XML key format, eg /aaa/%s/name
|
||||||
* @param[in] cvv cligen variable vector, one for every wildchar in
|
* @param[in] cvv cligen variable vector, one for every wildchar in api_path_fmt
|
||||||
* api_path_fmt
|
|
||||||
* @param[out] api_path api_path, eg /aaa/17. Free after use
|
* @param[out] api_path api_path, eg /aaa/17. Free after use
|
||||||
* @note first and last elements of cvv are not used,..
|
* @note first and last elements of cvv are not used,..
|
||||||
* @see api_path_fmt2xpath
|
* @see api_path_fmt2xpath
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue