yanglint TEST for --operational parameter
diff --git a/tools/lint/tests/data/modoper_leafref_notif.xml b/tools/lint/tests/data/modoper_leafref_notif.xml
new file mode 100644
index 0000000..2c56b67
--- /dev/null
+++ b/tools/lint/tests/data/modoper_leafref_notif.xml
@@ -0,0 +1,3 @@
+<notifg xmlns="urn:yanglint:modoper-leafref">
+ <lfr>rw</lfr>
+</notifg>
diff --git a/tools/lint/tests/data/modoper_leafref_notif_err.xml b/tools/lint/tests/data/modoper_leafref_notif_err.xml
new file mode 100644
index 0000000..1622ded
--- /dev/null
+++ b/tools/lint/tests/data/modoper_leafref_notif_err.xml
@@ -0,0 +1,7 @@
+<mcc xmlns="urn:yanglint:modconfig">
+ <lft>rw</lft>
+ <lff>ro</lff>
+</mcc>
+<notifg xmlns="urn:yanglint:modoper-leafref">
+ <lf>rw</lf>
+</notifg>
diff --git a/tools/lint/tests/interactive/data_operational.test b/tools/lint/tests/interactive/data_operational.test
new file mode 100644
index 0000000..3f95daf
--- /dev/null
+++ b/tools/lint/tests/interactive/data_operational.test
@@ -0,0 +1,24 @@
+source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
+
+set ddir "$::env(TESTS_DIR)/data"
+set err1 "Operational datastore takes effect only with RPCs/Actions/Replies/Notifications input data types"
+
+test data_operational_twice {it is not allowed to specify more than one --operational parameter} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modoper-leafref"
+ ly_cmd "data -t notif -O $ddir/modconfig.xml -O $ddir/modleaf.xml" "cannot be set multiple times"
+}}
+
+test data_operational_no_type {--operational should be with parameter --type} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modoper-leafref"
+ ly_cmd_wrn "data -O $ddir/modconfig.xml $ddir/modoper_leafref_notif.xml" $err1
+}}
+
+test data_operational_missing {--operational is omitted and the datastore contents is in the data file} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modoper-leafref"
+ ly_cmd_err "data $ddir/modoper_leafref_notif_err.xml" "Failed to parse input data file"
+}}
+
+cleanupTests
diff --git a/tools/lint/tests/modules/modoper-leafref.yang b/tools/lint/tests/modules/modoper-leafref.yang
new file mode 100644
index 0000000..36a1124
--- /dev/null
+++ b/tools/lint/tests/modules/modoper-leafref.yang
@@ -0,0 +1,68 @@
+module modoper-leafref {
+ yang-version 1.1;
+ namespace "urn:yanglint:modoper-leafref";
+ prefix mol;
+
+ import modconfig {
+ prefix mc;
+ }
+
+ container cond {
+ list list {
+ key "klf";
+ leaf klf {
+ type string;
+ }
+ action act {
+ input {
+ leaf lfi {
+ type leafref {
+ path "/mc:mcc/mc:lft";
+ }
+ }
+ }
+ output {
+ leaf lfo {
+ type leafref {
+ path "/mc:mcc/mc:lft";
+ }
+ }
+ }
+ }
+ notification notif {
+ leaf lfn {
+ type leafref {
+ path "/mc:mcc/mc:lft";
+ }
+ }
+ }
+ }
+ }
+
+ rpc rpcg {
+ input {
+ leaf lfi {
+ type leafref {
+ path "/mc:mcc/mc:lft";
+ }
+ }
+ }
+ output {
+ container cono {
+ leaf lfo {
+ type leafref {
+ path "/mc:mcc/mc:lft";
+ }
+ }
+ }
+ }
+ }
+
+ notification notifg {
+ leaf lfr {
+ type leafref {
+ path "/mc:mcc/mc:lft";
+ }
+ }
+ }
+}
diff --git a/tools/lint/tests/non-interactive/data_operational.test b/tools/lint/tests/non-interactive/data_operational.test
new file mode 100644
index 0000000..3b7daf9
--- /dev/null
+++ b/tools/lint/tests/non-interactive/data_operational.test
@@ -0,0 +1,19 @@
+source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}]
+
+set mdir "$::env(YANG_MODULES_DIR)"
+set ddir "$::env(TESTS_DIR)/data"
+set err1 "Operational datastore takes effect only with RPCs/Actions/Replies/Notification input data types"
+
+test data_operational_twice {it is not allowed to specify more than one --operational parameter} {
+ ly_cmd_err "-t notif -O $ddir/modconfig.xml -O $ddir/modleaf.xml" "cannot be set multiple times"
+} {}
+
+test data_operational_no_type {--operational should be with parameter --type} {
+ ly_cmd_err "-O $ddir/modconfig.xml $mdir/modoper-leafref.yang $ddir/modoper_leafref_notif.xml" $err1
+} {}
+
+test data_operational_missing {--operational is omitted and the datastore contents is in the data file} {
+ ly_cmd_err "$mdir/modoper-leafref.yang $ddir/modoper_leafref_notif_err.xml" "Failed to parse input data file"
+} {}
+
+cleanupTests