- fix autocli modes error of empty type

- rename tests test_cli_auto -> test_autocli
This commit is contained in:
Olof hagsand 2022-01-13 14:47:25 +01:00
parent e0bcca5405
commit 9b99d63411
8 changed files with 48 additions and 43 deletions

View file

@ -145,6 +145,15 @@ EOF
new "edit table parameter a; show"
expectpart "$(cat $fin | $clixon_cli -f $cfg 2>&1)" 0 "/clixon-example:table/parameter=a/>" "<name>a</name><value>42</value>" --not-- '<table xmlns="urn:example:clixon">' "<parameter>"
cat <<EOF > $fin
edit table
edit parameter
edit a
show config xml
EOF
new "edit table; edit parameter; edit a; show"
expectpart "$(cat $fin | $clixon_cli -f $cfg 2>&1)" 0 "<name>a</name><value>42</value>" --not-- '<table xmlns="urn:example:clixon">' "<parameter>"
cat <<EOF > $fin
edit table
edit parameter a

View file

@ -1,4 +1,3 @@
#!/usr/bin/env bash
# Tests for using the auto cli.
# In particular setting a config, displaying as cli commands and reconfigure it
@ -25,8 +24,6 @@ else
mkdir $clidir
fi
# Use yang in example
if [ ! -d "$OPENCONFIG" ]; then
# err "Hmm Openconfig dir does not seem to exist, try git clone https://github.com/openconfig/public?"
echo "...skipped: OPENCONFIG not set"

View file

@ -71,9 +71,6 @@ CLICON_PROMPT="%U@%H %W> ";
CLICON_PLUGIN="example_cli";
# Autocli syntax tree operations
edit @datamodelshow, cli_auto_edit("basemodel");
up, cli_auto_up("basemodel");
top, cli_auto_top("basemodel");
set @datamodel, cli_auto_set();
merge @datamodel, cli_auto_merge();
create @datamodel, cli_auto_create();

View file

@ -117,8 +117,6 @@ show {
}
auto {
edit @datamodelshow, cli_auto_edit("basemodel");
top, cli_auto_top("basemodel");
set @datamodel, cli_auto_set();
show, cli_auto_show("datamodel", "candidate", "text", true, false);
}
@ -194,8 +192,7 @@ expectpart "$(echo "show $top config parameter ?" | $clixon_cli -f $cfg 2> /dev/
new "Show $top config parameter <name>"
expectpart "$(echo "show $top config parameter a ?" | $clixon_cli -f $cfg 2> /dev/null)" 0 value '<cr>' --not-- '<value>'
# Have not succeeded with this, and I am not sure it is necessary?
# Ie to do "show leaf", but not "show leaf <value>"
# Special mode, to do "show leaf", but not "show leaf <value>"
# <cr> is enabled but no value on leafs
new "Show $top config parameter <name> value"
expectpart "$(echo "show $top config parameter a value ?" | $clixon_cli -f $cfg 2> /dev/null)" 0 '<cr>' --not-- '<value>'