Closed gotthardp closed 2 years ago
Hello,
1) Yes, that is correct. I added another example, that hopefully makes this clear. 2) I have updated to documentation.
Thank you for the suggestion. The change can be seen here https://gerrit.cesnet.cz/c/CzechLight/sysrepo-cpp/+/5595. Let me know if you have any more questions.
Hello. I believe in the documentation there is some confusion around
Session::getData
.(If I understand it well) the
sr_get_data
returns a subtree, i.e. a path from the root to a given node, plus all descendants of this node. Therefore, if someone needs a specific value, one needs to call theDataNode::findPath
first. This is actually quite good, because one can get a subtree and then search multiple related values in it (like latitude and longitude).The documentation however is worded like if
Session::getData
returned the value:1) I believe the example in README works only because the value requested is the root element. If the path was longer, the
findPath
would need be used, right? https://github.com/sysrepo/sysrepo-cpp/blob/b49fc99e919a2de422d0915675573ff6fef2ec4c/README.md?plain=1#L47-L50 2) TheSession::getData
documentation talks about the element to be retrieved and returning requested data which may also be confusing. I believe it returns a full subtree containing that element, not the element itself (hence the need for subsequentfindPath
if one really needs the node data, unless it's a root element, which feels to be a quite rare case in the NETCONF world). https://github.com/sysrepo/sysrepo-cpp/blob/b49fc99e919a2de422d0915675573ff6fef2ec4c/src/Session.cpp#L157-L166(If my suspicion about getData is correct) I suggest to slightly amend the documentation so that newcomers like me better understand how to retrieve data from their trees.