O'Reilly logo

Network Programmability and Automation by Jason Edelman, Matt Oswalt, Scott S. Lowe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Preface

Welcome to Network Programmability and Automation!

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.

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.

How This Book Is Organized

This book isn’t necessarily intended to be read from start to end; instead, we’ve broken the topics up so that you can easily find the topics in which you’re most interested. You may find it useful to start out sequentially reading the first three chapters, as they provide background information and set the stage for the rest of the book. From there, you’re welcome to jump to whatever topic or topics are most useful or interesting to you. We’ve tried to keep the chapters relatively standalone, but—as with any technology—that’s not always possible. Wherever we can, we provide cross-references to help you find the information you need.

Here’s a quick look at how we’ve organized the topics:

Chapter 1, Network Industry Trends

Provides an overview of the major events and trends that launched Software Defined Networking (SDN). As you’ll see in Chapter 1, SDN was the genesis for an increased focus on network programmability and automation.

Chapter 2, Network Automation

Takes the SDN discussion from Chapter 1 and focuses specifically on network automation—the history of network automation, types of automation, tools and technologies involved in automation, and how automation affects operational models (and how operational models affect automation).

Chapter 3, Linux

Provides an overview of the Linux operating system. By no means a comprehensive discussion of Linux, this chapter aims to get networking professionals up to speed on Linux, basic Linux commands, and Linux networking concepts.

Chapter 4, Learning Python in a Network Context

Introduces networking professionals to the Python development language. Python is frequently used in network programmability and automation contexts, and this chapter covers many of the basics of programming with Python: data types, conditionals, loops, working with files, functions, classes, and modules.

Chapter 5, Data Formats and Data Models

Introduces common data formats that are often seen in network automation projects. JavaScript Object Notation (JSON), eXtensible Markup Language (XML), and YAML Ain’t Markup Language (YAML) are all discussed. The chapter then introduces the concepts of data modeling and provides a light introduction to YANG, a common data modeling language for networking.

Wondering what a “data format” is?

If you’re new to some of this stuff, don’t let the terminology throw you off. A data format is nothing more than how data is encoded or encapsulated when being transferred between two points (for example, when data is returned in response to an API call). Chapter 5 breaks it all down for you.

Chapter 6, Network Configuration Templates

Looks at the use of templating languages to create network device configurations. The primary focus of this chapter is on the Jinja templating language, as it integrates natively with Python. We’ll also discuss Mako and ERB, two other templating languages. Mako integrates with Python, while ERB is primarily used with Ruby.

Chapter 7, Working with Network APIs

Will take a look at the role of application programming interfaces (APIs) in network programmability and automation. We’ll explore key terms and technologies pertaining to APIs, and use some popular vendor-specific APIs—both device APIs and controller APIs—as examples to see how they can be used for network programmability and automation.

Chapter 8, Source Control with Git

Introduces Git, a very popular and widely used tool for source code control. We’ll talk about why source code control is important, how it is used in a network programmability and automation context, and how to work with popular online services such as GitHub.

Chapter 9, Automation Tools

Explores the use of open source automation tools such as Ansible, Salt, and StackStorm, and how these tools can be used specifically for network programmability and automation.

Chapter 10, Continuous Integration

Examines the concepts of Continuous Integration (CI) and the key tools and technologies that are involved. We’ll discuss the use of test-driven development (TDD), explore tools and frameworks like Jenkins and Gerrit, and take a look at a sample network automation workflow that incorporates all these CI elements.

Chapter 11, Building a Culture for Network Automation

Examines why a good culture is a crucial and foundational element for network automation, and shows how to nurture such a culture.

Appendix A, Advanced Networking in Linux

Continues the discussion started in Chapter 3, but dives much deeper into networking with macvlan interfaces, networking with virtual machines (VMs), working with network namespaces, networking with Linux containers (including Docker containers), and using Open vSwitch (OVS).

Appendix B, Using NAPALM

Provides an introduction to using the NAPALM (Network Automation and Programmability Abstraction Layer with Multi-vendor support) Python library. This section explores the use of NAPALM for both vendor-neutral configuration management and retrieving data from network devices. Finally, we take a look at how NAPALM integrates with tools such as Ansible, Salt, and StackStorm, all covered in Chapter 9.

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.

Online Resources

We realize that we can’t possibly cover all the material we’d like to cover regarding network automation and network programmability. Therefore, throughout the book we’ll reference additional online resources that you may find helpful and useful in understanding the concepts, ideas, and skills being presented.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This element signifies a tip or suggestion.

Note

This element signifies a general note.

Warning

This element indicates a warning or caution.

O’Reilly Safari

Note

Safari (formerly Safari Books Online) is a membership-based training and reference platform for enterprise, government, educators, and individuals.

Members have access to thousands of books, training videos, Learning Paths, interactive tutorials, and curated playlists from over 250 publishers, including O’Reilly Media, Harvard Business Review, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Adobe, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, and Course Technology, among others.

For more information, please visit http://oreilly.com/safari.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

  • O’Reilly Media, Inc.
  • 1005 Gravenstein Highway North
  • Sebastopol, CA 95472
  • 800-998-9938 (in the United States or Canada)
  • 707-829-0515 (international or local)
  • 707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/network-programmability-and-automation.

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

This book would not have been possible without the help and support of a large community of people.

First, we’d like to extend our thanks to the vibrant network automation community. There are too many folks to name directly, but these are the folks who have created open source projects like NAPALM and Netmiko, who have helped lead the charge in educating folks about network automation, and who have tirelessly contributed their knowledge and experience for the benefit of others. Thank you all for your efforts and your contributions.

Our contributing authors helped make this book more complete and comprehensive than we would have been able to without their assistance, and we are deeply grateful for their help. Mircea Ulinic contributed the SaltStack section in the chapter on configuration management tools, and Jere Julian contributed some Puppet content that we unfortunately could not get included in this version of the book. Our thanks go to both Mircea and Jere.

Our technical reviewers were critical in ensuring that the content was both technically accurate and easily consumable by readers. We’d like to extend our thanks to Patrick Ogenstad, Akhil Behl, Eric Chou, and Sreenivas Makam. Thanks for helping make sure this book is the best it could be!

Finally, our thanks would not be complete without including the staff of O’Reilly Media: Virginia Wilson and Courtney Allen, our editors; Dwight Ramsey, our copy editor; Rachel Monaghan, our proofreader; Judy McConville, our indexer; Colleen Cole, our production editor; Randy Comer, the cover designer; and Rebecca Demarest, the illustrator. The importance of their efforts in helping us take this book from concept to production cannot be understated, and we thank them for their dedication and commitment.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required