Network Programmability and Automation

Skills for the Next-Generation Network Engineer

by Jason Edelman, Scott S. Lowe, and Matt Oswalt

Praise for This Book

Jason, Scott, and Matt have been key contributors in educating network engineers about
both network automation and Linux networking. They have written and talked
extensively about the importance of automation, on how automation impacts network
engineers, and on the mechanics of automating networking devices.
—Kirk Byers
Creator of the Netmiko Python Library
Network automation is no longer just a proof of concept: it represents both the present
and the future! Network Programmability and Automation provides the needed
background for modern engineers, by widening the toolset for more consistent, stable
and reliable networks.
—Mircea Ulinic
Network Systems Engineer, Cloudflare
Network automation is not hype anymore; it is a means to do your job faster, more
consistently and more reliably. However, network automation is not just a single
discipline; it is a collection of protocols, tools, and processes that can be overwhelming to
the uninitiated. This book does a great job covering everything you will need to get your
automation up and running.
—David Barroso, creator of NAPALM

e-books shop
e-books shop
Purchase Now !
Just with Paypal



Book Details
 Price
 3.50
 Pages
 581 p
 File Size 
 10,372 KB
 File Type
 PDF format
 ISBN
 978-1-491-93125-7
 Copyright©   
 2018 Jason Edelman,
 Scott S. Lowe, Matt Oswalt 

About the Author
Jason Edelman, CCIE 15394 & VCDX-NV 167, is a born and bred network engineer
from the great state of New Jersey. He was the typical “lover of the CLI” or “router
jockey.” At some point several years ago, he made the decision to focus more on software,
development practices, and how they are converging with network engineering.
Jason currently runs a boutique consulting firm, Network to Code, helping vendors
and end users take advantage of new tools and technologies to reduce their operational
inefficiencies. Jason has a Bachelor’s of Engineering from Stevens Institute of
Technology in New Jersey and still resides locally in the New York City metro area.
Jason also writes regularly on his personal blog at jedelman.com and can be found on
Twitter as @jedelman8.
Scott S. Lowe is an engineering architect at VMware, Inc. He currently focuses on
cloud computing and network virtualization after having spent a number of years
specializing in compute virtualization. Scott has authored a number of technical
books on vSphere and OpenStack, and shares technical content regularly on his blog
at blog.scottlowe.org. He lives in Denver, Colorado, with his wife and the two youngest
of their seven kids.
Matt Oswalt is a network software developer, working on the technical and nontechnical
challenges at the intersection of software development and network infrastructure.
He is at his happiest in front of a keyboard, next to a brewing kettle, or
wielding his silo-smashing sledgehammer. He publishes his work in this area and
more at keepingitclassless.net, and on Twitter as @Mierdin.

Preface
The networking industry is changing dramatically. The drive for organizations and
networking professionals to embrace the ideas and concepts of network programmability
and automation is greater now than perhaps it has ever been, fueled by a revolution
in new protocols, new technologies, new delivery models, and a need for
businesses to be more agile and more flexible in order to compete. But what is network
programmability and automation? Let’s start this book with a quick look at how
to answer that question.

Who Should Read This Book
As we mentioned earlier, the goal of the book is to equip readers with foundational
knowledge and a set of baseline skills in the areas of network programmability and
automation. We believe that members of several different IT disciplines will benefit
from reading this book.
Network Engineers
Given the focus on network programmability and automation, it’s natural that one
audience for this book is the “traditional” network engineer, someone who is reasonably
fluent in network protocols, configuring network devices, and operating and
managing a network. We believe this book will enable today’s network engineers to be
more efficient and more productive through automation and programmability.
Prerequisites
Network engineers interested in learning more about network programmability and
automation don’t need any previous knowledge in software development, programming,
automation, or DevOps-related tools. The only prerequisite is an open mind
and a willingness to learn about new technologies and how they will affect you—the
networking professional—and the greater networking industry as a whole.

Systems Administrators
Systems administrators, who are primarily responsible for managing the systems that
connect to the network, may already have previous experience with some of the tools
that are discussed in this book (notably, Linux, source code control, and configuration
management systems). This book, then, could serve as a mechanism to help
them expand their knowledge and understanding of such tools by presenting them in
a different context (for example, using Ansible to configure a network switch as
opposed to using Ansible to configure a server running a distribution of Linux).
Prerequisites
What this book doesn’t provide is any coverage or explanation of core networking
protocols or concepts. However, as a result of managing network-connected systems,
we anticipate that many systems administrators also have a basic knowledge of core
networking protocols. So most experienced systems administrators should be fine. If
you’re a bit weak on your networking knowledge, we’d recommend supplementing
this book with a book that focuses on core networking concepts and ideas. For example,
Packet Guide to Core Network Protocols (O’Reilly) may be a good choice.

