Text syntax parser/loader
Added support for list x y; Uses a mechanism to parse as unknown XML body and post-parsing replace with list keys Fixed example and test to work with new TEXT syntax
This commit is contained in:
parent
0c79298e76
commit
b6bfcb69f7
14 changed files with 227 additions and 377 deletions
|
|
@ -72,10 +72,21 @@ show("Show a particular state of the system"){
|
|||
}
|
||||
configuration("Show configuration"), cli_auto_show("datamodel", "candidate", "text", true, false);{
|
||||
cli("Show configuration as CLI commands"), cli_auto_show("datamodel", "candidate", "cli", true, false, "set ");
|
||||
xml("Show configuration as XML"), cli_auto_show("datamodel", "candidate", "xml", true, false, "set ");
|
||||
}
|
||||
}
|
||||
save("Save candidate configuration to XML file") <filename:string>("Filename (local filename)"), save_config_file("candidate","filename", "xml");
|
||||
load("Load configuration from XML file") <filename:string>("Filename (local filename)"),load_config_file("filename", "replace");
|
||||
save("Save candidate configuration to XML file") <filename:string>("Filename (local filename)"), save_config_file("candidate","filename", "xml"){
|
||||
cli("Save configuration as CLI commands"), save_config_file("candidate","filename", "cli");
|
||||
xml("Save configuration as XML"), save_config_file("candidate","filename", "xml");
|
||||
json("Save configuration as JSON"), save_config_file("candidate","filename", "json");
|
||||
text("Save configuration as TEXT"), save_config_file("candidate","filename", "text");
|
||||
}
|
||||
load("Load configuration from XML file") <filename:string>("Filename (local filename)"),load_config_file("filename", "replace");{
|
||||
cli("Replace candidate with file containing CLI commands"), load_config_file("filename", "replace", "cli");
|
||||
xml("Replace candidate with file containing XML"), load_config_file("filename", "replace", "xml");
|
||||
json("Replace candidate with file containing JSON"), load_config_file("filename", "replace", "json");
|
||||
text("Replace candidate with file containing TEXT"), load_config_file("filename", "replace", "text");
|
||||
}
|
||||
|
||||
rpc("example rpc") <a:string>("routing instance"), example_client_rpc("");
|
||||
|
||||
|
|
@ -154,7 +165,7 @@ new "cli success validate"
|
|||
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 0 "^$"
|
||||
|
||||
new "cli compare diff"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o show compare text)" 0 "+ ip 1.2.3.4;"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o show compare text)" 0 "+ address 1.2.3.4"
|
||||
|
||||
new "cli start shell"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o shell echo foo)" 0 "foo"
|
||||
|
|
@ -162,17 +173,19 @@ expectpart "$($clixon_cli -1 -f $cfg -l o shell echo foo)" 0 "foo"
|
|||
new "cli commit"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o commit)" 0 "^$"
|
||||
|
||||
new "cli save"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o save $dir/foo)" 0 "^$"
|
||||
for format in cli json text xml; do
|
||||
new "cli save $format"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o save $dir/foo $format)" 0 "^$"
|
||||
|
||||
new "cli delete all"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o delete all)" 0 "^$"
|
||||
new "cli delete all"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o delete all)" 0 "^$"
|
||||
|
||||
new "cli load"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o load $dir/foo)" 0 "^$"
|
||||
new "cli load $format"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o load $dir/foo $format)" 0 "^$"
|
||||
|
||||
new "cli check load"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o show conf cli)" 0 "interfaces interface eth/0/0 ipv4 enabled true"
|
||||
new "cli check load"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o show conf cli)" 0 "interfaces interface eth/0/0 ipv4 enabled true"
|
||||
done
|
||||
|
||||
new "cli debug set"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o debug cli 1)" 0 "^$"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue