Practical Network Automation
A beginner's guide to automating and optimizing networks using Python, Ansible, and more, 2nd Edition
Abhishek Ratan
- 226 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Practical Network Automation
A beginner's guide to automating and optimizing networks using Python, Ansible, and more, 2nd Edition
Abhishek Ratan
About This Book
Leverage the power of Python, Ansible and other network automation tools to make your network robust and more secure
Key Features
- Get introduced to the concept of network automation with relevant use cases
- Apply Continuous Integration and DevOps to improve your network performance
- Implement effective automation using tools such as Python, Ansible, and more
Book Description
Network automation is the use of IT controls to supervise and carry out everyday network management functions. It plays a key role in network virtualization technologies and network functions.
The book starts by providing an introduction to network automation, and its applications, which include integrating DevOps tools to automate the network efficiently. It then guides you through different network automation tasks and covers various data digging and performing tasks such as ensuring golden state configurations using templates, interface parsing. This book also focuses on Intelligent Operations using Artificial Intelligence and troubleshooting using chatbots and voice commands. The book then moves on to the use of Python and the management of SSH keys for machine-to-machine (M2M) communication, all followed by practical use cases. The book also covers the importance of Ansible for network automation, including best practices in automation; ways to test automated networks using tools such as Puppet, SaltStack, and Chef; and other important techniques.
Through practical use-cases and examples, this book will acquaint you with the various aspects of network automation. It will give you the solid foundation you need to automate your own network without any hassle.
What you will learn
- Get started with the fundamental concepts of network automation
- Perform intelligent data mining and remediation based on triggers
- Understand how AIOps works in operations
- Trigger automation through data factors
- Improve your data center's robustness and security through data digging
- Get access infrastructure through API Framework for chatbot and voice interactive troubleshootings
- Set up communication with SSH-based devices using Netmiko
Who this book is for
If you are a network engineer or a DevOps professional looking for an extensive guide to help you automate and manage your network efficiently, then this book is for you. No prior experience with network automation is required to get started, however you will need some exposure to Python programming to get the most out of this book.
Frequently asked questions
Information
Continual Integration
- Remediation using intelligent triggers
- Standardizing configurations on scale
- Chatbot interactions
- Additional use cases
Technical requirements
- Python
- Slack account (for chatbot collaboration)
- Splunk
- API and JavaScript basics
- GitHub URL at https://github.com/PacktPublishing/Practical-Network-Automation-Second-Edition
Remediation using intelligent triggers
Step 1 – ensuring Splunk is configured to receive the data
Listed are the steps to configure Splunk for monitoring the folder:
- Select Data inputs from the Settings drop-down menu:
- Configure data input to monitor a particular folder (C:\splunklogs in our example):
- Ensure the data selection type is Automatic (Splunk has the built-in intelligence to parse the data in a database format based upon certain specific types of input, which is a command-separated file in our case). Also, the index or the main header can be modified for this new data in Splunk:
Step 2 – validating the data (sample data)
- On the main search page, we see Data Summary showing some events. A click on it will show the details, and sources will show that from which file, how many records (or events in Splunk) are being learned:
- Here is a sample set of data in Splunk's auto-discovered format (a query will be performed on this data in Splunk using Search Processing Language (SPL) that is specific to Splunk, to identify potential problems):
Step 3 – writing script
- Initialize the environment by importing libraries required for the execution of the script:
# concurrent threads executed at a time - 25
# each thread connect to the router . fetch show interfaces output
# invoke fetch_interface_summary and get the interface names in a list format
# network device ips are input in allips variable
# this takes around 30 secs to execute
# data is written on c:\splunklogs\network_device_stats_details.txt
import re
import netmiko
import time
import datetime
import math
from threading import Thread
import logging
import threading
from random import randrange
import itertools
import itertools
import sys
import base64
- Parse the given raw configuration, split the configuration into separate groupings (for example, a s...