yanglint TEST for option --type rpc and reply
diff --git a/tools/lint/tests/data/modaction.xml b/tools/lint/tests/data/modaction.xml
new file mode 100644
index 0000000..37faa2d
--- /dev/null
+++ b/tools/lint/tests/data/modaction.xml
@@ -0,0 +1,8 @@
+<con xmlns="urn:yanglint:modaction">
+ <ls>
+ <lfkey>kv</lfkey>
+ <act>
+ <lfi>some_input</lfi>
+ </act>
+ </ls>
+</con>
diff --git a/tools/lint/tests/data/modaction_reply.xml b/tools/lint/tests/data/modaction_reply.xml
new file mode 100644
index 0000000..7d6532d
--- /dev/null
+++ b/tools/lint/tests/data/modaction_reply.xml
@@ -0,0 +1,8 @@
+<con xmlns="urn:yanglint:modaction">
+ <ls>
+ <lfkey>kv</lfkey>
+ <act>
+ <lfo>-56</lfo>
+ </act>
+ </ls>
+</con>
diff --git a/tools/lint/tests/data/modrpc.xml b/tools/lint/tests/data/modrpc.xml
new file mode 100644
index 0000000..a4f924d
--- /dev/null
+++ b/tools/lint/tests/data/modrpc.xml
@@ -0,0 +1,3 @@
+<rpc xmlns="urn:yanglint:modrpc">
+ <lfi>some_input</lfi>
+</rpc>
diff --git a/tools/lint/tests/data/modrpc_reply.xml b/tools/lint/tests/data/modrpc_reply.xml
new file mode 100644
index 0000000..632971c
--- /dev/null
+++ b/tools/lint/tests/data/modrpc_reply.xml
@@ -0,0 +1,5 @@
+<rpc xmlns="urn:yanglint:modrpc">
+ <con>
+ <lfo>-56</lfo>
+ </con>
+</rpc>
diff --git a/tools/lint/tests/interactive/data_type.test b/tools/lint/tests/interactive/data_type.test
index bd0b7b0..e4a4679 100644
--- a/tools/lint/tests/interactive/data_type.test
+++ b/tools/lint/tests/interactive/data_type.test
@@ -50,4 +50,32 @@
ly_cmd "data -t edit $ddir/modleafref2.xml"
}}
+test data_type_rpc {Validation of rpc-statement by data --type rpc} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modrpc modleaf"
+ ly_cmd_err "data -t rpc $ddir/modleaf.xml" "Missing the operation node."
+ ly_cmd "data -t rpc $ddir/modrpc.xml"
+}}
+
+test data_type_rpc_reply {Validation of rpc-reply by data --type reply} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modrpc modleaf"
+ ly_cmd_err "data -t rpc $ddir/modleaf.xml" "Missing the operation node."
+ ly_cmd "data -t reply $ddir/modrpc_reply.xml"
+}}
+
+test data_type_rpc_action {Validation of action-statement by data --type rpc} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modaction modleaf"
+ ly_cmd_err "data -t rpc $ddir/modleaf.xml" "Missing the operation node."
+ ly_cmd "data -t rpc $ddir/modaction.xml"
+}}
+
+test data_type_rpc_action_reply {Validation of action-reply by data --type reply} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modaction modleaf"
+ ly_cmd_err "data -t rpc $ddir/modleaf.xml" "Missing the operation node."
+ ly_cmd "data -t reply $ddir/modaction_reply.xml"
+}}
+
cleanupTests
diff --git a/tools/lint/tests/modules/modaction.yang b/tools/lint/tests/modules/modaction.yang
new file mode 100644
index 0000000..5a3f92f
--- /dev/null
+++ b/tools/lint/tests/modules/modaction.yang
@@ -0,0 +1,26 @@
+module modaction {
+ yang-version 1.1;
+ namespace "urn:yanglint:modaction";
+ prefix ma;
+
+ container con {
+ list ls {
+ key "lfkey";
+ leaf lfkey {
+ type string;
+ }
+ action act {
+ input {
+ leaf lfi {
+ type string;
+ }
+ }
+ output {
+ leaf lfo {
+ type int16;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tools/lint/tests/modules/modrpc.yang b/tools/lint/tests/modules/modrpc.yang
new file mode 100644
index 0000000..dc0cced
--- /dev/null
+++ b/tools/lint/tests/modules/modrpc.yang
@@ -0,0 +1,19 @@
+module modrpc {
+ namespace "urn:yanglint:modrpc";
+ prefix mr;
+
+ rpc rpc {
+ input {
+ leaf lfi {
+ type string;
+ }
+ }
+ output {
+ container con {
+ leaf lfo {
+ type int16;
+ }
+ }
+ }
+ }
+}
diff --git a/tools/lint/tests/non-interactive/data_type.test b/tools/lint/tests/non-interactive/data_type.test
index 40d1d02..59de617 100644
--- a/tools/lint/tests/non-interactive/data_type.test
+++ b/tools/lint/tests/non-interactive/data_type.test
@@ -37,4 +37,24 @@
ly_cmd "-t edit $mdir/modleafref.yang $ddir/modleafref2.xml"
} {}
+test data_type_rpc {Validation of rpc-statement by data --type rpc} {
+ ly_cmd_err "-t rpc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing the operation node."
+ ly_cmd "-t rpc $mdir/modrpc.yang $ddir/modrpc.xml"
+} {}
+
+test data_type_rpc_reply {Validation of rpc-reply by data --type reply} {
+ ly_cmd_err "-t rpc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing the operation node."
+ ly_cmd "-t reply $mdir/modrpc.yang $ddir/modrpc_reply.xml"
+} {}
+
+test data_type_rpc_action {Validation of action-statement by data --type rpc} {
+ ly_cmd_err "-t rpc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing the operation node."
+ ly_cmd "-t rpc $mdir/modaction.yang $ddir/modaction.xml"
+} {}
+
+test data_type_rpc_action_reply {Validation of action-reply by data --type reply} {
+ ly_cmd_err "-t rpc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing the operation node."
+ ly_cmd "-t reply $mdir/modaction.yang $ddir/modaction_reply.xml"
+} {}
+
cleanupTests