On this stream Carl Montanari joined me and we were exploring his Python library for SSH connection to network devices.
This library achieves similar goals as netmiko, but I do think scrapli is better. Here is why:
scrapli supports multiple transports (paramiko, ssh2, system ssh client) with ssh2 being very fast and efficient
scrapli operations return response objects instead of raw output (similar to requests). This makes development experience much better as we don't need to guess the return type.
scrapli docs/readme are great and give you everything you need to use the library
scrapli does not use on any timing mechanisms (e.g. delay_factor and max_loops used in netmiko), instead it uses an infinite loop and operation timeouts, making it significantly more reliable than netmiko, especially in multi-threaded environment.
has nornir plugin (nornir-scrapli)
NETCONF client using scrapli (scrapli-netconf)
has a way to work with non-supported platforms pretty easy
100% type annotated
Personally, I am using scrapli in all my active projects instead of netmiko and I love it. I can definitely recommend to check out this library.
Big thanks to Carl for joining me as well as his contributions to network automation!
Timecode:
0:00 – Introduction
0:30 – Discussing with Carl the state of network automation
9:00 – History of scrapli, why develop it?
11:15 – ssh2python and why it is useful for network automation
17:00 – Speed of netmiko vs scrapli with ssh2
23:25 – scrapli main features and why not netmiko
32:15 – supported network operating systems and how to add your own platform
47:10 – netmiko implementation details: timing mechanism and how this problem is solved in scrapli
59:50 – scrapli docs
1:03:30 – Exploring scrapli
1:23:55 – scrapli response object
1:34:35 – textfsm/genie integration
1:39:00 – Configuration change with scrapli
1:48:45 – Using GenericDriver for non-core platforms
1:54:30 – comparing speed between scrapli and netmiko
2:40:00 – scrapli plugin for nornir
2:43:35 – NETCONF with scrapli
2:54:30 – Is scrapli production-ready?
3:00:00 – What to do if I want to use scrapli, but my platform is not supported?
3:05:35 – Conclusions, summary and wrap-up of the stream
Resources:
Carl's twitter: / carlrmontanari
scrapli docs: https://carlmontanari.github.io/scrapli/
scrapli API reference: https://carlmontanari.github.io/scrap...
nornir-scrapli: https://carlmontanari.github.io/norni...
scrapli-netconf: https://scrapli.github.io/scrapli_net...
Please note that this content is stream-first and it is slow-paced by design. I recommend increasing playback speed in the player settings.
Don't miss my upcoming streams at / dmfigol
The code is on my GitHub: https://github.com/dmfigol/netwarden
Twitter: / dmfigol
Blog: https://dmfigol.me
Background music (royalty-free):
https://www.pretzel.rocks/