Skip to content

Commit

Permalink
Test of CLI completion in mounted list
Browse files Browse the repository at this point in the history
  • Loading branch information
olofhagsand committed Jan 2, 2024
1 parent 9b9482a commit 8de05d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/controller_cli_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,9 @@ cli_dbxml_devs(clixon_handle h,
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
/* Remove all keywords */
if (cvec_exclude_keys(cvv) < 0)
goto done;
/* Concatenate all argv strings to a single string
* Variant of cvec_concat_cb() where api-path-fmt may be interleaved with mtpoint,
* eg /api-path-fmt2 mtpoint /api-path-fmt1 /api-path-fmt0
Expand All @@ -1899,9 +1902,6 @@ cli_dbxml_devs(clixon_handle h,
else{
devices = strstr(api_path_fmt, "/clixon-controller:devices") != NULL;
}
/* Remove all keywords */
if (cvec_exclude_keys(cvv) < 0)
goto done;
if (devices && (cv = cvec_find(cvv, "name")) != NULL){
pattern = cv_string_get(cv);
if (rpc_get_yanglib_mount_match(h, pattern, 0, 0, &xdevs) < 0)
Expand Down
9 changes: 9 additions & 0 deletions test/test-cli-edit-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ function testrun()
new "validate"
expectpart "$($clixon_cli -1 -m configure -f $CFG validate)" 0 ""

# Completion test for https://github.com/clicon/clixon-controller/issues/72
new "Configure interface xintf on openconfig1"
expectpart "$($clixon_cli -1 -f $CFG -m configure set devices device openconfig1 config interfaces interface xintf config name xintf)" 0 ""

new "Completion of interfaces"
expectpart "$(echo "set devices device openconfig1 config interfaces interface ?" | $clixon_cli -f $CFG -m configure 2> /dev/null)" 0 "<name>" "xintf"

new "Delete interface"
expectpart "$($clixon_cli -1 -f $CFG -m configure delete devices device openconfig1 config interfaces interface xintf)" 0 ""
}

if $BE; then
Expand Down

0 comments on commit 8de05d3

Please sign in to comment.