Network Automation with Go

Networking, Cloud & Automation
5 min readFeb 7, 2023

It’s been a month since our book was finally published. In a nutshell, it’s a book about automating network operations and building applications using the Go programming language.

It took Michael and me a year and a half to condense what we have learned about network automation that didn’t seem to be documented elsewhere.

We use Go to tell machines what to do for us, so we start the book with an intro to the language from the lenses of a network engineer, to segue into exploring different network automation use cases.

We tried our best to squeeze in as much relevant content as possible as long as it would keep the book beginners friendly. Of course, we might have crossed the complexity line once or twice. We go from the basics of the language, concurrency and memory allocation, to using protobuf and eBPF filters.

Network Automation with Go’s book cover
Network Automation with Go book cover

Contents

Here is a summary of each of the twelve chapters.

  1. Introduction: Explores networking and Go, the benefits of Go, and how it contrasts with Python.
  2. Go Basics: Defines Go and talks about its guiding principles. It presents the Go source code file structure and shows how to compile Go programs.
  3. Getting Started with Go: covers different characteristics of Go that are relevant for network automation such as control flow, input and output operations, decoding and encoding, and concurrency.
  4. Networking (TCP/IP) with Go: Focuses on practical use cases with Go for each layer of the TCP/IP model.
  5. Network Automation: Discusses what network automation is, its impact on network operations, and its benefits for the business. It also talks about scaling individual use cases into a network automation system.
  6. Configuration Management: Walks us through practical examples using Go to interact with network devices from different networking vendors via SSH and HTTP to configure and collect their operational state to verify any changes.
  7. Automation Frameworks: Describes how some automation frameworks can integrate with Go with an emphasis on Ansible and Terraform.
  8. Network APIs: Takes a look at machine-to-machine interfaces to manage network devices that enable network automation. From RESTCONF and OpenAPI to gRPC.
  9. OpenConfig: Examines how to perform common operational tasks with OpenConfig gRPC services, such as provisioning a device, subscribing to a telemetry stream, and executing an action such as traceroute.
  10. Network Monitoring: Dives into the world of network monitoring from different angles with Go; capturing network packets, processing data plane telemetry, running active probes to measure network performance, and visualizing metrics.
  11. Expert Insights: consists of people who have real-world hands-on experience with network automation and/or are using Go for network-related tasks and activities sharing their perspectives with us.
  12. Appendix: Building a Testing Environment: documents the process of building a testing environment that includes the compatible version of Containerlab and other related dependencies, to make sure you get a seamless experience running examples from any chapter of this book.

What it looks like

We wanted to make sure the code examples were concise and simple to follow, so we worked hard to add syntax highlighting in the book.

pages 144–145
pages 182–183
pages 190–191
pages 276–277

All code examples are available here:

The reception

We are impressed with the positive reception, and the fact they have sold already hundreds of copies. Here are some reactions on social media.

Can’t thank our collaborators enough

From the early proofreaders to the open source contributors that enabled us to create code examples.

Our phenomenal tech reviewers: John McGovern, Chris Luke.

Experts that contributed with insights for the book: David Barroso, Stuart Clark, Claudia de Luna, Alexis de Talhouët, John Doak, Roman Dodin, David Gee, Daniel Hertzberg, Marcus Hines, Sneha Inguva, Antonio Ojea, Matt Oswalt, Carl Montanari, Brent Salisbury, Maximilian Wilhelm.

Talented engineers that provided early feedback: Laura Alonso, Daniel Hertzberg, Maximilian Wilhelm.

Open source project creators: Roman Dodin, Matt Layher, Carl Montanari, Rob Shakir, Jordan Whited.

Where to buy

Conclusions

When we embarked on this journey, we knew we would do this primarily to contribute back to the community, but I can’t deny how cool it feels to become an author (https://www.amazon.com/author/nleiva).

I might need to find a new project to keep me busy on GitHub in the future. You can probably tell when we finished writing the book:

In the meantime, I’ll be back to blogging. Check my last post here:

--

--

Networking, Cloud & Automation

Proud dad working at Red Hat (CCIE, CCDE). Sharing content I create about: networking, automation, programming, golang, ipv6, and open source software.