hotfix: Handle netopeer2 sending too much data
Change-Id: I55f4c05622b3efd9cec922347ba5c3932fed46fc
diff --git a/src/netconf_access.cpp b/src/netconf_access.cpp
index 64e2f76..e3fbb1c 100644
--- a/src/netconf_access.cpp
+++ b/src/netconf_access.cpp
@@ -222,6 +222,16 @@
// I take the first child here, because the first element (the parent of the child()) will be the list
for (const auto& keyLeaf : instance->child()->tree_for()) {
+ // FIXME: even though we specified we only want the key leafs, Netopeer disregards that and sends more data,
+ // even lists and other stuff. We only want keys, so filter out non-leafs and non-keys
+ // https://github.com/CESNET/netopeer2/issues/825
+ if (keyLeaf->schema()->nodetype() != LYS_LEAF) {
+ continue;
+ }
+ if (!std::make_shared<libyang::Schema_Node_Leaf>(keyLeaf->schema())->is_key()) {
+ continue;
+ }
+
auto leafData = std::make_shared<libyang::Data_Node_Leaf_List>(keyLeaf);
instanceRes.insert({leafData->schema()->name(), leafValueFromNode(leafData)});
}