Change DatastoreAccess::Tree typedef
Before this, the order of items we get in DatastoreAccess::getItems
wasn't preserved. Because (leaf)lists can be ordered, we need to
preserver the order.
Change-Id: Ie4914025b7d868fd9cbbea5e4f1498115030d126
diff --git a/tests/datastore_access.cpp b/tests/datastore_access.cpp
index e11eec5..07320c9 100644
--- a/tests/datastore_access.cpp
+++ b/tests/datastore_access.cpp
@@ -202,7 +202,7 @@
datastore.commitChanges();
}
- DatastoreAccess::Tree expected{{"/example-schema:down", bool{false}},
+ DatastoreAccess::Tree expected{
// Sysrepo always returns containers when getting values, but
// libnetconf does not. This is fine by the YANG standard:
// https://tools.ietf.org/html/rfc7950#section-7.5.7 Furthermore,
@@ -212,10 +212,11 @@
// because it'll use the same data structure as libnetconf, so the
// results will be consistent.
#ifdef sysrepo_BACKEND
- {"/example-schema:lol", special_{SpecialValue::Container}},
{"/example-schema:inventory", special_{SpecialValue::Container}},
+ {"/example-schema:lol", special_{SpecialValue::Container}},
#endif
- {"/example-schema:up", bool{true}}};
+ {"/example-schema:up", bool{true}},
+ {"/example-schema:down", bool{false}}};
REQUIRE(datastore.getItems("/example-schema:*") == expected);
}
diff --git a/tests/python_netconfaccess.py b/tests/python_netconfaccess.py
index a4f6c94..b04eb24 100644
--- a/tests/python_netconfaccess.py
+++ b/tests/python_netconfaccess.py
@@ -2,7 +2,7 @@
c = nc.NetconfAccess(socketPath = "@NETOPEER_SOCKET_PATH@")
data = c.getItems("/ietf-netconf-server:netconf-server")
-for (k, v) in data.items():
+for (k, v) in data:
print(f"{k}: {type(v)} {v}", flush=True)
if len(data) == 0:
@@ -14,9 +14,10 @@
c.setLeaf(hello_timeout_xp, EXPECTED)
c.commitChanges()
data = c.getItems(hello_timeout_xp)
- if (data[hello_timeout_xp] != EXPECTED):
+ (_, value) = next(filter(lambda keyValue: keyValue[0] == hello_timeout_xp, data))
+ if value != EXPECTED:
if isinstance(EXPECTED, str):
- if str(data[hello_timeout_xp]) != EXPECTED:
+ if str(value) != EXPECTED:
print(f"ERROR: hello-timeout not updated (via string) to {EXPECTED}")
exit(1)
else: