Include presence containers in NetconfAccess::getItems
This patch also changes how the datastore test works a little bit. Empty
strings are a good indicator of "nothing". In case of presence
containers, an empty string means that it is present, so I make use of
boost::optional to represent "nothing".
Change-Id: I820d517a21f6ee7457f698ea49ae2e6eb5a7d2de
diff --git a/src/netconf_access.cpp b/src/netconf_access.cpp
index 1e28bd2..fc35be6 100644
--- a/src/netconf_access.cpp
+++ b/src/netconf_access.cpp
@@ -23,6 +23,14 @@
for (const auto& it : items) {
if (!it)
continue;
+ if (it->schema()->nodetype() == LYS_CONTAINER) {
+ if (libyang::Schema_Node_Container{it->schema()}.presence()) {
+ // The fact that the container is included in the data tree
+ // means that it is present and I don't need to check any
+ // value.
+ res.emplace(it->path(), special_{SpecialValue::PresenceContainer});
+ }
+ }
if (it->schema()->nodetype() == LYS_LIST) {
res.emplace(it->path(), special_{SpecialValue::List});
}