yanglint FEATURE nc-rpc in the interactive mode
diff --git a/tools/lint/cmd_data.c b/tools/lint/cmd_data.c
index b177704..5ffe414 100644
--- a/tools/lint/cmd_data.c
+++ b/tools/lint/cmd_data.c
@@ -47,6 +47,8 @@
" edit - Content of the NETCONF <edit-config> operation.\n"
" rpc - Content of the NETCONF <rpc> message, defined as YANG's\n"
" RPC/Action input statement.\n"
+ " nc-rpc - Similar to 'rpc' but expect and check also the NETCONF\n"
+ " envelopes <rpc> or <action>.\n"
" reply - Reply to the RPC/Action. Note that the reply data are\n"
" expected inside a container representing the original\n"
" RPC/Action. This is necessary to identify appropriate\n"
@@ -231,6 +233,8 @@
options_parse |= LYD_PARSE_ONLY | LYD_PARSE_NO_STATE;
} else if (!strcasecmp(optarg, "rpc") || !strcasecmp(optarg, "action")) {
data_type = LYD_TYPE_RPC_YANG;
+ } else if (!strcasecmp(optarg, "nc-rpc")) {
+ data_type = LYD_TYPE_RPC_NETCONF;
} else if (!strcasecmp(optarg, "reply") || !strcasecmp(optarg, "rpcreply")) {
data_type = LYD_TYPE_REPLY_YANG;
} else if (!strcasecmp(optarg, "notif") || !strcasecmp(optarg, "notification")) {
diff --git a/tools/lint/tests/data/modrpc_nc.xml b/tools/lint/tests/data/modrpc_nc.xml
new file mode 100644
index 0000000..78d3149
--- /dev/null
+++ b/tools/lint/tests/data/modrpc_nc.xml
@@ -0,0 +1,6 @@
+<rpc message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <rpc xmlns="urn:yanglint:modrpc">
+ <lfi>some_input</lfi>
+ </rpc>
+</rpc>
diff --git a/tools/lint/tests/interactive/data_type.test b/tools/lint/tests/interactive/data_type.test
index f0538ce..85d602e 100644
--- a/tools/lint/tests/interactive/data_type.test
+++ b/tools/lint/tests/interactive/data_type.test
@@ -57,6 +57,13 @@
ly_cmd "data -t rpc $ddir/modrpc.xml"
}}
+test data_type_rpc_nc {Validation of rpc-statement by data --type nc-rpc} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modrpc modleaf ietf-netconf"
+ ly_cmd_err "data -t nc-rpc $ddir/modleaf.xml" "Missing NETCONF <rpc> envelope"
+ ly_cmd "data -t nc-rpc $ddir/modrpc_nc.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"
diff --git a/tools/lint/tests/non-interactive/data_type.test b/tools/lint/tests/non-interactive/data_type.test
index 1396b36..fa19258 100644
--- a/tools/lint/tests/non-interactive/data_type.test
+++ b/tools/lint/tests/non-interactive/data_type.test
@@ -2,6 +2,7 @@
set mdir "$::env(YANG_MODULES_DIR)"
set ddir "$::env(TESTS_DIR)/data"
+set modnc "$mdir/ietf-netconf@2011-06-01.yang"
test data_type_data {data --type data} {
ly_cmd "-t data $mdir/modconfig.yang $ddir/modconfig.xml"
@@ -42,6 +43,11 @@
ly_cmd "-t rpc $mdir/modrpc.yang $ddir/modrpc.xml"
} {}
+test data_type_rpc_nc {Validation of rpc-statement by data --type nc-rpc} {
+ ly_cmd_err "-t nc-rpc $modnc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing NETCONF <rpc> envelope"
+ ly_cmd "-t nc-rpc $modnc $mdir/modrpc.yang $ddir/modrpc_nc.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"