cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
cancel
1162
Views
0
Helpful
5
Replies

How to set connection timeout in NetconfServiceProvider or NetconfSession?

vipaoqun@hotmail.com
Cisco Employee
Cisco Employee

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

MahdiR
Level 1
Level 1

Any solution to this?

yangorelik
Spotlight
Spotlight

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

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.

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

I'm using version 0.8.4

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: