blob: e253d1ae72c3a3772aacf8d9ec3f67fbe4bf57cb [file] [log] [blame]
aPiecek647f62e2023-05-18 10:55:58 +02001source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
2
3set mdir "$::env(YANG_MODULES_DIR)"
4set ddir "$::env(TESTS_DIR)/data"
5
6test extdata_set_clear {Set and clear extdata file} {
7-setup $ly_setup -cleanup $ly_cleanup -body {
8 ly_cmd "extdata" "No file set"
9 ly_cmd "extdata $ddir/modsm_ctx_ext.xml"
10 ly_cmd "extdata" "$ddir/modsm_ctx_ext.xml"
11 ly_cmd "extdata -c"
12 ly_cmd "extdata" "No file set"
13}}
14
15test extdata_clear_cmd {Clear extdata file by 'clear' command} {
16-setup $ly_setup -cleanup $ly_cleanup -body {
17 ly_cmd "extdata $ddir/modsm_ctx_ext.xml"
18 ly_cmd "clear"
19 ly_cmd "extdata" "No file set"
20}}
21
22test extdata_one_only {Only one file for extdata} {
23-setup $ly_setup -cleanup $ly_cleanup -body {
24 ly_cmd_err "extdata $ddir/modsm_ctx_ext.xml $ddir/modsm_ctx_ext.xml" "Only one file must be entered"
25}}
26
27test extdata_schema_mount_tree {Print tree output of a model with Schema Mount} {
28-setup $ly_setup -cleanup $ly_cleanup -body {
29 ly_cmd "clear -y"
30 ly_cmd "searchpath $mdir"
31 ly_cmd "load modsm"
32 ly_cmd "extdata $ddir/modsm_ctx_ext.xml"
33 ly_cmd "print -f tree modsm" "--mp root.*--rw lfl/"
34}}
35
aPiecek21c1bc82023-05-18 15:38:31 +020036test ext_data_schema_mount_tree_yanglibfile {Print tree output of a model with Schema Mount and --yang-library-file} {
37-setup $ly_setup -cleanup $ly_cleanup -body {
38 ly_cmd "clear -Y $ddir/modsm_ctx_main.xml"
39 ly_cmd "searchpath $mdir"
40 ly_cmd "load modsm"
41 ly_cmd "extdata $ddir/modsm_ctx_ext.xml"
42 ly_cmd "print -f tree modsm" "--mp root.*--rw lfl/.*--rw msa:alf?"
43}}
44
aPiecek647f62e2023-05-18 10:55:58 +020045test ext_data_schema_mount_xml {Validating and printing mounted data} {
46-setup $ly_setup -cleanup $ly_cleanup -body {
47 ly_cmd "clear -y"
48 ly_cmd "searchpath $mdir"
49 ly_cmd "load modsm"
50 ly_cmd "extdata $ddir/modsm_ctx_ext.xml"
51 ly_cmd "data -f xml -t config $ddir/modsm.xml" "</lfl>"
52}}
53
aPiecek21c1bc82023-05-18 15:38:31 +020054test ext_data_schema_mount_xml_yanglibfile {Validating and printing mounted data with --yang-library-file} {
55-setup $ly_setup -cleanup $ly_cleanup -body {
56 ly_cmd "clear -Y $ddir/modsm_ctx_main.xml"
57 ly_cmd "searchpath $mdir"
58 ly_cmd "load modsm"
59 ly_cmd "extdata $ddir/modsm_ctx_ext.xml"
60 ly_cmd "data -f xml -t config $ddir/modsm2.xml" "</lfl>.*</alf>"
61}}
62
aPiecek647f62e2023-05-18 10:55:58 +020063cleanupTests