Scrapli Asyncio and Paramiko

Scrapli can use Asyncio instead of multi processing or multi threading. Briefly Asyncio is the ability of the script to continue running while waiting for some input/output. The reason you would prefer this over muti threading or processing is becasue Asyncio uses a single thread only reducing any resource issues.

Async is not parrallelism like multi processing or threading, it is concurrency. While waiting for a response it will continue.
I have read that Async is faster than Paramkio for connecting to devices. I created two scripts which use Asyncio and Paramkio with multi threading. There is little difference. Since I added the try statements for any connection failures Paramiko is slightly faster.

All code can be found here

IOSXE and NXOS

I have a lab of 5 devices, 1 IOSXE, 2 Nexus 7k and 2 Nexus 9k. All are GNS3 images.

Async Output

Paramiko Output

IOS 12 And 15

Where Async does fall down (for me atleast) is connecting to older IOS devices. Anything version 12 or 15 in lab always fails due to older SSH ciphers or key exchange. I think there is a way to make this work by adding in transport options. However I was not able to make this work on Ubuntu.

Async Output

Paramiko Output

Leave a Comment

Your email address will not be published. Required fields are marked *