Software Developers
Software developers may also benefit from reading this book. Many developers will
have prior experience with some of the programming languages and developer tools
discussed in this book (such as Python and/or Git). Like systems administrators,
developers may find it useful to see developer tools and languages used in a
networking-centric context (for example, seeing how Python could be used to
retrieve and store networking-specific data).
Prerequisites
We do assume that readers have a basic understanding of core network protocols and
concepts, and all the examples we provide are networking-centric examples. As with
systems administrators, software developers who are new to networking will probably
find it necessary to supplement the material in this book with a book that focuses on
core networking concepts.

Tools Used in this Book
As with any field of technology, there are many different versions and variations of
the technologies and tools found in the network programmability and automation
space. Therefore, we standardized on a set of tools in this book that we feel best represent
the tools readers will find in the field. For example, there are many different
distributions of Linux, but we will only be focusing on Debian, Ubuntu (which is
itself a derivative of Debian), and CentOS (a derivative of Red Hat Enterprise Linux
[RHEL]). To help make it easy for readers, we call out the specific version of the various
tools in each tool’s specific chapter.

Table of Contents
Preface. . . . . . . . . . . . xiii
1. Network Industry Trends. .  . . . 1
The Rise of Software Defined Networking 1
OpenFlow 1
What Is Software Defined Networking? 5
Summary 16
2. Network Automation. . . . 17
Why Network Automation? 18
Simplified Architectures 18
Deterministic Outcomes 19
Business Agility 19
Types of Network Automation 20
Device Provisioning 20
Data Collection 23
Migrations 24
Configuration Management 25
Compliance 25
Reporting 26
Troubleshooting 26
Evolving the Management Plane from SNMP to Device APIs 28
Application Programming Interfaces (APIs) 28
Impact of Open Networking 32
Network Automation in the SDN Era 33
Summary 33
3. Linux. . . . . . . . 35
Examining Linux in a Network Automation Context 35
A Brief History of Linux 36
Linux Distributions 37
Red Hat Enterprise Linux, Fedora, and CentOS 37
Debian, Ubuntu, and Other Derivatives 39
Other Linux Distributions 40
Interacting with Linux 40
Navigating the Filesystem 41
Manipulating Files and Directories 46
Running Programs 52
Working with Daemons 55
Networking in Linux 60
Working with Interfaces 60
Routing as an End Host 71
Routing as a Router 75
Bridging (Switching) 77
Summary 83
4. Learning Python in a Network Context. . . . 85
Should Network Engineers Learn to Code? 86
Using the Python Interactive Interpreter 88
Understanding Python Data Types 90
Learning to Use Strings 91
Learning to Use Numbers 100
Learning to Use Booleans 102
Learning to Use Python Lists 105
Learning to Use Python Dictionaries 111
Learning About Python Sets and Tuples 115
Adding Conditional Logic to Your Code 117
Understanding Containment 119
Using Loops in Python 121
Understanding the while Loop 121
Understanding the for Loop 122
Using Python Functions 126
Working with Files 129
Reading from a File 130
Writing to a File 132
Creating Python Programs 134
Creating a Basic Python Script 134
Understanding the Shebang 135
Migrating Code from the Python Interpreter to a Python Script 137
Working with Python Modules 138
Passing Arguments into a Python Script 140
Using pip and Installing Python Packages 141
Learning Additional Tips, Tricks, and General Information When Using
Python 143
Summary 149
5. Data Formats and Data Models. . . 151
Introduction to Data Formats 151
Types of Data 153
YAML 154
Reviewing YAML Basics 155
Working with YAML in Python 158
Data Models in YAML 159
XML 160
Reviewing XML Basics 160
Using XML Schema Definition (XSD) for Data Models 161
Transforming XML with XSLT 163
Searching XML Using XQuery 167
JSON 167
Reviewing JSON Basics 167
Working with JSON in Python 170
Using JSON Schema for Data Models 171
Data Models Using YANG 172
YANG Overview 172
Taking a Deeper Dive into YANG 173
Summary 176
6. Network Configuration Templates.. . 177
The Rise of Modern Template Languages 178
Using Templates for Web Development 179
Expanding On the Use of Templates 180
The Value of Templates in Network Automation 180
Jinja for Network Configuration Templates 181
Why Jinja? 181
Dynamically Inserting Data into a Basic Jinja Template 182
Rendering a Jinja Template File in Python 183
Conditionals and Loops 185
Jinja Filters 191
Template Inheritance in Jinja 195
Variable Creation in Jinja 196
Summary 196
7. Working with Network APIs.  . . 199
Understanding Network APIs 200
Getting Familiar with HTTP-Based APIs 200
Diving into NETCONF 204
Exploring Network APIs 213
Exploring HTTP-Based APIs 213
Exploring NETCONF 220
Automating Using Network APIs 229
Using the Python requests Library 230
Using the Python ncclient Library 259
Using netmiko 284
Summary 289
8. Source Control with Git. . . . 291
Use Cases for Source Control 291
Benefits of Source Control 292
Change Tracking 292
Accountability 292
Process and Workflow 293
Benefits of Source Control for Networking 293
Enter Git 294
Brief History of Git 294
Git Terminology 295
Overview of Git’s Architecture 296
Working with Git 297
Installing Git 297
Creating a Repository 297
Adding Files to a Repository 298
Committing Changes to a Repository 300
Changing and Committing Tracked Files 303
Unstaging Files 306
Excluding Files from a Repository 309
Viewing More Information About a Repository 313
Distilling Differences Between Versions of Files 317
Branching in Git 321
Creating a Branch 326
Checking Out a Branch 327
Merging and Deleting Branches 329
Collaborating with Git 334
Collaborating Between Multiple Systems Running Git 334
Collaborating Using Git-Based Online Services 351
Summary 355
9. Automation Tools. . . . 357
Reviewing Automation Tools 357
Using Ansible 359
Understanding How Ansible Works 360
Constructing an Inventory File 361
Executing an Ansible Playbook 368
Using Variable Files 373
Writing Ansible Playbooks for Network Automation 375
Using Third-Party Ansible Modules 393
Ansible Summary 396
Automating with Salt 396
Understanding the Salt Architecture 397
Getting Familiar with Salt 400
Managing Network Configurations with Salt 416
Executing Salt Functions Remotely 425
Diving into Salt’s Event-Driven Infrastructure 427
Diving into Salt a Bit Further 433
Salt Summary 436
Event-Driven Network Automation with StackStorm 436
StackStorm Concepts 437
StackStorm Architecture 439
Actions and Workflows 440
Sensors and Triggers 450
Rules 452
StackStorm Summary 455
Summary 455
10. Continuous Integration. . .  . 457
Important Prerequisites 459
Simple Is Better 459
People, Process, and Technology 460
Learn to Code 460
Introduction to Continuous Integration 460
Basics of Continuous Integration 461
Continuous Delivery 463
Test-Driven Development 464
Why Continuous Integration for Networking? 466
A Continuous Integration Pipeline for Networking 467
Peer Review 468
Build Automation 474
Test/Dev/Staging Environment 479
Deployment Tools 482
Testing Tools and Test-Driven Network Automation 484
Summary 486
11. Building a Culture for Network Automation. . . . 487
Organizational Strategy and Flexibility 488
Transforming an Old-World Organization 488
The Importance of Executive Buy-in 489
Build Versus Buy 490
Embracing Failure 492
Skills and Education 493
Learn What You Don’t Know 493
Focus on Fundamentals 494
Certifications? 495
Won’t Automation Take My Job?! 496
Summary 496
A. Advanced Networking in Linux. . . . . 499
B. Using NAPALM.  . . . . . . 531
Index. .. . . . . . 547


Bookscreen
e-books shop

What This Book Covers
As its title implies, this book is focused on network programmability and automation.
At its core, network programmability and automation is about simplifying the tasks
involved in configuring, managing, and operating network equipment, network topologies,
network services, and network connectivity. There are many, many different
components involved—including operating systems that are now seeing far broader
use in networking than in the past, the use of new methodologies like Continuous
Integration, and the inclusion of tools that formerly might have fallen only in the
realm of the system administrator (tools like source code control and configuration
management systems). We feel like all of these play a part in the core definition of
what network programmability and automation is, so we cover all these topics. Our
goal for this book is to enable readers to establish a foundation of knowledge around
network programmability and automation.
Previous Post Next Post