cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
773
Views
5
Helpful
2
Replies

Netmiko timeout doing 'crypto generate key rsa modulus 2048'

spfister336
Level 2
Level 2

I'm using netmiko to make config changes to a large group of Cisco devices. I'm using send_config_set() to apply several commands, the first of which is 'crypto generate key rsa modulus 2048'. This might work on the first handful of devices, but eventually, one switch will take long enough to generate the key that it times out. I've experimented with various delay_factor settings, but nothing seems to allow it to work for all devices. Any ideas?

2 Replies 2

@spfister336 just guessing, you might want to try inserting a small delay between when you start each thread (like .1 seconds or .3 seconds). You will probably have to experiment a bit here though, i would ask also in the netmiko slack or GitHub for best pratice.

 

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hi, 

 

It's been a few years since heavily used netmiko, but IMHO you should consider using Try/Except to catch devices that are timing out and then for those devices try to generate key separately using send_command() method. Since this method will keep waiting to receive data until device prompt is detected before moving into the next line of code, you will not have to worry about setting your script to sleep.