blob: 011936ae7954c50d8133fa493439e439212ecfa5 [file] [log] [blame]
aPiecek8858de02023-04-26 14:27:24 +02001source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
2
3set ddir "$::env(TESTS_DIR)/data"
4set err1 "Operational datastore takes effect only with RPCs/Actions/Replies/Notifications input data types"
5
6test data_operational_twice {it is not allowed to specify more than one --operational parameter} {
7-setup $ly_setup -cleanup $ly_cleanup -body {
8 ly_cmd "load modoper-leafref"
9 ly_cmd "data -t notif -O $ddir/modconfig.xml -O $ddir/modleaf.xml" "cannot be set multiple times"
10}}
11
12test data_operational_no_type {--operational should be with parameter --type} {
13-setup $ly_setup -cleanup $ly_cleanup -body {
14 ly_cmd "load modoper-leafref"
15 ly_cmd_wrn "data -O $ddir/modconfig.xml $ddir/modoper_leafref_notif.xml" $err1
16}}
17
18test data_operational_missing {--operational is omitted and the datastore contents is in the data file} {
19-setup $ly_setup -cleanup $ly_cleanup -body {
20 ly_cmd "load modoper-leafref"
21 ly_cmd_err "data $ddir/modoper_leafref_notif_err.xml" "Failed to parse input data file"
22}}
23
aPiecekce481582023-04-26 15:44:59 +020024test data_operational_wrong_type {data are not defined as an operation} {
25-setup $ly_setup -cleanup $ly_cleanup -body {
26 ly_cmd_wrn "data -t data -O $ddir/modconfig.xml $ddir/modleaf.xml" $err1
27}}
28
aPiecek90c85162023-04-26 14:30:00 +020029test data_operational_datastore_with_unknown_data {unknown data are ignored} {
30-setup $ly_setup -cleanup $ly_cleanup -body {
31 ly_cmd "load modrpc"
32 ly_cmd "data -t rpc -O $ddir/modmandatory_invalid.xml $ddir/modrpc.xml"
33}}
34
aPiecek4386c932023-04-26 14:41:12 +020035test data_operational_notif_leafref {--operational data is referenced from notification-leafref} {
36-setup $ly_setup -cleanup $ly_cleanup -body {
37 ly_cmd "load modoper-leafref"
38 ly_cmd "data -t notif -O $ddir/modconfig.xml $ddir/modoper_leafref_notif.xml"
39}}
40
41test data_operational_nested_notif_leafref {--operational data is referenced from nested-notification-leafref} {
42-setup $ly_setup -cleanup $ly_cleanup -body {
43 ly_cmd "load modoper-leafref"
44 ly_cmd "data -t notif -O $ddir/modoper_leafref_ds.xml $ddir/modoper_leafref_notif2.xml"
45}}
46
47test data_operational_nested_notif_parent_missing {--operational data are invalid due to missing parent node} {
48-setup $ly_setup -cleanup $ly_cleanup -body {
49 ly_cmd "load modoper-leafref"
50 set msg "klf='key_val']\" not found in the operational data"
51 ly_cmd_err "data -t notif -O $ddir/modconfig.xml $ddir/modoper_leafref_notif2.xml" $msg
52}}
53
54test data_operational_action_leafref {--operational data is referenced from action-leafref} {
55-setup $ly_setup -cleanup $ly_cleanup -body {
56 ly_cmd "load modoper-leafref"
57 ly_cmd "data -t rpc -O $ddir/modoper_leafref_ds.xml $ddir/modoper_leafref_action.xml"
58}}
59
60test data_operational_rpc_leafref {--operational data is referenced from rpc-leafref} {
61-setup $ly_setup -cleanup $ly_cleanup -body {
62 ly_cmd "load modoper-leafref"
63 ly_cmd "data -t rpc -O $ddir/modconfig.xml $ddir/modoper_leafref_rpc.xml"
64}}
65
aPiecek8858de02023-04-26 14:27:24 +020066cleanupTests