Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Preface
What This Book Covers
How This Book Is Organized
Who Should Read This Book
Network Engineers
Prerequisites
Systems Administrators
Prerequisites
Software Developers
Prerequisites
Tools Used in this Book
Online Resources
Conventions Used in This Book
O’Reilly Safari
How to Contact Us
Acknowledgments
1. Network Industry Trends
The Rise of Software Defined Networking
OpenFlow
Why OpenFlow?
What Is Software Defined Networking?
OpenFlow
Network Functions Virtualization
Virtual switching
Network virtualization
Device APIs
Network automation
Bare-metal switching
Data center network fabrics
SD-WAN
Controller networking
Summary
2. Network Automation
Why Network Automation?
Simplified Architectures
Deterministic Outcomes
Business Agility
Types of Network Automation
Device Provisioning
Data Collection
Migrations
Configuration Management
Compliance
Reporting
Troubleshooting
Evolving the Management Plane from SNMP to Device APIs
Application Programming Interfaces (APIs)
SNMP
SSH/Telnet and the CLI
NETCONF
RESTful APIs
Impact of Open Networking
Network Automation in the SDN Era
Summary
3. Linux
Examining Linux in a Network Automation Context
A Brief History of Linux
Linux Distributions
Red Hat Enterprise Linux, Fedora, and CentOS
Debian, Ubuntu, and Other Derivatives
Other Linux Distributions
Interacting with Linux
Navigating the Filesystem
Manipulating Files and Directories
Creating files and directories
Deleting files and directories
Moving, copying, and renaming files and directories
Changing permissions
Running Programs
Working with Daemons
Working with background services in Debian GNU/Linux 8.1
Working with background services in Ubuntu Linux 14.04 LTS
Working with background services in CentOS 7.1
Other daemon-related commands
Networking in Linux
Working with Interfaces
Interface configuration via the command line
Listing interfaces
Enabling/disabling an interface
Setting the MTU of an interface
Assigning an IP address to an interface
Interface configuration via configuration files
Using VLAN interfaces
Creating, configuring, and deleting VLAN interfaces
Use cases for VLAN interfaces
Routing as an End Host
Routing as a Router
Bridging (Switching)
Practical use case for bridging
Creating and configuring linux bridges
Summary
4. Learning Python in a Network Context
Should Network Engineers Learn to Code?
Using the Python Interactive Interpreter
Understanding Python Data Types
Learning to Use Strings
Using built-in methods of strings
Using the upper() and lower() methods
Using the startswith() and endswith() methods
Using the strip() method
Using the isdigit() method
Using the count() method
Using the format() method
Using the join() and split() methods
Learning to Use Numbers
Performing mathematical operations
Learning to Use Booleans
Learning to Use Python Lists
Using built-in methods of Python lists
Using the append() method
Using the insert() method
Using the count() method
Using the pop() and index() methods
Using the sort() method
Learning to Use Python Dictionaries
Using built-in methods of Python dictionaries
Using the get() method
Using the keys() and values() methods
Using the pop() method
Using the update() method
Using the items() method
Learning About Python Sets and Tuples
Adding Conditional Logic to Your Code
Understanding Containment
Using Loops in Python
Understanding the while Loop
Understanding the for Loop
Using the enumerate() function
Using Python Functions
Working with Files
Reading from a File
Writing to a File
Creating Python Programs
Creating a Basic Python Script
Understanding the Shebang
Migrating Code from the Python Interpreter to a Python Script
Working with Python Modules
Passing Arguments into a Python Script
Using pip and Installing Python Packages
Learning Additional Tips, Tricks, and General Information When Using Python
Summary
5. Data Formats and Data Models
Introduction to Data Formats
Types of Data
YAML
Reviewing YAML Basics
Working with YAML in Python
Data Models in YAML
XML
Reviewing XML Basics
Using XML Schema Definition (XSD) for Data Models
Transforming XML with XSLT
Searching XML Using XQuery
JSON
Reviewing JSON Basics
Working with JSON in Python
Using JSON Schema for Data Models
Data Models Using YANG
YANG Overview
Taking a Deeper Dive into YANG
Summary
6. Network Configuration Templates
The Rise of Modern Template Languages
Using Templates for Web Development
Expanding On the Use of Templates
The Value of Templates in Network Automation
Jinja for Network Configuration Templates
Why Jinja?
Dynamically Inserting Data into a Basic Jinja Template
Rendering a Jinja Template File in Python
Conditionals and Loops
Using conditional logic to create a switchport configuration
Using a loop to create many switchport configurations
Using a loop and conditionals to create switchport configurations
Looping over variables in a for loop to generate configurations
Generating interface configurations from a list of dictionaries
Jinja Filters
Using the “upper” Jinja filter
Chaining Jinja filters
Creating custom Jinja filters
Using existing Python code as a Jinja filter
Template Inheritance in Jinja
Variable Creation in Jinja
Summary
7. Working with Network APIs
Understanding Network APIs
Getting Familiar with HTTP-Based APIs
Understanding RESTful APIs
Understanding HTTP request types
Understanding HTTP response codes
Understanding non-RESTful HTTP-based APIs
Diving into NETCONF
Learning the NETCONF protocol stack
Transport
Messages
Operations
Content
Exploring Network APIs
Exploring HTTP-Based APIs
cURL
Exploring HTTP-based APIs with Postman
Exploring NETCONF
Automating Using Network APIs
Using the Python requests Library
Getting familiar with Cisco NX-API
Using the NX-API Developer Sandbox
Consuming NX-API in a Python script
Using NX-API from the Python interactive interpreter
Understanding the JSON response of an HTTP-based API
Exploring more NX-API examples with Python scripts
Passing a show command into the script
Passing in configuration commands to the script
Getting familiar with Arista eAPI
Using the eAPI Command Explorer
Consuming eAPI in a Python script
Optimizing the eAPI script
Using eAPI to autoconfigure interface descriptions based on LLDP data
Getting familiar with RESTCONF on IOS-XE
Executing an API call using RESTCONF
Navigating a RESTCONF API response
Using HTTP verbs PUT and PATCH with RESTCONF on IOS-XE
Using Python to consume the IOS-XE RESTCONF API
Understanding declarative configuration management
Using the Python ncclient Library
Understanding the Manager object
Exploring the get method
Retrieving Cisco IOS-XE device configurations with ncclient
Viewing an ncclient NETCONF reply
Exploring more attributes of the ncclient reply
Adding to the query filter to minimize the response data
Retrieving Juniper vMX Junos device configurations with ncclient
Making Cisco IOS-XE configuration changes with ncclient
Performing a NETCONF delete operation with ncclient
Performing a NETCONF replace operation with ncclient
Making Juniper vMX Junos configuration changes with ncclient
Making Cisco IOS-XR configuration changes with ncclient
Understanding vendor-specific NETCONF operations
Using netmiko
Verify the device prompt
Enter configuration mode
Send commands
Summary
8. Source Control with Git
Use Cases for Source Control
Benefits of Source Control
Change Tracking
Accountability
Process and Workflow
Benefits of Source Control for Networking
Enter Git
Brief History of Git
Git Terminology
Overview of Git’s Architecture
Working with Git
Installing Git
Creating a Repository
Adding Files to a Repository
Committing Changes to a Repository
Providing user information to Git
Committing changes
Recommendations for committing changes
Amending commits
Changing and Committing Tracked Files
Unstaging Files
Excluding Files from a Repository
Excluding files per-repository
Excluding files globally
Viewing More Information About a Repository
Viewing basic log information
Viewing brief log information
Drilling into information on specific commits
Distilling Differences Between Versions of Files
Examining differences between commits
Viewing other types of differences
Branching in Git
Creating a Branch
Checking Out a Branch
Merging and Deleting Branches
Reviewing fast-forward merges
Deleting a branch
Reviewing merges with a merge commit
Collaborating with Git
Collaborating Between Multiple Systems Running Git
Linking repositories with remotes
Fetching and merging information from remote repositories
Pulling information from remote repositories
Cloning repositories
Extending our working model across multiple systems
Using a shared repository
Pushing changes to a shared repository
Collaborating Using Git-Based Online Services
Forking repositories
Keeping forked repositories in sync
Pull requests
Summary
9. Automation Tools
Reviewing Automation Tools
Using Ansible
Understanding How Ansible Works
Automating Linux servers
Automating network devices
Constructing an Inventory File
Working with inventory groups
Using nested groups in an inventory file
Using variables in Ansible
Managing group variables
Managing host variables
Understanding variable priority
Getting familiar with the all group
Executing an Ansible Playbook
Understanding tasks in an Ansible playbook
Getting familiar with Ansible modules
Executing a playbook
Using Variable Files
Group-based variable files
Using host-based variable files
Writing Ansible Playbooks for Network Automation
Breaking down common core network modules
Creating and using configuration templates
Creating variable files
Creating Jinja templates
Generating network configuration files
Ensuring a configuration exists
Understanding idempotency
Using the config module
Understanding check mode, verbosity, and limit
Gathering and viewing network data
Using the core facts modules
Using the debug module
Issuing show commands and writing data to a file
Using the register task attribute
Performing compliance checks
Generating reports
Using Third-Party Ansible Modules
Getting familiar with NTC modules
Getting familiar with NAPALM modules
Being aware of non-core vendor modules
Installing third-party modules
Ansible Summary
Automating with Salt
Understanding the Salt Architecture
Using Salt in an agentless architecture with salt-ssh
Using Salt in an agentless architecture with proxy minions
Automating network devices with Salt
Getting Familiar with Salt
Understanding the SLS file format
Understanding pillars
Understanding the top file
Understanding grains
Using execution modules
Collecting device data using network modules
Understanding targeting and compound matching
Verifying minions are up with the test module
Viewing module and function docstrings
Understanding different output options for modules
Sending data to external services
Understanding states, state SLS files, and state modules
Understanding the state SLS
State modules for network automation
Updating the master configuration file
Updating the minion and proxy minion configuration file
Managing Network Configurations with Salt
Accessing data within templates
Creating Jinja network configuration templates
Deploying network configurations with netconfig
Using state dependencies
Generating network configuration files
Generating and deploying network configurations from files
Parameterizing configuration filenames
Scheduling state execution
Generating reports
Executing Salt Functions Remotely
Using the Salt API
Shaking it up with salt and pepper
Diving into Salt’s Event-Driven Infrastructure
Watching external processes with beacons
Forwarding events with engines
Listening to the salt bus with reactors
Adding business logic using Thorium
Diving into Salt a Bit Further
Understanding small database queries (SDB)
Understanding the Salt cache
Understanding Salt logging
Extending Salt
Salt Summary
Event-Driven Network Automation with StackStorm
StackStorm Concepts
StackStorm Architecture
Actions and Workflows
Sensors and Triggers
Rules
StackStorm Summary
Summary
10. Continuous Integration
Important Prerequisites
Simple Is Better
People, Process, and Technology
Learn to Code
Introduction to Continuous Integration
Basics of Continuous Integration
Continuous Delivery
Test-Driven Development
Why Continuous Integration for Networking?
A Continuous Integration Pipeline for Networking
Peer Review
Build Automation
Test/Dev/Staging Environment
Deployment Tools
Testing Tools and Test-Driven Network Automation
Summary
11. Building a Culture for Network Automation
Organizational Strategy and Flexibility
Transforming an Old-World Organization
The Importance of Executive Buy-in
Build Versus Buy
Embracing Failure
Skills and Education
Learn What You Don’t Know
Focus on Fundamentals
Certifications?
Won’t Automation Take My Job?!
Summary
A. Advanced Networking in Linux
Using macvlan Interfaces
Use Cases for macvlan Interfaces
Creating, Configuring, and Deleting macvlan Interfaces
Networking Virtual Machines
Using a Bridge
Using macvtap Interfaces
Working with Network Namespaces
Use Cases for Network Namespaces
Creating and Removing Network Namespaces
Placing Interfaces in a Network Namespace
Executing Commands in a Network Namespace
Connecting Network Namespaces with veth Pairs
Networking Linux Containers
Configuring LXC Networking
Configuring Docker Networking
Using Open vSwitch
Installing OVS
Configuring OVS
Connecting Workloads to OVS
Connecting network namespaces with OVS
Using containers with OVS
Using VMs with OVS
Using OVS internal ports
B. Using NAPALM
Understanding Configuration Management in NAPALM
Performing a Configuration Replace
Performing a Configuration Merge
Retrieving Data with NAPALM
NAPALM Integrations
Using NAPALM in Ansible
Using NAPALM in Salt
Using NAPALM in StackStorm
Index
← Prev
Back
Next →
← Prev
Back
Next →