CESNET / netopeer2

NETCONF toolset
BSD 3-Clause "New" or "Revised" License
296 stars 187 forks source link

netopeer2-server -t 30 didn't work #1441

Open PeterYFPeng opened 1 year ago

michalvasko commented 1 year ago

Perhaps include some more details? I have no idea why you think it did not work.

PeterYFPeng commented 1 year ago

I wrote a peter.yang. And in sysrepo, I wrote a plugins. I used sleep(5) to make a timeout situation.

static int
peter_state_cb(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *path,
        const char *request_xpath, uint32_t request_id, struct lyd_node **parent, void *private_data)
{

    (void)session;
    (void)sub_id;
    (void)module_name;
    (void)path;
    (void)request_xpath;
    (void)request_id;
    (void)private_data;

    SRPLG_LOG_INF("peter", "peter_state_cb");
    sleep(5);

    return SR_ERR_OK;
}

And then I started sysrepo-plugind.

root@G6004320-PC-1:/usr/local/lib/sysrepo-plugind/plugins# sysrepo-plugind -d -v3
[INF] Connection 52 created.
[INF] Session 221 (user "root", CID 52) created.
[INF] Triggering "sysrepo-plugind" "done" event on enabled data.
[INF] sysrepo-plugind: Plugin "srpd_rotation" initialized.
[INF] Triggering "sysrepo-plugind" "enabled" event on enabled data.
[INF] Triggering "sysrepo-plugind" "done" event on enabled data.
[INF] sysrepo-plugind: Plugin "srpd_oper_poll_diff" initialized.
[INF] Triggering "peter" "done" event on enabled data.
[INF] peter: peter_config_change_cb
[INF] sysrepo-plugind: Plugin "peter" initialized.

And then I started netconf server using "netopeer2-server -d -v 3 -t 30".

Then I used netopeer2-cli to connect to server and get data of peter.pang

> connect --login=peter
peter@localhost password: 
> get-data --datastore operational --filter-xpath /peter:root
cli_send_recv: Timeout for receiving a reply expired.
> 

Timeout still existed. I don't the reason why '-t 30' did not work.

michalvasko commented 1 year ago

It is the client that timed out, run > get-data --datastore operational --filter-xpath /peter:root --rpc-timeout 30, for example, and it should work.

PeterYFPeng commented 1 year ago

Thanks. That means I need to set '-t' to avoid timeout of sysrepo and then the client need to set timeout too.

michalvasko commented 1 year ago

Yes, they are separate and generally different although not that much in practice.