Choi | Introduction to Python Network Automation | E-Book | www.sack.de
E-Book

E-Book, Englisch, 815 Seiten, eBook

Choi Introduction to Python Network Automation

Learn Python Programming, Linux Administration, VMware Virtualization, and Network Lab Building
2. Auflage 2024
ISBN: 979-8-8688-0146-4
Verlag: APRESS
Format: PDF
Kopierschutz: 1 - PDF Watermark

Learn Python Programming, Linux Administration, VMware Virtualization, and Network Lab Building

E-Book, Englisch, 815 Seiten, eBook

ISBN: 979-8-8688-0146-4
Verlag: APRESS
Format: PDF
Kopierschutz: 1 - PDF Watermark



Embark on a rewarding journey into Python Network Automation with this comprehensive Introduction to Python Network Automation guide. This second edition mirrors the familiar structure of the first edition while introducing updated sof tware, enhanced illustrations, refreshed facts, and the use of the thread Python module for concurrent code executions. You’ll also be treated to an exclusive bonus chapter that guides you through creating an essential IP Address Management (IPAM) and DC Infrastructure Management (DCIM) server using a Python script. 

Build your virtualized networking lab on a single laptop, mastering Python programming, Linux administration, VMware virtualization, and network proof-of-concept (POC) lab building using select technologies. This book minimizes unnecessary theoretical and conceptual noise, focusing on the essentials through practical examples and targeted exercises, providing a welcoming and pragmatic learning environment. 

By the halfway point, you’ll gain the technical skills to begin your network automation journey, including setting up a fully functional and flexible POC lab dedicated to learning network automation, all accessible from a portable laptop. Crafting small utilities and assembling a hands-on Cisco IOS-XE upgrade application represents the pinnacle of this book, delivering detailed insights into creating vital Python tools and techniques for automating your company’s Enterprise network administration tasks using Python. These proficiencies extend beyond Cisco products, easily adaptable to a range of enterprise network vendor solutions. 

Whether you’re new to Python network automation or seeking to strengthen your existing knowledge, this book serves as your gateway to unlocking the vast potential of network automation. It provides a validated roadmap to navigate and excel in this dynamic enterprise networking field.

What You'll Learn

  • Explore Python fundamentals and network automation strategies.
  • Use Python for network administration tasks.
  • Understand Linux fundamentals and IP service installation.
  • Employ regular expressions in Python.
  • Build a network automation proof-of-concept lab using VMware Workstation.
Who This Book Is For

IT engineers and developers, network managers and students, who would like to learn network automation using Python.

Choi Introduction to Python Network Automation jetzt bestellen!

Zielgruppe


Professional/practitioner


Autoren/Hrsg.


Weitere Infos & Material


