blob: 8205d174bbbf98b8239c5173910965152371b3b3 [file] [log] [blame]
aPiecek8858de02023-04-26 14:27:24 +02001source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}]
2
3set mdir "$::env(YANG_MODULES_DIR)"
4set ddir "$::env(TESTS_DIR)/data"
5set err1 "Operational datastore takes effect only with RPCs/Actions/Replies/Notification input data types"
6
7test data_operational_twice {it is not allowed to specify more than one --operational parameter} {
8 ly_cmd_err "-t notif -O $ddir/modconfig.xml -O $ddir/modleaf.xml" "cannot be set multiple times"
9} {}
10
11test data_operational_no_type {--operational should be with parameter --type} {
12 ly_cmd_err "-O $ddir/modconfig.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_notif.xml" $err1
13} {}
14
15test data_operational_missing {--operational is omitted and the datastore contents is in the data file} {
16 ly_cmd_err "$mdir/modoper-leafref.yang $ddir/modoper_leafref_notif_err.xml" "Failed to parse input data file"
17} {}
18
aPiecek90c85162023-04-26 14:30:00 +020019test data_operational_datastore_with_unknown_data {unknown data are ignored} {
20 ly_cmd "-t rpc -O $ddir/modmandatory_invalid.xml $mdir/modrpc.yang $ddir/modrpc.xml"
21} {}
22
aPiecek4386c932023-04-26 14:41:12 +020023test data_operational_notif_leafref {--operational data is referenced from notification-leafref} {
24 ly_cmd "-t notif -O $ddir/modconfig.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_notif.xml"
25} {}
26
27test data_operational_nested_notif_leafref {--operational data is referenced from nested-notification-leafref} {
28 ly_cmd "-t notif -O $ddir/modoper_leafref_ds.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_notif2.xml"
29} {}
30
31test data_operational_nested_notif_parent_missing {--operational data are invalid due to missing parent node} {
32 set msg "klf='key_val']\" not found in the operational data"
33 ly_cmd_err "-t notif -O $ddir/modconfig.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_notif2.xml" $msg
34} {}
35
36test data_operational_action_leafref {--operational data is referenced from action-leafref} {
37 ly_cmd "-t rpc -O $ddir/modoper_leafref_ds.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_action.xml"
38} {}
39
40test data_operational_rpc_leafref {--operational data is referenced from rpc-leafref} {
41 ly_cmd "-t rpc -O $ddir/modconfig.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_rpc.xml"
42} {}
43
aPiecek8858de02023-04-26 14:27:24 +020044cleanupTests