Mastering Python Networking

Become an expert in implementing advanced, network-related tasks with Python.

Mastering Python Networking

This ebook is included in a Mapt subscription
Eric Chou

Become an expert in implementing advanced, network-related tasks with Python.
$10.00
$49.99
RRP $39.99
RRP $49.99
eBook
Print + eBook
Access every Packt eBook & Video for just $100
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Find Out More
 
Preview in Mapt

Book Details

ISBN 139781784397005
Paperback446 pages

Book Description

This book begins with a review of the TCP/ IP protocol suite and a refresher of the core elements of the Python language. Next, you will start using Python and supported libraries to automate network tasks from the current major network vendors. We will look at automating traditional network devices based on the command-line interface, as well as newer devices with API support, with hands-on labs. We will then learn the concepts and practical use cases of the Ansible framework in order to achieve your network goals.

We will then move on to using Python for DevOps, starting with using open source tools to test, secure, and analyze your network. Then, we will focus on network monitoring and visualization. We will learn how to retrieve network information using a polling mechanism, flow-based monitoring, and visualizing the data programmatically. Next, we will learn how to use the Python framework to build your own customized network web services.

In the last module, you will use Python for SDN, where you will use a Python-based controller with OpenFlow in a hands-on lab to learn its concepts and applications. We will compare and contrast OpenFlow, OpenStack, OpenDaylight, and NFV. Finally, you will use everything you’ve learned in the book to construct a migration plan to go from a legacy to a scalable SDN-based network.

 

Table of Contents

Chapter 1: Review of TCP/IP Protocol Suite and Python Language
The internet overview
The OSI model
Client server models
Network protocol suites
Python language overview
Chapter 2: Low-Level Network Device Interactions
The challenges of CLI
Constructing a virtual lab 
Python Pexpect Library
The Python Paramiko library
Looking ahead
Summary
Chapter 3: API and Intent-Driven Networking
Infrastructure as the Python code
The Cisco API and ACI
The Python API for Juniper networks
The Arista Python API
Vendor neutral libraries
Summary
Chapter 4: The Python Automation Framework - Ansible Basics
A quick Ansible example
The advantages of Ansible
The Ansible architecture
Ansible networking modules
The Ansible Cisco example
The Ansible Juniper example
The Ansible Arista example
Summary
Chapter 5: The Python Automation Framework - Ansible Advance Topics
Ansible conditionals
Ansible loops
Templates
Group and host variables
The Ansible vault
The Ansible include and roles
Writing your own custom module
Summary
Chapter 6: Network Security with Python
The lab setup
Python Scapy 
Access lists
The syslog search
Other tools 
Summary
Chapter 7: Network Monitoring with Python - Part 1
Lab setup
SNMP
Python visualization
Python for Cacti
Summary
Chapter 8: Network Monitoring with Python - Part 2
Graphviz
Flow-based monitoring
Elasticsearch (ELK stack)
Summary
Chapter 9: Building Network Web Services with Python
Comparing Python web frameworks 
Flask and lab setup
Introduction to Flask
Network static content API
Network dynamic operations
Security
Additional resources
Summary
Chapter 10: OpenFlow Basics
Lab setup
Introducing OpenFlow
Mininet
The Ryu controller with Python
Layer 2 OpenFlow switch
The POX controller
Summary
Chapter 11: Advanced OpenFlow Topics
Setup
OpenFlow operations with Ryu
Packet inspection
Static router
Router with API
BGP router with OpenFlow
Firewall with OpenFlow
Summary
Chapter 12: OpenStack, OpenDaylight, and NFV
OpenStack 
OpenDaylight
Summary
Chapter 13: Hybrid SDN
Preparing the network 
Greenfield deployment
Controller redundancy
BGP migration example
More BGP example
Monitoring integration
Secure TLS connection
Physical switch selection
Summary

What You Will Learn

  • Review all the fundamentals of Python and the TCP/IP suite
  • Use Python to execute commands when the device does not support the API or programmatic interaction with the device
  • Implement automation techniques by integrating Python with Cisco, Juniper, and Arista eAPI
  • Integrate Ansible using Python to control Cisco, Juniper, and Arista networks
  • Achieve network security with Python
  • Build Flask-based web-service APIs with Python
  • Construct a Python-based migration plan from a legacy to scalable SDN-based network.

Authors

Table of Contents

Chapter 1: Review of TCP/IP Protocol Suite and Python Language
The internet overview
The OSI model
Client server models
Network protocol suites
Python language overview
Chapter 2: Low-Level Network Device Interactions
The challenges of CLI
Constructing a virtual lab 
Python Pexpect Library
The Python Paramiko library
Looking ahead
Summary
Chapter 3: API and Intent-Driven Networking
Infrastructure as the Python code
The Cisco API and ACI
The Python API for Juniper networks
The Arista Python API
Vendor neutral libraries
Summary
Chapter 4: The Python Automation Framework - Ansible Basics
A quick Ansible example
The advantages of Ansible
The Ansible architecture
Ansible networking modules
The Ansible Cisco example
The Ansible Juniper example
The Ansible Arista example
Summary
Chapter 5: The Python Automation Framework - Ansible Advance Topics
Ansible conditionals
Ansible loops
Templates
Group and host variables
The Ansible vault
The Ansible include and roles
Writing your own custom module
Summary
Chapter 6: Network Security with Python
The lab setup
Python Scapy 
Access lists
The syslog search
Other tools 
Summary
Chapter 7: Network Monitoring with Python - Part 1
Lab setup
SNMP
Python visualization
Python for Cacti
Summary
Chapter 8: Network Monitoring with Python - Part 2
Graphviz
Flow-based monitoring
Elasticsearch (ELK stack)
Summary
Chapter 9: Building Network Web Services with Python
Comparing Python web frameworks 
Flask and lab setup
Introduction to Flask
Network static content API
Network dynamic operations
Security
Additional resources
Summary
Chapter 10: OpenFlow Basics
Lab setup
Introducing OpenFlow
Mininet
The Ryu controller with Python
Layer 2 OpenFlow switch
The POX controller
Summary
Chapter 11: Advanced OpenFlow Topics
Setup
OpenFlow operations with Ryu
Packet inspection
Static router
Router with API
BGP router with OpenFlow
Firewall with OpenFlow
Summary
Chapter 12: OpenStack, OpenDaylight, and NFV
OpenStack 
OpenDaylight
Summary
Chapter 13: Hybrid SDN
Preparing the network 
Greenfield deployment
Controller redundancy
BGP migration example
More BGP example
Monitoring integration
Secure TLS connection
Physical switch selection
Summary

Book Details

ISBN 139781784397005
Paperback446 pages
Read More

Read More Reviews