Network Programming And Automation Essentials
local graph
Network Programming And Automation Essentials
Section titled “Network Programming And Automation Essentials”chapter_01
Section titled “chapter_01”node-book_network-programming-and-automation-essentials_chapter-01-network-basics-for-development — Network Basics for Development
chapter_02
Section titled “chapter_02”node-book_network-programming-and-automation-essentials_chapter-02-programmable-networks — Programmable Networks
chapter_03
Section titled “chapter_03”node-book_network-programming-and-automation-essentials_chapter-03-accessing-the-network — Accessing the Network
chapter_04
Section titled “chapter_04”node-book_network-programming-and-automation-essentials_chapter-04-working-with-network-configurations-and-definitions — Working with Network Configurations and Definitions
chapter_05
Section titled “chapter_05”node-book_network-programming-and-automation-essentials_chapter-05-dos-and-donts-for-network-programming — Dos and Don’ts for Network Programming
chapter_06
Section titled “chapter_06”node-book_network-programming-and-automation-essentials_chapter-06-using-go-and-python-for-network-programming — Using Go and Python for Network Programming
chapter_07
Section titled “chapter_07”node-book_network-programming-and-automation-essentials_chapter-07-error-handling-and-logging — Error Handling and Logging
chapter_08
Section titled “chapter_08”node-book_network-programming-and-automation-essentials_chapter-08-scaling-your-code — Scaling Your Code
chapter_09
Section titled “chapter_09”node-book_network-programming-and-automation-essentials_chapter-09-network-code-testing-framework — Network Code Testing Framework
chapter_10
Section titled “chapter_10”node-book_network-programming-and-automation-essentials_chapter-10-hands-on-and-going-forward — Hands-On and Going Forward
Preface
Section titled “Preface”Howdy! As I transition from network engineering to software engineering, I understand how hard it is for developers to understand computer network concepts and how hard it is for network engineers to understand software concepts.
As applications become cloud-based and content is stored in the cloud, network infrastructure is the most important asset for today’s businesses. A 10 GE interface down for 15 minutes is equivalent to 1 TB of missing data. Minimizing downtime, maximizing capacity and speed, and lowering latency and jitter are the major performance indicators for network providers today. And it’s becoming impossible to improve these indicators without network automation, from the concept and design of the network to daily network operations.
This book will start with a brief description of network basics, then will start to explore network programming concepts and the automation ecosystem in a bit more depth. It will then describe protocols, tools, and techniques for network programming. All of these will be based on the two most popular computer languages for network automation, which are Go and Python.
Hands-on labs will be used to support the concepts covered in the book using a real-time network emulation. By the end of the book, you will have enough knowledge to start programming and creating network automation solutions.
Who this book is for
Section titled “Who this book is for”This book is for network architects, network engineers, and software professionals who wish to integrate programming into networks. Network engineers who follow traditional techniques can read this book to understand modern-day network automation and programming.
What this book covers
Section titled “What this book covers”Chapter 1, Network Basics for Development, is focused on explaining the basics of computer networking and the jargon used. The idea is to build a good foundation to be built on throughout the book. If you are a network engineer or have experience in this field, you might want to skip it. If you are a software developer with little network experience, this chapter is for you. It will help you build a solid base of network jargon that will be useful when writing code for network automation.
Chapter 2, Programmable Networks, looks into several different technologies used today to create networks via software. Then we will examine the current standard technology, known as Software Defined Networks (SDNs).
Chapter 3, Accessing the Network, explores the most common methods and protocols for accessing network devices for our network automation. Since devices have multiple methods, we will aim to give you enough information so that you can choose the one that is most appropriate for your network automation code.
Chapter 4, Working with Network Configurations and Definitions, explores how to work with a network configuration and how to define it for effective use with network automation. We want to build scalable and future-proof solutions. The chapter answers why we need network definitions to help automation.
Chapter 5, Dos and Don’ts for Network Programming, focuses on the most important best coding practices for Python and Go related to network programming. Writing code for networks is exciting because when it fails, it is challenging, and when it works, it is rewarding. If you are an experienced programmer, it will be plain sailing, but if you are a newbie, it will be stormy. The chapter dives into some coding practices for Go and Python that will help you get through these storms more easily.
Chapter 6, Using Go and Python for Network Programming, looks at how Python and Go are powerful and useful for network programming, but depending on what the requirements are and the environment, one might be better suited than the other. We’ll also check the advantages and disadvantages of using Python and Go.
Chapter 7, Error Handling and Logging, explores how we report program execution events and how we handle errors. These two topics are not as easy as they seem, and they are, most of the time, implemented in systems poorly. The chapter investigates how and why we handle errors and then why and how we do event logging.
Chapter 8, Scaling Your Code, covers some techniques used today to scale your code up and down effectively, which will allow your solution to adapt easily to follow network growth, and, if necessary, easily scale down to save resources.
Chapter 9, Network Code Testing Framework, focuses on techniques to build a network testing framework that can be used for testing your network automation code. It also looks into advanced techniques that can be used to make your testing framework even more useful and reliable.
Chapter 10, Hands-On and Going Forward, explored building a network from scratch using the network automation skills we’ve learned and emulated routers. The finished emulated network will have enough components to experiment with several techniques described in the chapters of this book. And finally, there are a few remarks and some guidance for future studies and work.
To get the most out of this book
Section titled “To get the most out of this book”You will need to be able to work with privileged access with Linux, Windows, or macOS, and be able to install the Go and Python languages, as well as the corresponding third-party libraries. A basic understanding of computer networking concepts will also help*.*
| Software/hardware covered in the book | Operating system requirements |
|---|---|
| Preferably Go language version 1.20 or later | Windows, macOS, or Linux |
| Preferably Python version 3.10.9 or later | Windows, macOS, or Linux |
Conventions used
Section titled “Conventions used”There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “Both modes use the same Linux device driver (accessible via /dev/net/tun), just with a different flag. The flag to use TAP mode is IFF_TAP, whereas the flag to use TUN is IFF_TUN.”
A block of code is set as follows:
from paramiko import SSHClientclient = SSHClient()client.connect('10.1.1.1', username='user', password='pw')When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
import unittestimport mockfrom paramiko import SSHClientclass TestSSHClient(unittest.TestCase): @mock.patch('paramiko.SSHClient.connect') def test_connect(self, mock_connect):Any command-line input or output is written as follows:
claus@dev:~$ sudo ip tuntap add dev tap0 mode tapclaus@dev:~$ sudo ip link set tap0 upclaus@dev:~$ ip link show tap0Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Having included E5, S5, and L5, the Clos network will have now 50 connections.”
Tips or important notes
Appear like this.
Source: