Book Image

Mastering Python Networking

By : Eric Chou, Ben Straub
Book Image

Mastering Python Networking

By: Eric Chou, Ben Straub

Overview of this book

Network programming can be a challenging task. However, with full-featured and well-documented libraries, Python makes it an enjoyable experience.This book is an extensive resource that will help you learn everything about employing Python for network programming. You’ll begin with a detailed revision of the Transmission Control Protocol/Internet Protocol (TCP/IP) suite and the Python language. Once you’ve brushed up on the basics, you’ll understand how to use Python libraries to automate network tasks and employ the Ansible framework to achieve your network goals. Next, the book will guide you in using Python for DevOps by employing open source tools to test, secure, and analyze your network. You’ll then build on your knowledge by understanding how to retrieve network information using a polling mechanism and flow-based monitoring. You will also learn how to build customized network web services. In the last module, you’ll use Python for SDN and compare the performance of tools such as OpenFlow, OpenDaylight, and Network Functions Virtualization (NFV). In the concluding chapters, you’ll apply what you’ve learned to construct a migration plan to advance from a legacy to a scalable SDN-based network. By the end of this book, you’ll have developed the skills you need to confidently design high-performance network server apps using Python. https://github.com/TrainingByPackt/Mastering-Python-Networking-eLearning/tree/master
Table of Contents (8 chapters)
Chapter 2
Low-Level Network Device Interactions
Content Locked
Section 4
Python Pexpect Library
Similar to the original Tcl Expect module by Don Libe, Pexpect launches or spawns another process and watches over it in order to control the interaction. The Expect tool was originally developed to automate interactive processes such as FTP, Telnet, and rlogin, and was later expanded to include network automation. Unlike the original Expect, Pexpect is entirely written in Python, which does not require TCL or C extensions to be compiled. This allows us to use the familiar Python syntax and its rich standard library in our code. Let's take a look at the Python Pexpect library.