Golang: SSH connection to devices – stream 46

Опубликовано: 25 Март 2026
на канале: dmfigol live
1,715
35

The recording of the network programmability stream which occurred on 2019/12/8

On this stream I was talking about my reasons to learn Golang for network automation even though I have been programming in Python for 8 years. I was experimenting with connecting to network devices using SSH with Golang and gathering some outputs. It was a little bit harder and more verbose than I expected but I was really impressed by the speed. It took only 2 seconds to collect multiple commands on 10 devices, which is pretty impressive. I will definitely need to learn Go more to feel more comfortable with it.

Timecode:
0:00 – Introduction
1:40 – News/announcements: burnout, Python httpx library, CLEUR 2020
14:10 – My thoughts on Golang vs Python for network automation
28:20 – Finishing my network lab with 10 CSR1000v
38:50 – Installing Golang
51:40 – Copying and understanding the code from the article   / go-and-ssh-for-network-devices  
1:08:10 – Trying Golang debugger
1:21:20 – Establishing SSH connection to a single device
2:29:35 – First test of the program
2:30:50 – Converting the program to support several simultaneous connections (structs + channel + goroutines)
2:44:36 – Testing our changes with multiple devices
3:16:00 – Conclusions, summary and wrap-up

Resources:
A Tour of Go: https://tour.golang.org/
Article I used as a reference material: Go and SSH for network devices   / go-and-ssh-for-network-devices   (his code is available here: https://github.com/vasya4k/runcmd)
Udemy course I am doing: Go: The Complete Developer's Guide (Golang) https://www.udemy.com/course/go-the-c...

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/network-pr...
Twitter:   / dmfigol  
Blog: https://dmfigol.me

Background music (royalty-free):
https://www.pretzel.rocks/