Netmiko timeout doing 'crypto generate key rsa modulus 2048'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 07:02 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 07:25 AM
@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.
Connect with me https://bigevilbeard.github.io
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2022 12:18 PM - edited 04-03-2022 12:19 PM
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.
