yanglint FEATURE nc-notif in the interactive mode
diff --git a/tools/lint/cmd_data.c b/tools/lint/cmd_data.c
index 85ef5ee..2c1aa33 100644
--- a/tools/lint/cmd_data.c
+++ b/tools/lint/cmd_data.c
@@ -58,7 +58,10 @@
" RPC/Action. This is necessary to identify appropriate\n"
" data definitions in the schema module.\n"
" notif - Notification instance (content of the <notification>\n"
- " element without <eventTime>).\n");
+ " element without <eventTime>).\n"
+ " nc-notif - Similar to 'notif' but expect and check also the NETCONF\n"
+ " envelope <notification> with element <eventTime> and its\n"
+ " sibling as the actual notification.\n");
}
static void
@@ -272,6 +275,8 @@
data_type = LYD_TYPE_REPLY_YANG;
} else if (!strcasecmp(optarg, "notif") || !strcasecmp(optarg, "notification")) {
data_type = LYD_TYPE_NOTIF_YANG;
+ } else if (!strcasecmp(optarg, "nc-notif")) {
+ data_type = LYD_TYPE_NOTIF_NETCONF;
} else if (!strcasecmp(optarg, "data")) {
/* default option */
} else {
diff --git a/tools/lint/tests/data/modnotif2_nc.xml b/tools/lint/tests/data/modnotif2_nc.xml
new file mode 100644
index 0000000..c87cfa0
--- /dev/null
+++ b/tools/lint/tests/data/modnotif2_nc.xml
@@ -0,0 +1,6 @@
+<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
+ <eventTime>2010-12-06T08:00:01Z</eventTime>
+ <nfg xmlns="urn:yanglint:modnotif">
+ <lf>top</lf>
+ </nfg>
+</notification>
diff --git a/tools/lint/tests/data/modnotif_nc.xml b/tools/lint/tests/data/modnotif_nc.xml
new file mode 100644
index 0000000..39a3440
--- /dev/null
+++ b/tools/lint/tests/data/modnotif_nc.xml
@@ -0,0 +1,8 @@
+<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
+ <eventTime>2010-12-06T08:00:01Z</eventTime>
+ <con xmlns="urn:yanglint:modnotif">
+ <nfn>
+ <lf>nested</lf>
+ </nfn>
+ </con>
+</notification>
diff --git a/tools/lint/tests/interactive/data_type.test b/tools/lint/tests/interactive/data_type.test
index 85d602e..1e8e900 100644
--- a/tools/lint/tests/interactive/data_type.test
+++ b/tools/lint/tests/interactive/data_type.test
@@ -92,10 +92,24 @@
ly_cmd "data -t notif $ddir/modnotif2.xml"
}}
+test data_type_notif_nc {Validation of notification-statement by data --type nc-notif} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modnotif modleaf ietf-netconf"
+ ly_cmd_err "data -t nc-notif $ddir/modleaf.xml" "Missing NETCONF <notification> envelope"
+ ly_cmd "data -t nc-notif $ddir/modnotif2_nc.xml"
+}}
+
test data_type_notif_nested {Validation of nested-notification-statement by data --type notif} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load modnotif modleaf"
ly_cmd "data -t notif -O $ddir/modnotif_ds.xml $ddir/modnotif.xml"
}}
+test data_type_notif_nested_nc {Validation of nested-notification-statement by data --type nc-notif} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modnotif modleaf ietf-netconf"
+ ly_cmd_err "data -t nc-notif $ddir/modleaf.xml" "Missing NETCONF <notification> envelope"
+ ly_cmd "data -t nc-notif -O $ddir/modnotif_ds.xml $ddir/modnotif_nc.xml"
+}}
+
cleanupTests
diff --git a/tools/lint/tests/non-interactive/data_type.test b/tools/lint/tests/non-interactive/data_type.test
index fa19258..a24dea3 100644
--- a/tools/lint/tests/non-interactive/data_type.test
+++ b/tools/lint/tests/non-interactive/data_type.test
@@ -68,8 +68,18 @@
ly_cmd "-t notif $mdir/modnotif.yang $ddir/modnotif2.xml"
} {}
+test data_type_notif_nc {Validation of notification-statement by data --type nc-notif} {
+ ly_cmd_err "-t nc-notif $modnc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing NETCONF <notification> envelope"
+ ly_cmd "-t nc-notif $modnc $mdir/modnotif.yang $ddir/modnotif2_nc.xml"
+} {}
+
test data_type_notif_nested {Validation of nested-notification-statement by data --type notif} {
ly_cmd "-t notif -O $ddir/modnotif_ds.xml $mdir/modnotif.yang $ddir/modnotif.xml"
} {}
+test data_type_notif_nested_nc {Validation of nested-notification-statement by data --type nc-notif} {
+ ly_cmd_err "-t nc-notif $modnc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing NETCONF <notification> envelope"
+ ly_cmd "-t nc-notif -O $ddir/modnotif_ds.xml $modnc $mdir/modnotif.yang $ddir/modnotif_nc.xml"
+} {}
+
cleanupTests