Fix leafDataFromValue

Leafrefs were not working correctly, when pointing to a data node not in
the tree. Because of this I had to rework the thing a little bit (I
basically copied the algorithm from cla-sysrepo, where I had the same
issue). I also changed the name. And also added test, both versions of
leafref included.

Funnily enough, it seems that I was already fixing this before, but for
some reason the bug appeared again while using netconf-cli, oh well, now
the tests should cover that hopefully.

Change-Id: I8a102c54bf58a4221610c8a83d26979fb7b4461d
diff --git a/src/netconf_access.cpp b/src/netconf_access.cpp
index 307ccf1..2c64cd4 100644
--- a/src/netconf_access.cpp
+++ b/src/netconf_access.cpp
@@ -232,9 +232,8 @@
 
         // 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()) {
-            auto leafData = libyang::Data_Node_Leaf_List{keyLeaf};
-            auto leafSchema = libyang::Schema_Node_Leaf{leafData.schema()};
-            instanceRes.insert({ leafSchema.name(), leafValueFromValue(leafData.value(), leafSchema.type()->base())});
+            auto leafData = std::make_shared<libyang::Data_Node_Leaf_List>(keyLeaf);
+            instanceRes.insert({ leafData->schema()->name(), leafValueFromNode(leafData)});
         }
         res.emplace_back(instanceRes);
     }