Git Product home page Git Product logo

Comments (6)

amamory avatar amamory commented on July 22, 2024 1

I see, sr_get_node can only be used for leafs, is that it ?

If that so, The fact that it returns sr_data_t instead of sr_val_t might seen a bit misleading.
I was also influenced by this part of the doc

  *Compared to ::sr_get_data() or ::sr_get_subtree() this function is a bit more efficient because it returns*

Which made me believe that sr_get_node was equivalent to sr_get_data. But perhaps, it's more similar to sr_get_item ?!?!

thank you for the clarification !

from sysrepo.

michalvasko avatar michalvasko commented on July 22, 2024

Print the actual error message to learn the reason for the error.

from sysrepo.

amamory avatar amamory commented on July 22, 2024

I updated the original description to make it clear that it refers to SR_ERR_INVAL_ARG error code.
Is that what you meant ?

from sysrepo.

michalvasko avatar michalvasko commented on July 22, 2024

No, I meant an actual error message. Unless you passed NULL as one of the parameters, there is also a detailed error, which is printed if you enable it using sr_log_stderr() or you can retrieve it in a structure from the session using sr_session_get_error().

from sysrepo.

amamory avatar amamory commented on July 22, 2024

I am running with

sr_log_stderr(SR_LL_DBG);

the piece of code is only this, that can be easily added to any existing examples

    printf("sr_get_node ...\n");
    rc = sr_get_node(session, xpath, 0, &node_data);
    if (rc != SR_ERR_OK)
    {
        printf("sr_get_node (running) error: %d - %s\n", rc, sr_strerror(rc));
    }
    printf("sr_get_node (running) done\n");

the session datastore doesnt matter. i tried several and the result is the same

and the printed result is :

sr_get_node ...
[ERR] More nodes match "/test_examples:cont/l".
sr_get_node (running) error: 1 - Invalid argument
sr_get_node (running) done

please, let me know if you need further info. If you just replace the function sr_get_node by sr_get_data, the same leaf-list path works. That's why i suspect if might be something particular with sr_get_node.

from sysrepo.

michalvasko avatar michalvasko commented on July 22, 2024

I am not sure what is unclear about this then. There is the error:

[ERR] More nodes match "/test_examples:cont/l".

and there is even a clear documentation

sysrepo/src/sysrepo.h

Lines 837 to 840 in d57c495

* @return Error code (::SR_ERR_OK on success, ::SR_ERR_INVAL_ARG if multiple nodes match the path,
* ::SR_ERR_NOT_FOUND if no nodes match the path).
*/
int sr_get_node(sr_session_ctx_t *session, const char *path, uint32_t timeout_ms, sr_data_t **node);

from sysrepo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.