schema compile BUGFIX state data are not sorted (#2179)
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 360e351..560756a 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -2705,10 +2705,10 @@
(node->flags & LYS_IS_OUTPUT) ? "RPC/action output parameters" :
(ctx->compile_opts & LYS_IS_NOTIF) ? "notification content" : "state data", ctx->path);
}
- if (node->flags & (LYS_IS_OUTPUT | LYS_IS_NOTIF)) {
+ if (node->flags & (LYS_IS_OUTPUT | LYS_IS_NOTIF | LYS_CONFIG_R)) {
/* it is probably better not to order them */
node->flags |= LYS_ORDBY_USER;
- } else if (!(node->flags & LYS_ORDBY_MASK) || (node->flags & LYS_CONFIG_R)) {
+ } else if (!(node->flags & LYS_ORDBY_MASK)) {
/* default ordering is system */
node->flags |= LYS_ORDBY_SYSTEM;
}
diff --git a/tests/utests/data/test_merge.c b/tests/utests/data/test_merge.c
index 9a31816..3e7b772 100644
--- a/tests/utests/data/test_merge.c
+++ b/tests/utests/data/test_merge.c
@@ -130,6 +130,24 @@
const char *output_template =
"<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">\n"
" <module>\n"
+ " <name>yang</name>\n"
+ " <revision>2016-02-11</revision>\n"
+ " <namespace>urn:ietf:params:xml:ns:yang:1</namespace>\n"
+ " <conformance-type>implement</conformance-type>\n"
+ " </module>\n"
+ " <module>\n"
+ " <name>ietf-yang-library</name>\n"
+ " <revision>2016-02-01</revision>\n"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>\n"
+ " <conformance-type>implement</conformance-type>\n"
+ " </module>\n"
+ " <module>\n"
+ " <name>ietf-netconf-acm</name>\n"
+ " <revision>2012-02-22</revision>\n"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-netconf-acm</namespace>\n"
+ " <conformance-type>implement</conformance-type>\n"
+ " </module>\n"
+ " <module>\n"
" <name>ietf-netconf</name>\n"
" <revision>2011-06-01</revision>\n"
" <namespace>urn:ietf:params:xml:ns:netconf:base:1.0</namespace>\n"
@@ -142,12 +160,6 @@
" <conformance-type>implement</conformance-type>\n"
" </module>\n"
" <module>\n"
- " <name>ietf-netconf-acm</name>\n"
- " <revision>2012-02-22</revision>\n"
- " <namespace>urn:ietf:params:xml:ns:yang:ietf-netconf-acm</namespace>\n"
- " <conformance-type>implement</conformance-type>\n"
- " </module>\n"
- " <module>\n"
" <name>ietf-netconf-monitoring</name>\n"
" <revision>2010-10-04</revision>\n"
" <namespace>urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring</namespace>\n"
@@ -159,18 +171,6 @@
" <namespace>urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults</namespace>\n"
" <conformance-type>implement</conformance-type>\n"
" </module>\n"
- " <module>\n"
- " <name>ietf-yang-library</name>\n"
- " <revision>2016-02-01</revision>\n"
- " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>\n"
- " <conformance-type>implement</conformance-type>\n"
- " </module>\n"
- " <module>\n"
- " <name>yang</name>\n"
- " <revision>2016-02-11</revision>\n"
- " <namespace>urn:ietf:params:xml:ns:yang:1</namespace>\n"
- " <conformance-type>implement</conformance-type>\n"
- " </module>\n"
"</modules-state>\n";
struct lyd_node *target;