* Added -U <user> command line to clixon_cli and clixon_netconf for NACM pseudo-user tests
This commit is contained in:
parent
de69b253dc
commit
5cabc11bfb
15 changed files with 132 additions and 48 deletions
|
|
@ -180,7 +180,7 @@ empty(clicon_handle h, /* Clicon handle */
|
|||
* Real code would poll state
|
||||
*/
|
||||
int
|
||||
plugin_statedata(clicon_handle h,
|
||||
example_statedata(clicon_handle h,
|
||||
char *xpath,
|
||||
cxobj *xstate)
|
||||
{
|
||||
|
|
@ -214,8 +214,8 @@ plugin_statedata(clicon_handle h,
|
|||
* @note This assumes example yang with interfaces/interface
|
||||
*/
|
||||
int
|
||||
plugin_reset(clicon_handle h,
|
||||
const char *db)
|
||||
example_reset(clicon_handle h,
|
||||
const char *db)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *xt = NULL;
|
||||
|
|
@ -250,7 +250,7 @@ plugin_reset(clicon_handle h,
|
|||
* can be processed with the standard getopt(3).
|
||||
*/
|
||||
int
|
||||
plugin_start(clicon_handle h,
|
||||
example_start(clicon_handle h,
|
||||
int argc,
|
||||
char **argv)
|
||||
{
|
||||
|
|
@ -261,11 +261,11 @@ clixon_plugin_api *clixon_plugin_init(clicon_handle h);
|
|||
|
||||
static clixon_plugin_api api = {
|
||||
"example", /* name */
|
||||
clixon_plugin_init, /* init */
|
||||
plugin_start, /* start */
|
||||
clixon_plugin_init, /* init - must be called clixon_plugin_init */
|
||||
example_start, /* start */
|
||||
NULL, /* exit */
|
||||
.ca_reset=plugin_reset, /* reset */
|
||||
.ca_statedata=plugin_statedata, /* statedata */
|
||||
.ca_reset=example_reset, /* reset */
|
||||
.ca_statedata=example_statedata, /* statedata */
|
||||
.ca_trans_begin=NULL, /* trans begin */
|
||||
.ca_trans_validate=transaction_validate,/* trans validate */
|
||||
.ca_trans_complete=NULL, /* trans complete */
|
||||
|
|
|
|||
|
|
@ -90,17 +90,24 @@ fib_route_rpc(clicon_handle h,
|
|||
cxobj *xtop = NULL;
|
||||
cxobj *xrpc;
|
||||
cxobj *xret = NULL;
|
||||
cxobj *xerr;
|
||||
|
||||
/* User supplied variable in CLI command */
|
||||
instance = cvec_find(cvv, "instance"); /* get a cligen variable from vector */
|
||||
/* Create XML for fib-route netconf RPC */
|
||||
if (xml_parse_va(&xtop, NULL, "<rpc><fib-route><routing-instance-name>%s</routing-instance-name></fib-route></rpc>", cv_string_get(instance)) < 0)
|
||||
if (xml_parse_va(&xtop, NULL, "<rpc username=\"%s\"><fib-route><routing-instance-name>%s</routing-instance-name></fib-route></rpc>",
|
||||
clicon_username_get(h),
|
||||
cv_string_get(instance)) < 0)
|
||||
goto done;
|
||||
/* Skip top-level */
|
||||
xrpc = xml_child_i(xtop, 0);
|
||||
/* Send to backend */
|
||||
if (clicon_rpc_netconf_xml(h, xrpc, &xret, NULL) < 0)
|
||||
goto done;
|
||||
if ((xerr = xpath_first(xret, "/rpc-error")) != NULL){
|
||||
clicon_rpc_generate_error("Get configuration", xerr);
|
||||
goto done;
|
||||
}
|
||||
/* Print result */
|
||||
xml_print(stdout, xml_child_i(xret, 0));
|
||||
retval = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue