Network Automation with Go: Learn how to automate network operations and build applications using the Go programming language
β Scribed by Nicolas Leiva, Michael Kashin
- Publisher
- Packt Publishing
- Year
- 2023
- Tongue
- English
- Leaves
- 443
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Synopsis
Understand the world of modern network automation with Go and deepen your knowledge with insights from 10+ experts who have real-world hands-on experience with network automation and/or are using Go for network-related tasks
Key Features
- A comprehensive guide to the world of modern network automation
- Use Go to build anything from repetitive task automation to complex distributed systems
- Over 30 practical, ready-to-use sample programs
Book Description
Go's built-in first-class concurrency mechanisms make it an ideal choice for long-lived low-bandwidth I/O operations, which are typical requirements of network automation and network operations applications.
This book provides a quick overview of Go and hands-on examples within it to help you become proficient with Go for network automation. It's a practical guide that will teach you how to automate common network operations and build systems using Go.
The first part takes you through a general overview, use cases, strengths, and inherent weaknesses of Go to prepare you for a deeper dive into network automation, which is heavily reliant on understanding this programming language. You'll explore the common network automation areas and challenges, what language features you can use in each of those areas, and the common software tools and packages. To help deepen your understanding, you'll also work through real-world network automation problems and apply hands-on solutions to them.
By the end of this book, you'll be well-versed with Go and have a solid grasp on network automation.
What you will learn
- Understand Go programming language basics via network-related examples
- Find out what features make Go a powerful alternative for network automation
- Explore network automation goals, benefits, and common use cases
- Discover how to interact with network devices using a variety of technologies
- Integrate Go programs into an automation framework
- Take advantage of the OpenConfig ecosystem with Go
- Build distributed and scalable systems for network observability
Who this book is for
This book is for all network engineers, administrators, and other network practitioners looking to understand what network automation is and how the Go programming language can help develop network automation solutions. As the first part of the book offers a comprehensive overview of Go's main features, this book is suitable for beginners with a solid grasp on programming basics.
Table of Contents
- Introduction
- Go Basics
- Getting Started with Go
- Networking (TCP/IP) with Go
- Network Automation
- Configuration Management
- Automation Frameworks
- Network APIs
- OpenConfig
- Network Monitoring
- Expert Insights
- Appendix: Building a Testing Environment
β¦ Table of Contents
Cover
Title Page
Copyright and Credits
Contributors
Table of Contents
Preface
Part 1: The Go Programming Language
Chapter 1: Introduction
Technical requirements
Networking and Go
Why Go?
Non-technical reasons
The future of Go
Technical reasons
Go for networking
Go versus Python
Code execution
Type system
Performance
Ease of use
Memory management
Syntax
Failure handling
Concurrency
Community
Installing Go on your computer
Windows
Mac
Linux
Summary
Further reading
Chapter 2: Go Basics
Technical requirements
What is Go?
Go Proverbs
Go source code files
Packages
Go modules
Importing packages
Comments
Names
Executing your Go code
Running Go programs online
The Go Playground
The Go Play Space
A look into the Future
The Go tool
Build
Run
Mod
Get
Install
Fmt
Test
Env
Summary
Further reading
Chapter 3: Getting Started with Go
Technical requirements
Goβs type system
Basic types
Container types
User-defined types
Arithmetic, comparison, and logical operators
Arithmetic operators
Logical operators
Comparison operators
Control flow
for loops
Conditional statements
goto statements
Functions
Function arguments
Error handling
Methods
Variadic functions
Closures
Defer
Interfaces
Network automation example
Standard library example
Interfaces as contracts
Input and output operations
The io.Reader interface
The io.Writer interface
The io.Copy function
Composition
Decoding and encoding
Decoding
Encoding
Concurrency
Goroutines
Channels
Channels and Timers
Shared data access
Concurrency caveats
Summary
Further reading
Chapter 4: Networking (TCP/IP) with Go
Technical requirements
The link layer
Network interfaces
Ethernet
The internet layer
The net package
The New netip package
Working with IP addresses
Route lookups
The transport layer
UDP ping application
The application layer
Working with an HTTP client
Working with an HTTP (server)
Summary
Further reading
Part 2: Common Tools and Frameworks
Chapter 5: Network Automation
Technical requirements
What is network automation?
Why network automation exists
Bottom-up view
Top-down view
Automating network operation tasks
Configuration management
Network state analysis
Network audits and reporting
Systems approach
Closed-loop automation
Demo application
Summary
Further reading
Chapter 6: Configuration Management
Technical requirements
Environment setup
Creating the topology
Interacting with network devices via SSH
Describing the network device configurations
Using Goβs SSH package to access network devices
Automating routine SSH tasks
Interacting with network devices via HTTP
Using Goβs HTTP package to access network devices
Getting config inputs from other systems via HTTP
State validation
Checking routing information
Validating end-to-end reachability
Summary
Further reading
Chapter 7: Automation Frameworks
Technical requirements
Ansible
Overview of Ansible components
Working with Ansible modules
Developing an Ansible module
Running the playbook
Terraform
Overview of Terraform components
Working with Terraform
Developing a Terraform provider
Networking providers
Other automation frameworks
Gornir
Consul-Terraform-Sync
mgmt
Looking into the future
Summary
Further reading
Part 3: Interacting with APIs
Chapter 8: Network APIs
Technical requirements
API data modeling
OpenAPI
Data modeling
Data input
Device configuration
JSON-RPC
Code generation
Building configuration
Device configuration
RESTCONF
Code generation
Building configuration
Device configuration
State validation
Operational state modeling
Operational state processing
gRPC
Protobuf
gRPC transport
Defining gRPC services
Configuring network devices with gRPC
Streaming telemetry from a network device with gRPC
Summary
Further reading
Chapter 9: OpenConfig
Technical requirements
Device provisioning
Set RPC
Using gNMI to configure network interfaces
Streaming telemetry
Subscribe RPC
Streaming telemetry processing pipelines with gNMI
Event-manager sample program
Visualizing the data
Network operations
Traceroute RPC
Path verifier application
Summary
Further reading
Chapter 10: Network Monitoring
Technical requirements
Data plane telemetry processing
Packet capturing
Packet filtering
Packet processing
Generating traffic
Debugging Go programs
Debugging from an IDE
Data plane telemetry aggregation
Top talkers
Testing Go programs
Measuring control plane performance
Measuring BGP Update propagation time
Event-driven BGP state machine
Encoding and decoding BGP messages
Collecting and exposing metrics
Storing and visualizing metrics
Developing distributed applications
Summary
Further reading
Chapter 11: Expert Insights
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
Carl Montanari
Brent Salisbury
Maximilian Wilhelm
Matt Oswalt
Further reading
Appendix : Building a Testing Environment
What is a testing environment?
Step 1 β building a testing environment
Step 2 β uploading container images
Step 3 β iInteracting with the testing environment
Launching a virtual network topology
Connecting to the devices
Destroying the network topology
Step 4 β cleaning up of the cloud-hosted environment
Further reading
Index
Other Books You May Enjoy
π SIMILAR VOLUMES
<p><span>Understand the world of modern network automation with Go and deepen your knowledge with insights from 10+ experts who have real-world hands-on experience with network automation and/or are using Go for network-related tasks</span></p><h4><span>Key Features</span></h4><ul><li><span><span>A
Achieve reliable release automation and get zero troublesome notifications on your release day Key Features Develop the skills to build command-line tools to control thousands of nodes Use Go to create Terraform providers and GitHub actions and extend Kubernetes Gain the knowledge to build Dev
Achieve reliable release automation and get zero troublesome notifications on your release day Key Features Develop the skills to build command-line tools to control thousands of nodes Use Go to create Terraform providers and GitHub actions and extend Kubernetes Gain the knowledge to build Dev
Unleash the power of automation by mastering network programming fundamentals using Python and Go best practices Key Features Understand the fundamentals of network programming and automation Learn tips and tricks to transition from traditional networking to automated networks Solve everyday p
<p><span>Unleash the power of automation by mastering network programming fundamentals using Python and Go best practices</span></p><p><span>Purchase of the print or Kindle book includes a free PDF eBook</span></p><h4><span>Key Features</span></h4><ul><li><span><span>Understand the fundamentals of n