Chapter 1 Introduction to Python Network AutomationLaying the FoundationExploring your skills and prerequisitesLiving as an IT Professional in this day and ageGeneral Competencies of three main IT Domain Group (The silos)Comparative analysis of IT Engineers' responsibilitiesPython and Network Automation study, where should I start?Why do people want to learn Python?What do I need to study network automation using Python?Hardware - minimum specification for laptopSoftware requirementsBuilding Network Automation Development Environment using GNS3Downloading supplementary guides and source codes
Chapter 2 Learn Python Basics on Windows'Hello, World!' and print() function in interactive modePreparing for the Python exercisesUnderstanding Data TypesIndentation and Code BlocksCommentingPython Naming ConventionPython exercisesVariables and StringsExercise 2-1: Create variables and assign various data typesExercise 2-2: Create variables and use the print() function to print outputExercise 2-3: Abbreviated variable assignmentExercise 2-4: Entering a string, escape character backslash (\) and type() functionExercise 2-5: Is variable a container, a tag, or a pointer?Exercise 2-6: String indexingExercise 2-7: Variable assignment related errorsExercise 2-8: SyntaxError: EOL while scanning string literalExercise 2-9: NameError: name 'variable_name' is not definedExercise 2-10: SyntaxError: invalid syntaxExercise 2-11: TypeError: 'str' object is not callableExercise 2-12: Adding multi-line comments with triple quotation marksExercise 2-13: Use \ (backslash) as an escape clause to remove special character meaningsExercise 2-14: Enter (inject) values/strings into a string using %sPrinting, concatenating and converting stringsExercise 2-15: print(), len() functions and create a simple functionExercise 2-16: lower() and upper() string methodsExercise 2-17: String Concatenation and str() methodExercise 2-18: Learn to change string using curly brackets and .format()Exercise 2-19: Adjust text position with curly brackets and .format()Exercise 2-20: Adjusting the number of decimal placesExercise 2-21: Ask and receive user input with input()Exercise 2-22: Changing a word or character(s) in a stringNumbers and Arithmetic OperatorsExercise 2-23: Arithmetic OperatorsExercise 2-24: Integer vs. StringRecap: Arithmetic operatorsBooleans and Relational OperatorsExercise 2-25: BooleansExercise 2-26: Relational OperatorsExercise 2-27: Boolean expressions, test True or FalseExercise 2-28: Logical (membership) operatorsExercise 2-29: Changing the order of operation with () (parentheses)Control statements - if, elif, and elseExercise 2-30: if and elseExercise 2-31: if, elif and elseExercise 2-32: Write a code with if, elif, and elseFunctionsExercise 2-33: Defining a functionExercise 2-34: Assigning default values to a functionExercise 2-35: Defining Hello and Goodbye functionsExercise 2-36: odd or even functionExercise 2-37: Nesting a function within a functionListsExercise 2-38: Create a list and index itemsExercise 2-39: Using append, extend, and insert in a listSlicingExercise 2-40: slicing a listExceptions and Error HandlingExercise 2-41: ValueError errorExercise 2-42: Handling errors with try and except in a listExercise 2-43: Find an index of an item in a list with the customized exceptionPracticing ListsExercise 2-44: Practice a listfor loop and while loop (Loops)Exercise 2-45: for loop upper() and capitalize() methodsExercise 2-46: while loop and len() functionSorting and RangesExercise 2-47: Use sort() vs sorted() to a listExercise 2-48: Linking two listsExercise 2-49: Find list length using len() functionExercise 2-50: range() and for loop()Exercise 2-51: string list for loop() and range() with argumentsTuplesExercise 2-52: Tuple basic examplesExercise 2-53: tuple to list conversionExercise 2-54: Handling tuples,is tuple immutable?Exercise 2-55: tuple to list and list to tuple conversionsExercise 2-56: Using a for loop in a tupleExercise 2-57: Assigning multiple variables to a tupleExercise 2-58: Creating a simple tuple functionExercise 2-59: Using tuples as list elementsDictionaryExercise 2-60: dictionary basics43Exercise 2-61: Dictionary TypeError and converting two lists as a single dictionaryExercise 2-62: Use keys to print values from a dictionaryExercise 2-63: Changing a dictionary valueExercise 2-64: Adding a new set of keys and values to a dictionaryExercise 2-65: Find the number of dictionary elementsExercise 2-66: Deleting dictionary keys and valuesExercise 2-67: Writing a python script with a dictionaryExercise 2-68: Dictionary for loop and formattingHandling FilesExercise 2-69: Read and display hosts file from your PCExercise 2-70: Open and close hosts files Exercise 2-71: Creating code to close a file in two ways Exercise 2-72: Create a text file, read, write and print Exercise 2-73: Use rstrip() or lstrip() to remove white spaces Exercise 2-74: Python file mode exercise – r mode Exercise 2-75: Python file modes exercise –r+ mode Exercise 2-76: Python file modes exercise –a mode Exercise 2-77: Python file modes exercise – a+ mode Exercise 2-78: Python file modes exercise – w mode Exercise 2-79: Python file modes exercise – w+ mode Exercise 2-80: Python file modes exercise – x mode Exercise 2-81: Python file modes exercise – x mode Exercise 2-82: Opening a byte file in Python Exercise 2-83: handling errors with try and except Using Python Modules Time module Exercise 2-84: import time module Sleep method Exercise 2-85: time.sleep() function Exercise 2-86: Browse path using sys module Exercise 2-87: Adding a new FILEPATH using sys module Exercise 2-88: How to check builtins and sys.builin_module? Exercise 2-89: A simple import sys module, try & except exercise Exercise 2-90: Understanding lambda by making a calculator
Chapter 3 More Python ExercisesMore Python exercisesExercise 3-1: Concatenating a list and a tuple into a single listExercise 3-2: Using Python as a calculatorExercise 3-3: basic string format() exercisesExercise 3-4: Ask for a usernameExercise 3-5: Get use name – reiterate 1Exercise 3-6: Get use name – reiterate 2Exercise 3-7: Get use name – reiterate 3Exercise 3-8: Add temporary FILEPATH, import ex3_7.py as a module, and run the scriptExercise 3_9: commas add spaces between stringsExercise 3_10: practice if, if & else, if, elif and elseExercise 3_11: Practice for ~ in range with end=' 'Exercise 3_12: Practicing for ~ in rangeExercise 3-13: Practice for line in ~Exercise 3_14: split() methodExercise 3_15: Practice lstrip(), rstrip(), strip(), upper(), lower(), title() and capitalize()Exercise 3_16: One file, four ways to readExercise 3-17: Reading and outputting files for a more detailed understandingExercise 3-18: getpass() module and user inputExercise 3-19: Difference between encoding and decodingExercise 3-20: Handling CSV files in Python with CSV moduleExercise 3-21: Output CSV fileExercise 3-22: find the price of a Cisco ISR 4331 router from a .csv fileExercise 3-23: Calculate the total cost of the router purchases – no moduleExercise 3-24: Calculate the total cost of the router purchases – using the csv moduleExercise 3-25: Convert 'dd-mmm-yy' and calculate the difference in days and then in yearsExercise 3-26: Who wants to be a millionaire 1, write a lotto application <<< New content +2 pagesExercise 3-27: Who wants to be a millionaire 2, write a Powerball application <<< New content +2 pagesExercise 3-28: Make a shooting game with Python. <<< New content +10 pagesExploring Python IDE EnvironmentChapter 4 Introduction to VMware WorkstationIntroduction to VMware Workstation4.1 Type-1 vs. Type-2 Hypervisors4.2 VMware Workstation Pro for Proof-Of-Concept Lab4.3 Before using VMware Workstation4.4 What's next on VMware Workstation 15 Pro?4.5 VMware Workstation 15 Pro user console4.6 Basic Operations of VMware Workstation 15 Pro4-7 VMware Workstation Menu4.8 Virtual Network Adapters4.8.1 Virtual Network Editor overview4.8.2 Virtual Network Interface Description4.8.3 Revealing each virtual network interface types
Chapter 5 Creating Virtual Machines Using Ubuntu 20 Server ImageDownloading and installing Ubuntu 20 Server Image5.1 Downloading Ubuntu 20.04 LTS image5.2 Installing Ubuntu 20.04 LTS Server5.3 SSH login to a new Ubuntu 20 server 5.4 Ubuntu Server Customization 5.4.1 Ubuntu VM customization 1 - enable root user SSH login on Ubuntu 20.04 5.5.2 Ubuntu VM customization 2 - install Desktop (Graphical User Interface (GUI)) and other packages 5.4.3 Ubuntu VM customization 3 - enable root user GUI access 5.5 Taking Snapshot of a Virtual Machine 5.6 Cloning a Virtual Machine
Chapter 6 Creating Virtual Machines Using Fedora 37 Server ImageDownloading and Installing Fedora 37 Server Image 6.1 Downloading Fedora 37 server image 6.2 Installing Fedora 37 Server 6-3  SSH login to a new Fedora 37 server 6.4 Easy way to manage Network adapter on Linux Creating GNS3 VM by importing .ova file 336.5 Downloading and installing the GNS3 VM from an ova file
Chapter 7 Linux FundamentalsSo, why learn Linux? 7.1 The Beginning of Linux RPM-based 7.2 Understanding the Linux Environment 7.3 Understanding Linux Directories and File Formats 7.4 vi vs. nano 7.4.1 vi - introduction 7.4.2 Nano - Introduction 7.5 Linux Basic Administration 7.5.1 Changing hostname 7.5.2 Linux Basic File and Directory Commands 7.5.3 Linux File and Directory Exercise 1 7.5.4 Linux File and Directory exercise 2
Chapter 8 Linux Basic Administration8.1 Information on Linux – kernel and distribution version 8.2 Information on Linux – netstat command to validate TCP/UDP ports 8.3 Installing TFTP, FTP, SFTP, and NTP Servers 8.3.1 FTP Server Installation 8.3.2 Install SFTP Server 8.3.3 Installing the TFTP Server 8.3.4 Installing NTP Server 8.3.5 Installing your first IPAM and DCIM  server on Ubuntu 22.04 LTS <<< New content with NetBox 3.4.4 installation and configuration for API use, +20 pages8.4 Linux TCP/IP Troubleshooting exercise
Chapter 9 Regular Expression for Network Automation9.1 Why regex? 9.1.1 To re or not to re 9.2 How to study Regular expression using Python? 9.2.1 Method 1 – using Notepad++ 9.2.2 Method 2 – Use Linux shell Regular expression breakdown: [A-Z]{3}\d{4}[/]\w+ 9.2.3 Method 3 – Using the Internet to study the regular expression 9.3 Regex Operation – The Basics 9.3.1 [ ] Character class 9.3.2 (Dot - Single character match) 9.3.3 * (Star - Repetition) 9.3.4 + (Plus - Repetition) 9.3.5 {m, n} (From m to n - Repetition) 9.4 Python re module 9.4.1 Python re string methods 9.4.2 match object method 9.5 Compile options 9.5.1 re.DOTALL (re.S) 9.5.2 re.IGNORECASE (re.I) 9.5.3 re.MULTILINE (re.M) 9.5.4 re.VERBOSE (re.X) 9.6 \ - confusing backslash character 9.7 Regular expression – a little revision plus more 9.7.1 More metacharacters 9.8 Lookahead and Lookbehind Assertions 9.8.1 Lookahead, lookbehind and non-capturing group 9.8.2 Practice more Lookarounds 9.8.3 Lookaround application examples 9.9 sub method - substituting strings 9.9.1 Substitute strings using sub 9.9.2 Using sub and \g to swap positions 9.9.3 Insert a function in sub method
Chapter 10 GNS3 BasicsGNS3 Basics 10.1 Installing GNS3 for the first time 10.1.1 Downloading GNS3 installation file 10.2 GNS3 Installation and Setup 10.2.1 GNS3 Installation 10.2.2 GNS3 Setup procedures 10.3 Getting familiar with GNS3 10.3.1 GNS3 menus and GUI 10.3.2 Gracefully shutting down GNS3 and GNS3 VM 10.3.3 Starting GNS3 as an Administrator 10.4 Using GNS3 for the first time – Cisco IOS & Windows Lab 10.4.1 Cisco IOS Software License and downloading an older Cisco IOS 10.4.2 Decompressing Cisco IOS for GNS3 use Note: Replace "your_name" with your username 10.5 Installing Cisco IOS on GNS3 VM 10.6 Creating an IOS lab Topology on GNS3 and connect to the internet 10.7 Installing MS Loopback Adapter 10.7.1 Accessing GNS3 network devices using MS loopback 10.8 Configuring GNS3 IOS router using python script from Windows Host PC Telnet Example 10.9 Cisco IOS and GNS3 Appliance lab 10.9.1 Importing and installing GNS3 Linux Appliance Server 10.9.2 Manually assigning IP address to GNS3 Linux Appliance Server 10.9.3 Use GNS3 Appliance Linux's Python to manage R1
Chapter 11 Cisco IOS LabsCisco IOS and Linux VM lab 11.1 Creating a new GNS3 project for Linux VM lab 11.2 Upload and download files to GNS3 IOS router from Linux VMs (File transfer testing Lab) 11.3 Copying (Cloning) a GNS3 project
Chapter 12 Building a Python Automation Lab EnvironmentDownloading, installing, and integrating Cisco CML-Personal L2 and L3 IOS images on GNS3 12.1 Cisco CML-PERSONAL Software License Information and Software Downloads 12.2 Downloading Cisco CML-PERSONAL IOSvL2 (Switch) Image 12.3 Downloading Cisco CML-PERSONAL IOSv (Router) Image and startup_config Files 12.4 Installing Cisco CML-PERSONAL L2 Switch and CML-PERSONAL L3 on GNS3 12.5 Installing Cisco CML-PERSONAL L2 Switch on GNS3 12.5.1 Quick communication test on CML L2 switch integration on GNS3 12.6 Installing Cisco CML-PERSONAL L3 Router on GNS3 12.6.1 Quick communication test on CML L3 router integration on GNS3 12.7 Building CML-PERSONAL lab topology
Chapter 13 Python Network Automation Lab - Basic TelnetPython Network Automation – Telnet Labs 13.1 Telnet lab 1 - Interactive Telnet session to Cisco devices on Python Interpreter Telnet Example 13.2 Telnet lab 2 - Configuring a single switch with Python telnet template 13.3 Telnet lab 3 - Configure random VLANs using a for loop 13.4 Telnet lab 4 - Configure random VLANs using a while loop 13.5 Telnet lab 5 - Configure 100 VLANs using the "for ~ in range" loop method 13.6 Telnet lab 6 – Add a privilege 3 user on multiple devices using IPs from an external file 13.7 Telnet lab 7- Taking backups of running-config (or startup-config) to local server storage
Chapter 14 Python Network Automation Labs - SSH Paramiko and NetmikoPython Network Automation Labs using paramiko and netmiko libraries Python SSH Labs - paramiko 14.1 Paramiko lab 1 - Configure clock and time zone of all devices interactively on Python Interpreter 14.2 Paramiko lab 2- Configuring NTP server on Cisco devices without user interaction (NTP lab) 14-3 Paramiko lab 3 – Create an interactive paramiko SSH script to save running configurations to the TFTP server Python SSH Labs - netmiko 14.4 Netmiko lab 1 – netmiko uses a dictionary for device information, not a JSON object 14.5 Netmiko lab 2 – Develop simple port scanner using socket module and then develop netmiko disable telnet script 14.6 Netmiko lab 3 – Netmiko Lab - config compare
Chapter 15 Python Network Automation Labs - Cron and SNMPv3Cron and SNMPv3 Labs 15.1 Cloning a GNS3 project for next lab 15.2 Quick-start to Linux Scheduler, Cron 15.2.1 Ubuntu 20.04 LTS task scheduler - crontab 15.2.2 CentOS8.1 task scheduler - crond 15.2.3 Learn cron job definitions with examples 15.3 Using Python to run SNMPv3 query 15.3.1 Quick start guide to SNMP 15.3.2 Learn to SNMPwalk on Linux Server 15.3.3 Searching and borrowing an example Python SNMP code
Chapter 16 Python Network Automation Labs - Ansible, pyATS, Docker and Twilio APIPython Network Automation Development Labs 16.1 Quick start guide to Ansible – virtualenv lab 1 16.1.1 Installing virtualenv and getting started with Ansible 16.1.2 Using Ansible to collect data from servers, routers and switches <<< New content +3 pages16.1.3 Rebooting routers and switches with Ansible Playbook <<< New content +3 pages16.2 Quick start guide to pyATS (Genie) - Virtualenv Lab 2 16.3 Sendmail lab using an imported docker image 16.3.1 Docker Installation 16.3.2 Test Driving Docker 16.3.3 Docker Sendmail Python Lab 16.3.4 Lab - Sendmail email Notification script development 16.4 CPU Utilization Monitoring lab - send an SMS message using Twilio 16.4.1 TWILIO account creation, install Twilio Python module and SMS message set-up 16.4.2 CPU utilization monitoring lab with an SMS message 16.5.1 Entering IP addresses on IPAM (NetBox) using API POST calls ^content +3 pages16.5.2 Adding device-types to IPAM (NetBox) using API POST calls <<< New content +3 pages
Chapter 17 Upgrading Multiple Cisco IOS-XE RoutersPractical Python Network Automation lab – IOS XE upgrade lab 17.1 Applying Object Orientated Programming (OOP) Concept to your network 17.2 Flow-control, controlling user input -UID, PWD, and information collector 17.3 Lab preparation 17.3.1 CSR 1000v IOS XE software and download 17.3.2 Cisco CSR 1000v installation on VMware Workstation 17.4 Discussion of how an IOS (IOS-XE/XR) is upgraded on Cisco devices 17.4.1 Tasks involved in Cisco IOS upgrade
Chapter 18 Python Network Automation Lab - Cisco IOS Upgrade min-tools DevelopmentCisco IOS upgrade applications development Part A. Pre-check tools development: 18.1 Connectivity validation tool 18.2 Collect user's login credentials and also user input 18.3 Collect new IOS filename and MD5 value from a csv file 18.4 Check MD5 value of new IOS on the server 18.5 Check the flash size on Cisco routers 18.6 Make backups of running-config, interface status, and routing table Part B. IOS Uploading and more pre-check tools development: 18.7 IOS uploading tool 18.8 Check the new IOS MD5 value on the Cisco device's flash 18.9 Options to stop or reload the routers 18.10 Check reloading device and perform post-reload configuration verification
Chapter 19 Python Network Automation Labs - Combining and Completing Cisco IOS-XE Upgrade ApplicationPython Network Automation Labs Combining and completing Cisco IOS upgrade Application


Brendan Choi is a highly accomplished Tech Lead at Secure Agility, possessing over 19 years of extensive hands-on experience in Enterprise Network Automation and diverse IT technologies. As a Certified Cisco, VMware, and Fortinet Engineer, Brendan has worked with globally renowned enterprises including Cisco Systems, Telstra, NTT (Dimension Data), Fujitsu and various reputable Enterprise IT integrators. He is dedicated to streamlining work processes and ensuring uninterrupted IT service delivery through infrastructure and business process automation. Brendan is the author of "Python Network Automation: By building an integrated virtual lab" for Acorn Publishing and has authored the 1st and 2nd editions of "Introduction to Python Network Automation: The first journey". He is currently writing “Introduction to Ansible Network Automation: KISS” for Apress and has trained over 200 Network and Systems Engineers on Python and Ansible Network Automation. Brendan's keen interest lies in Cloud, Enterprise Networking, Security, and Virtualization technologies, and he shares his knowledge, experience, and enthusiasm with the community through his blog and YouTube channel.




Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.