Python Networking Solutions Guide: Leverage the Power of Python to Automate and Maintain your Network Environment

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

This book shows the Python programming language's importance and power to automate network devices such as routers, switches, firewalls, system devices like Linux servers, and cloud devices like the AWS platform. It shows to manage and configure thousands of devices with a single script, saving time and preventing faults. This book covers network automation with Python specifically for Network, System, and DevOps engineers. It explains the Python basics from scratch with various features and modules. It covers the most helpful connection methods to login to multiple devices concurrently and manages them with scripts. It explains creating a customized network automation tool with many scripts. This book is divided into 11 chapters. It covers network automation and Python basics, connecting devices with Python, managing devices by scripts, creating a network automation tool, etc.

Author(s): Tolga Koca
Edition: 1
Publisher: BPB Publications
Year: 2023

Language: english
Pages: 395

1. Introduction to Network Automation
Structure
Objectives
Introduction to network automation
Benefits of network automation
Future of networking
Introduction to Python
Python usage area
Python installation
Python for Windows
Python for Linux
Python for MAC
Running Python codes
Pycharm installation for Windows
Install and import Python modules
Conclusion
Multiple choice questions
Answer
Questions
2. Python Basics
Structure
Objectives
Print and ınput functions
Print()
Input ( )
Data types
String and integer
String methods
List
List methods
Dictionary
Dictionary methods
Statements and conditions
If condition
For statement
While statement
Break and continue statement
Range statement
For else statement and nested loops
Try…except statement
Conclusion
Multiple choice questions
Answers
Questions
3. Python Networking Modules
Structure
Objectives
File handling
Open function
OS module
Word files
Excel files
RE modules
RE module functions
Special sequences
Sets in the RE module
Advanced topics of Python
Functions
Functions with parameters
Functions with default parameters
Call variables from functions
Creating modules
Classes
Conclusion
Multiple choice questions
Answers
Questions
4. Collecting and Monitoring Logs
Structure
Objectives
Connection modules
SSH connection
Paramiko module For SSH
Connect 1 device with Paramiko
Running configuration commands with Paramiko
Connect to multiple devices with Paramiko
Netmiko module for SSH
Connect a single device with Netmiko
Connect to multiple devices with Netmiko
Telnet connection
Telnetlib module for telnet
Connect to multiple devices with telnetlib
Netmiko module for telnet
Collecting logs
Collecting version and device information
Collecting CPU levels
Finding duplicated IP address
Collecting logs with multithreading
Tools and calculators
IP address validator
Subnet calculator
Conclusion
Multiple choice questions
Answers
Questions
5. Deploy Configurations in Network Devices
Structure
Objectives
Configure network devices
Configuration of interfaces
Replacing configurations on files
Configure devices with Jinja2 template
Introduction to Jinja2 template
Introduction to YAML language
Rendering Jinja template with a YAML file
Configure devices with Jinja
If statement in Jinja
Configure devices with Napalm module
Collect logs from devices with NAPALM
Configure devices with NAPALM
Configure devices with Nornir module
Configure inventory in Nornir
Connection to devices with Nornir-Netmiko
Connection to devices with Nornir-NAPALM
Configure devices by Nornir and Jinja template
Conclusion
Multiple choice questions
Answers
Questions
6. File Transfer and Plotting
Structure
Objectives
File transfers
Backup configuration file with SSH
File transfer with FTP connection
File transfer with SFTP connection
File transfer with Netmiko SCP connection
Netmiko SCP connection with concurrent module
File transfer with Nornir SCP connection
Backup configuration file with SCP
Plotting data
Plotting CPU levels
Plotting interface bandwidth
Conclusion
Multiple choice questions
Answers
Questions
7. Maintain and Troubleshoot Network Issues
Structure
Objectives
Upgrade network devices
Alert alarms in devices
Collect logs with SNMP
Send logs via email
Reachability test to network devices
Ping test script
Traceroute test script
Conclusion
Multiple choice questions
Answers
Questions
8. Monitor and Manage Servers
Structure
Objectives
Implement server environment
Download VMware player and Ubuntu
Install Ubuntu on VMware
Activate SSH connection
Maintain Linux servers
Collect logs via syslog
Login servers with secure password
Collect CPU and memory levels
Collect interface information
Collect type and permission of files
Server configurations
Create users in servers
Install packages
Transfer files with Paramiko
Reboot servers concurrently
Stop running processes by script
Conclusion
Multiple choice questions
Answers
Questions
9. Network Security with Python
Structure
Objectives
Activate security services
Install and activate the “Firewalld” service on servers
Configure firewall settings on servers
Create access lists in network devices
Manipulate network packets with scapy
Check logs and configurations
Check CPU levels periodically with Crontab
Check router configuration for insecure passwords
Check port security configuration in routers
Collect packets from ports with Pyshark
Conclusion
Multiple choice questions
Answers
Questions
10. Deploying Automation Software
Structure
Objectives
Introduction to InquirerPy module
Automation tool design
Create main tool script
Create subtask scripts
Network device scripts
Server scripts
Other remaining scripts
Conclusion
Multiple choice questions
Answers
Questions
11. Automate Cloud Infrastructures with Python
Structure
Objectives
Cloud environment deployment
Introduction to AWS
Installation of Boto3 and AWS CLI
EC2 instance management
Manage EC2 instances with Python
Connection to EC2 instances
S3 bucket management
EBS volume management
Manage EBS volumes
Create snapshots of EBS volumes
Attach EBS volume to EC2 instance
IAM user management
Conclusion
Multiple choice questions
Answers
Questions
Index