aPiecek | 8858de0 | 2023-04-26 14:27:24 +0200 | [diff] [blame] | 1 | source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}] |
| 2 | |
| 3 | set ddir "$::env(TESTS_DIR)/data" |
aPiecek | bc39de1 | 2023-06-08 08:10:29 +0200 | [diff] [blame] | 4 | set err1 "Operational datastore takes effect only with RPCs/Actions/Replies/Notification input data types" |
aPiecek | 8858de0 | 2023-04-26 14:27:24 +0200 | [diff] [blame] | 5 | |
| 6 | test 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 | |
| 12 | test 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 | |
| 18 | test 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 | |
aPiecek | ce48158 | 2023-04-26 15:44:59 +0200 | [diff] [blame] | 24 | test 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 | |
aPiecek | 90c8516 | 2023-04-26 14:30:00 +0200 | [diff] [blame] | 29 | test 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 | |
aPiecek | f9b5981 | 2023-04-27 14:40:38 +0200 | [diff] [blame] | 35 | test data_operational_empty_datastore {datastore is considered empty because it contains unknown data} { |
| 36 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 37 | ly_cmd "load modrpc modnotif" |
| 38 | ly_cmd "data -t rpc -O $ddir/modmandatory_invalid.xml $ddir/modrpc.xml" |
| 39 | set msg "parent \"/modnotif:con\" not found in the operational data" |
| 40 | ly_cmd_err "data -t notif -O $ddir/modmandatory_invalid.xml $ddir/modnotif.xml" $msg |
| 41 | }} |
| 42 | |
aPiecek | 4386c93 | 2023-04-26 14:41:12 +0200 | [diff] [blame] | 43 | test data_operational_notif_leafref {--operational data is referenced from notification-leafref} { |
| 44 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 45 | ly_cmd "load modoper-leafref" |
| 46 | ly_cmd "data -t notif -O $ddir/modconfig.xml $ddir/modoper_leafref_notif.xml" |
| 47 | }} |
| 48 | |
| 49 | test data_operational_nested_notif_leafref {--operational data is referenced from nested-notification-leafref} { |
| 50 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 51 | ly_cmd "load modoper-leafref" |
| 52 | ly_cmd "data -t notif -O $ddir/modoper_leafref_ds.xml $ddir/modoper_leafref_notif2.xml" |
| 53 | }} |
| 54 | |
| 55 | test data_operational_nested_notif_parent_missing {--operational data are invalid due to missing parent node} { |
| 56 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 57 | ly_cmd "load modoper-leafref" |
| 58 | set msg "klf='key_val']\" not found in the operational data" |
| 59 | ly_cmd_err "data -t notif -O $ddir/modconfig.xml $ddir/modoper_leafref_notif2.xml" $msg |
| 60 | }} |
| 61 | |
| 62 | test data_operational_action_leafref {--operational data is referenced from action-leafref} { |
| 63 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 64 | ly_cmd "load modoper-leafref" |
| 65 | ly_cmd "data -t rpc -O $ddir/modoper_leafref_ds.xml $ddir/modoper_leafref_action.xml" |
| 66 | }} |
| 67 | |
aPiecek | fc2c9d7 | 2023-05-05 15:42:17 +0200 | [diff] [blame] | 68 | test data_operational_action_reply_leafref {--operational data is referenced from action-leafref output} { |
| 69 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 70 | ly_cmd "load modoper-leafref" |
| 71 | ly_cmd "data -t reply -O $ddir/modoper_leafref_ds.xml $ddir/modoper_leafref_action_reply.xml" |
| 72 | }} |
| 73 | |
aPiecek | 4386c93 | 2023-04-26 14:41:12 +0200 | [diff] [blame] | 74 | test data_operational_rpc_leafref {--operational data is referenced from rpc-leafref} { |
| 75 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 76 | ly_cmd "load modoper-leafref" |
| 77 | ly_cmd "data -t rpc -O $ddir/modconfig.xml $ddir/modoper_leafref_rpc.xml" |
| 78 | }} |
| 79 | |
aPiecek | fc2c9d7 | 2023-05-05 15:42:17 +0200 | [diff] [blame] | 80 | test data_operational_rpc_reply_leafref {--operational data is referenced from rpc-leafref output} { |
| 81 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 82 | ly_cmd "load modoper-leafref" |
| 83 | ly_cmd "data -t reply -O $ddir/modconfig.xml $ddir/modoper_leafref_rpc_reply.xml" |
| 84 | }} |
| 85 | |
aPiecek | 8858de0 | 2023-04-26 14:27:24 +0200 | [diff] [blame] | 86 | cleanupTests |