更新时间:2021-06-18 19:23:08
封面
版权信息
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Setting Up Our Python Environment
An introduction to Python
Python versions
Why are there two active versions?
Should you only learn Python 3?
Does this mean I can't write code that runs on both Python 2 and Python 3?
Python installation
Installing the PyCharm IDE
Setting up a Python project inside PyCharm
Exploring some nifty PyCharm features
Code debugging
Code refactoring
Installing packages from the GUI
Summary
Common Libraries Used in Automation
Understanding Python packages
Package search paths
Common Python libraries
Network Python Libraries
System and cloud Python libraries
Accessing module source code
Visualizing Python code
Setting Up the Network Lab Environment
Technical requirements
When and why to automate the network
Why do we need automation?
Screen scraping versus API automation
Why use Python for network automation?
The future of network automation
Network lab setup
Getting ready – installing EVE-NG
Installation on VMware Workstation
Installation over VMware ESXi
Installation over Red Hat KVM
Accessing EVE-NG
Installing EVE-NG client pack
Loading network images into EVE-NG
Building an enterprise network topology
Adding new nodes
Connecting nodes together
Using Python to Manage Network Devices
Python and SSH
Paramiko module
Module installation
SSH to the network device
Netmiko module
Vendor support
Installation and verification
Using netmiko for SSH
Configuring devices using netmiko
Exception handling in netmiko
Device auto detect
Using the telnet protocol in Python
Push configuration using telnetlib
Handling IP addresses and networks with netaddr
Netaddr installation
Exploring netaddr methods
Sample use cases
Backup device configuration
Building the python script
Creating your own access terminal
Reading data from an Excel sheet
More use cases
Extracting Useful Data from Network Devices
Understanding parsers
Introduction to regular expressions
Creating a regular expression in Python
Configuration auditing using CiscoConfParse
CiscoConfParse library
Supported vendors
CiscoConfParse installation
Working with CiscoConfParse
Visualizing returned data with matplotLib
Matplotlib installation
Hands-on with matplotlib
Visualizing SNMP using matplotlib