Mastering Python Networking
Your one stop solution to using Python for network automation,
DevOps, and SDN
Eric Chou
BIRMINGHAM - MUMBAI
Mastering Python Networking
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the author, nor Packt Publishing, and its
dealers and distributors will be held liable for any damages caused or alleged to be caused
directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
First published: June 2017
Production reference: 1230617
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78439-700-5
www.packtpub.com
Credits
Author
Eric Chou
Copy Editor
Gladson Monteiro
Reviewer
Allen Su
Project Coordinator
Virginia Dias
Commissioning Editor
Kartikey Pandey
Proofreader
Safis Editing
Acquisition Editor ;
Meeta Rajani
Indexer
Rekha Nair
Content Development Editor
Sweeny Dias
Graphics
Kirk D'Penha
Technical Editors
Prashant Chaudhari
Komal Karne
Production Coordinator ;
Aparna Bhagat
Foreword
Over my 20 years in computer networking, I have been lucky to work on a handful of
popular, large-scale systems. If you had asked me in 2001, I would have told you my
favorite project was AOL Instant Messenger. To scale to the size that we did in the early
days, we had to create our own APIs for provisioning, security, and control over all aspects
of the service--all aspects save the physical network, that is. This was a pain, but we lived
with it as compute and storage needs were dynamic while network needs stayed reasonably
static. In 2010, while working on what would become Microsoft Azure, it was clear that
usage patterns have changed. Compute and storage have now been disaggregated, so it is
more important than ever to have non-blocking connectivity and the ability to utilize any
overlay technology required by the workload.
Within the last few years, we have seen quite a shift in thinking, from network device
vendors adding APIs and Python scripting environments to their devices in the hope of
them being driven programmatically. In this book, Eric Chou helps us gain a thorough
understanding of interfacing with networks and network devices using Python, from
interacting with a single device to large numbers of devices with complex automation using
Ansible. Then, he takes us to my favorite topics of network monitoring and security, as well
as an array of OpenFlow projects controlled through the Python-based Ryu SDN controller.
Eric and I worked together at Microsoft, where we built Microsoft DEMon, an Openflow-
based network packet broker. Eric's deep understanding of Python and his love for
automation show in every project we work on together. I have had the pleasure to see many
of Eric's examples from this book used in real life and proven in actual projects. In Mastering
Python Networking, Eric is adding some theory and a set of practical examples taken from
real problems that he has solved.
Rich Groves
Director of R&D at A10 Networks