CESNET / libnetconf2

C NETCONF library
BSD 3-Clause "New" or "Revised" License
203 stars 147 forks source link

Disable getting all schemas #421

Closed Zephyre777 closed 8 months ago

Zephyre777 commented 1 year ago

Hello,

I have implemented a client to connect to a router.

I wish to send just one rpc and get a reply after connection setup. But it turned out that at nc_connect_ssh(), it is trying to get all schemas that are supported by the router to fill in context. This process takes at least 3 min for a real router, which is a long time.

What's worse, it sent a close-session request for some strange reason. I am not sure if it has finished with getting all schemas at this point. But then nc_connect_ssh() returns and said cannot connect to server. So the client never send my rpc.

The following is the debug message at the end.

libyang[0]: List's key cannot be of "empty" type until it is in YANG 1.1 module. (path: Path "/ietf-snmp:{augment='/snmp:snmp'}/vacm/group/access/context".)
Session 6555 [DBG]: Sending message:

#140

Session 6555 [DBG]: Sending message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="886"><close-session xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"/></rpc>

Session 6555 [DBG]: Sending message:

##

Session 6555 [WRN]: Timeout for receiving a reply to <close-session> elapsed.
Couldn't connect to the server

I would like to know if there is a way to disable this get-all-schema at the connection setup phase?

Best regards, Zhuoyao

michalvasko commented 1 year ago

No, there is no way to disable getting all the schemas some way because without them the client is unable to work with the data of the server. If you have lots of YANG modules, it may take a long time for them to get downloaded but after that they are also stored locally so the next connection should take much less time in the setup.

libyang[0]: List's key cannot be of "empty" type until it is in YANG 1.1 module. (path: Path "/ietf-snmp:{augment='/snmp:snmp'}/vacm/group/access/context".)

Seems the server sent you some invalid module which is why the client disconnected.