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/sysrepo_access.cpp b/src/sysrepo_access.cpp
index 6176f67..cdaff49 100644
--- a/src/sysrepo_access.cpp
+++ b/src/sysrepo_access.cpp
@@ -419,8 +419,8 @@
         ListInstance instanceRes;
         for (const auto& key : keys) {
             auto vec = wantedList->find_path(key->name())->data();
-            auto leaf = libyang::Data_Node_Leaf_List{*(vec.begin())};
-            instanceRes.emplace(key->name(), leafValueFromValue(leaf.value(), leaf.leaf_type()->base()));
+            auto leaf = std::make_shared<libyang::Data_Node_Leaf_List>(*(vec.begin()));
+            instanceRes.emplace(key->name(), leafValueFromNode(leaf));
         }
         res.emplace_back(instanceRes);
     }