cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
478
Views
0
Helpful
5
Replies
Highlighted
Cisco Employee

How to set connection timeout in NetconfServiceProvider or NetconfSession?

Hi team,

I'm trying to cut down the NetconfSession is trying to open a netconf session to an unreachable host, the example below it takes about 130s until the instance comes back.

provider = NetconfServiceProvider(address=kwargs.get("host"),
                                  port=kwargs.get("port"),
                                  username=kwargs.get("auth").get("user"),
                                  password=kwargs.get("auth").get("passwd"),
                                  protocol=kwargs.get("protocol"),
                                  timeout=0)

and I had tried to change the timeout to 60s(60*1000), but it seems no difference:

provider = NetconfServiceProvider(address=kwargs.get("host"),
                                  port=kwargs.get("port"),
                                  username=kwargs.get("auth").get("user"),
                                  password=kwargs.get("auth").get("passwd"),
                                  protocol=kwargs.get("protocol"),
                                  timeout=60*1000)

So, what is the default timeout for NetconfSession timeout? and how to change the timeout for the NetconfSession?

Thanks.

 

5 REPLIES 5
Highlighted
Beginner

Any solution to this?

Highlighted
Participant

By default the timeout set to -1, which means not limited. By setting the timeout value to some other number you define the maximum delay.

Yan Gorelik
YDK Solutions
Highlighted

The timeout parameter in provider doesn't seem to have any effect. I've used timeout=5000000 which should equal to 5 seconds, but when I try to run the code on an unreachable device, nothing happens after 5 seconds. The code gets stuck, waiting for response.

Highlighted

I understand that you cut down connectivity after the connection hd been established. Similar issue was resolved some time ago. In this regards I wonder what YDK release are you using?

Yan Gorelik
YDK Solutions
Highlighted

I'm using version 0.8.4

This widget could not be displayed.