replace obsolete cvec_find_var with cvec_find
This commit is contained in:
parent
ff5f93ac1e
commit
dacd2fe3a0
4 changed files with 17 additions and 17 deletions
|
|
@ -394,7 +394,7 @@ cli_debug_cli(clicon_handle h,
|
|||
cg_var *cv;
|
||||
int level;
|
||||
|
||||
if ((cv = cvec_find_var(vars, "level")) == NULL){
|
||||
if ((cv = cvec_find(vars, "level")) == NULL){
|
||||
if (cvec_len(argv) != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires either label var or single arg: 0|1", __FUNCTION__);
|
||||
goto done;
|
||||
|
|
@ -425,7 +425,7 @@ cli_debug_backend(clicon_handle h,
|
|||
cg_var *cv;
|
||||
int level;
|
||||
|
||||
if ((cv = cvec_find_var(vars, "level")) == NULL){
|
||||
if ((cv = cvec_find(vars, "level")) == NULL){
|
||||
if (cvec_len(argv) != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires either label var or single arg: 0|1", __FUNCTION__);
|
||||
goto done;
|
||||
|
|
@ -455,7 +455,7 @@ cli_debug_restconf(clicon_handle h,
|
|||
cg_var *cv;
|
||||
int level;
|
||||
|
||||
if ((cv = cvec_find_var(vars, "level")) == NULL){
|
||||
if ((cv = cvec_find(vars, "level")) == NULL){
|
||||
if (cvec_len(argv) != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires either label var or single arg: 0|1", __FUNCTION__);
|
||||
goto done;
|
||||
|
|
@ -750,7 +750,7 @@ load_config_file(clicon_handle h,
|
|||
clicon_err(OE_PLUGIN, 0, "No such op: %s, expected merge or replace", opstr);
|
||||
goto done;
|
||||
}
|
||||
if ((cv = cvec_find_var(cvv, varstr)) == NULL){
|
||||
if ((cv = cvec_find(cvv, varstr)) == NULL){
|
||||
clicon_err(OE_PLUGIN, 0, "No such var name: %s", varstr);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -838,7 +838,7 @@ save_config_file(clicon_handle h,
|
|||
clicon_err(OE_PLUGIN, 0, "No such db name: %s", dbstr);
|
||||
goto done;
|
||||
}
|
||||
if ((cv = cvec_find_var(cvv, varstr)) == NULL){
|
||||
if ((cv = cvec_find(cvv, varstr)) == NULL){
|
||||
clicon_err(OE_PLUGIN, 0, "No such var name: %s", varstr);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -1230,7 +1230,7 @@ cli_copy_config(clicon_handle h,
|
|||
tovar = cv_string_get(cvec_i(argv, 4));
|
||||
|
||||
/* Get from variable -> cv -> from name */
|
||||
if ((fromcv = cvec_find_var(cvv, fromvar)) == NULL){
|
||||
if ((fromcv = cvec_find(cvv, fromvar)) == NULL){
|
||||
clicon_err(OE_PLUGIN, 0, "fromvar '%s' not found in cligen var list", fromvar);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -1261,7 +1261,7 @@ cli_copy_config(clicon_handle h,
|
|||
}
|
||||
|
||||
/* Get to variable -> cv -> to name */
|
||||
if ((tocv = cvec_find_var(cvv, tovar)) == NULL){
|
||||
if ((tocv = cvec_find(cvv, tovar)) == NULL){
|
||||
clicon_err(OE_PLUGIN, 0, "tovar '%s' not found in cligen var list", tovar);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -1310,7 +1310,7 @@ cli_debug(clicon_handle h,
|
|||
cg_var *cv;
|
||||
int level;
|
||||
|
||||
if ((cv = cvec_find_var(vars, "level")) == NULL)
|
||||
if ((cv = cvec_find(vars, "level")) == NULL)
|
||||
cv = arg;
|
||||
level = cv_int32_get(cv);
|
||||
/* cli */
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ cli_show_config(clicon_handle h,
|
|||
clicon_err(OE_PLUGIN, 0, "xpath '%s' does not have a single '%%'");
|
||||
goto done;
|
||||
}
|
||||
if ((cvattr = cvec_find_var(cvv, attr)) == NULL){
|
||||
if ((cvattr = cvec_find(cvv, attr)) == NULL){
|
||||
clicon_err(OE_PLUGIN, 0, "attr '%s' not found in cligen var list", attr);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -572,7 +572,7 @@ show_conf_xpath(clicon_handle h,
|
|||
clicon_err(OE_PLUGIN, 0, "No such db name: %s", str);
|
||||
goto done;
|
||||
}
|
||||
cv = cvec_find_var(cvv, "xpath");
|
||||
cv = cvec_find(cvv, "xpath");
|
||||
xpath = cv_string_get(cv);
|
||||
if (clicon_rpc_get_config(h, str, xpath, &xt) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ fib_route_rpc(clicon_handle h,
|
|||
/* Send to backend */
|
||||
if (clicon_rpc_netconf_xml(h, xrpc, &xret, NULL) < 0)
|
||||
goto done;
|
||||
if ((xerr = xpath_first(xret, "/rpc-error")) != NULL){
|
||||
if ((xerr = xpath_first(xret, "//rpc-error")) != NULL){
|
||||
clicon_rpc_generate_error("Get configuration", xerr);
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,22 +226,22 @@ new2 "guest edit nacm"
|
|||
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"x": 3}' http://localhost/restconf/data/x)" '{"ietf-restconf:errors" : {"error": {"error-tag": "access-denied","error-type": "protocol","error-severity": "error","error-message": "The requested URL was unauthorized"}}}
'
|
||||
|
||||
new "cli show conf as admin"
|
||||
expectfn "$clixon_cli -1 -U adm1 -f $cfg -y $fyang show conf" 0 "^x 1;$"
|
||||
expectfn "$clixon_cli -1 -U adm1 -l o -f $cfg -y $fyang show conf" 0 "^x 1;$"
|
||||
|
||||
new "cli show conf as limited"
|
||||
expectfn "$clixon_cli -1 -U wilma -f $cfg -y $fyang show conf" 0 "^x 1;$"
|
||||
expectfn "$clixon_cli -1 -U wilma -l o -f $cfg -y $fyang show conf" 0 "^x 1;$"
|
||||
|
||||
new "cli show conf as guest"
|
||||
expectfn "$clixon_cli -1 -U guest -f $cfg -y $fyang show conf" 255 "CLI command error"
|
||||
expectfn "$clixon_cli -1 -U guest -l o -f $cfg -y $fyang show conf" 255 "protocol access-denied"
|
||||
|
||||
new "cli rpc as admin"
|
||||
expectfn "$clixon_cli -1 -U adm1 -f $cfg -y $fyang rpc ipv4" 0 "<next-hop-list>2.3.4.5</next-hop-list>"
|
||||
expectfn "$clixon_cli -1 -U adm1 -l o -f $cfg -y $fyang rpc ipv4" 0 "<next-hop-list>2.3.4.5</next-hop-list>"
|
||||
|
||||
new "cli rpc as limited"
|
||||
expectfn "$clixon_cli -1 -U wilma -f $cfg -y $fyang rpc ipv4" 0 "<error-tag>access-denied</error-tag>"
|
||||
expectfn "$clixon_cli -1 -U wilma -l o -f $cfg -y $fyang rpc ipv4" 255 "protocol access-denied default deny"
|
||||
|
||||
new "cli rpc as guest"
|
||||
expectfn "$clixon_cli -1 -U guest -f $cfg -y $fyang rpc ipv4" 0 "<error-tag>access-denied</error-tag>"
|
||||
expectfn "$clixon_cli -1 -U guest -l o -f $cfg -y $fyang rpc ipv4" 255 "protocol access-denied access denied"
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data clixon_restconf
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue