aPiecek | 8858de0 | 2023-04-26 14:27:24 +0200 | [diff] [blame] | 1 | source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}] |
| 2 | |
| 3 | set mdir "$::env(YANG_MODULES_DIR)" |
| 4 | set ddir "$::env(TESTS_DIR)/data" |
| 5 | set err1 "Operational datastore takes effect only with RPCs/Actions/Replies/Notification input data types" |
| 6 | |
| 7 | test 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 | |
| 11 | test 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 | |
| 15 | test 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 | |
aPiecek | ce48158 | 2023-04-26 15:44:59 +0200 | [diff] [blame] | 19 | test data_operational_wrong_type {data are not defined as an operation} { |
| 20 | ly_cmd_wrn "-t data -O $ddir/modconfig.xml $mdir/modleaf.yang $ddir/modleaf.xml" $err1 |
| 21 | } {} |
| 22 | |
aPiecek | 90c8516 | 2023-04-26 14:30:00 +0200 | [diff] [blame] | 23 | test data_operational_datastore_with_unknown_data {unknown data are ignored} { |
| 24 | ly_cmd "-t rpc -O $ddir/modmandatory_invalid.xml $mdir/modrpc.yang $ddir/modrpc.xml" |
| 25 | } {} |
| 26 | |
aPiecek | f9b5981 | 2023-04-27 14:40:38 +0200 | [diff] [blame] | 27 | test data_operational_empty_datastore {datastore is considered empty because it contains unknown data} { |
| 28 | ly_cmd "-t rpc -O $ddir/modmandatory_invalid.xml $mdir/modrpc.yang $ddir/modrpc.xml" |
| 29 | set msg "parent \"/modnotif:con\" not found in the operational data" |
| 30 | ly_cmd_err "-t notif -O $ddir/modmandatory_invalid.xml $mdir/modnotif.yang $ddir/modnotif.xml" $msg |
| 31 | } {} |
| 32 | |
aPiecek | 4386c93 | 2023-04-26 14:41:12 +0200 | [diff] [blame] | 33 | test data_operational_notif_leafref {--operational data is referenced from notification-leafref} { |
| 34 | ly_cmd "-t notif -O $ddir/modconfig.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_notif.xml" |
| 35 | } {} |
| 36 | |
| 37 | test data_operational_nested_notif_leafref {--operational data is referenced from nested-notification-leafref} { |
| 38 | ly_cmd "-t notif -O $ddir/modoper_leafref_ds.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_notif2.xml" |
| 39 | } {} |
| 40 | |
| 41 | test data_operational_nested_notif_parent_missing {--operational data are invalid due to missing parent node} { |
| 42 | set msg "klf='key_val']\" not found in the operational data" |
| 43 | ly_cmd_err "-t notif -O $ddir/modconfig.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_notif2.xml" $msg |
| 44 | } {} |
| 45 | |
| 46 | test data_operational_action_leafref {--operational data is referenced from action-leafref} { |
| 47 | ly_cmd "-t rpc -O $ddir/modoper_leafref_ds.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_action.xml" |
| 48 | } {} |
| 49 | |
aPiecek | fc2c9d7 | 2023-05-05 15:42:17 +0200 | [diff] [blame] | 50 | test data_operational_action_reply_leafref {--operational data is referenced from action-leafref output} { |
| 51 | ly_cmd "-t reply -O $ddir/modoper_leafref_ds.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_action_reply.xml" |
| 52 | } {} |
| 53 | |
aPiecek | 4386c93 | 2023-04-26 14:41:12 +0200 | [diff] [blame] | 54 | test data_operational_rpc_leafref {--operational data is referenced from rpc-leafref} { |
| 55 | ly_cmd "-t rpc -O $ddir/modconfig.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_rpc.xml" |
| 56 | } {} |
| 57 | |
aPiecek | fc2c9d7 | 2023-05-05 15:42:17 +0200 | [diff] [blame] | 58 | test data_operational_rpc_reply_leafref {--operational data is referenced from rpc-leafref output} { |
| 59 | ly_cmd "-t reply -O $ddir/modconfig.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_rpc_reply.xml" |
| 60 | } {} |
| 61 | |
aPiecek | 8858de0 | 2023-04-26 14:27:24 +0200 | [diff] [blame] | 62 | cleanupTests |