Introduction to Python Network Automation Volume I - Laying the Groundwork: The Essential Skills for Growth
معرفی کتاب «Introduction to Python Network Automation Volume I - Laying the Groundwork: The Essential Skills for Growth» نوشتهٔ Benjamin Graham، Preston Pysh، Stig Brodersen و Brendan Choi، منتشرشده توسط نشر Apress L. P.. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
Welcome to Introduction to Python Network Automation Volume I: Laying the Groundwork. In this first part of our comprehensive guide, you’ll embark on a transformative journey into the world of network automation. Whether you’re new to the IT field or seeking to strengthen your existing skills, this book serves as your roadmap to mastering the foundational skills essential for success in network automation. You’ll begin your exploration by delving into the fundamentals of Python network automation, laying a solid foundation for your learning journey. Equipped with essential Python skills, you’ll leverage them for network administration tasks, particularly on the Windows platform. Reinforce your understanding through targeted exercises designed to enhance your proficiency and navigate the complexities of VMware Workstation as you master virtualization techniques crucial for setting up your network automation environment. You’ll then venture into Linux fundamentals, learning to set up and configure server environments tailored for network automation tasks while gaining a deep understanding of file systems and TCP/IP services in Linux. Explore the power of regular expressions as you streamline network automation tasks with precision and efficiency. Discover GNS3, a vital tool for network emulation, enabling you to test and validate network designs and put your skills to the test by tackling real-world network challenges in a comprehensive lab scenario. This book provides the essential knowledge and practical experience needed to thrive in the rapidly evolving field of network automation. Whether you’re new to network automation or seeking to strengthen your existing skills, this book will unlock the vast potential of network automation and empower you to excel in this exciting field. What You’ll Learn Learn Python fundamentals and effective network automation strategies. Use Python for various network administration tasks, improving efficiency. Understand Linux basics and IP service installation techniques. Apply regular expressions in Python for data processing. Create a network automation lab with VMware Workstation for hands-on practice. Table of Contents About the Author About the Technical Reviewers Acknowledgments Introduction Chapter 1: Introduction to Python Network Automation Laying the Foundation Discovering and Developing Your Skills and Prerequisites in the IT industry Reflecting on the Past and Observing the Current Trend for a Better Future Staying Relevant as an IT Professional in a Rapidly Evolving Industry Types of IT Automation at the Enterprise Level Key Competencies for IT Professionals in Three Major Domains Comparing the Responsibilities of IT Engineers Across Different Domains Getting Started with Python and Network Automation: A Guide for Beginners What Motivates People to Learn Python? What Are the Necessary Areas of Study to Master Network Automation Using Python? Minimum Hardware Specifications for Your Laptop Software Requirements Building Network Automation Development Environment Using GNS3 Downloading Complementary Guides and Source Codes Summary Storytime 1: Mega Speed Shoe Factory Chapter 2: Learn Python Basics on Windows Learn Python Basics on Windows – Part I Printing the Obligatory Hello, World! Using Python Preparing for the Python Exercises Understanding Data Types Indentation and Code Blocks Commenting Python Naming Convention Python Exercises: Start! Variables and Strings Exercise 2-1: Create Variables and Assign Various Data Types Exercise 2-2: Create Variables and Use the print() Function to Print Output Exercise 2-3: Abbreviated Variable Assignment Exercise 2-4: Enter a String, Escape Character Backslash (\), and type() Function Exercise 2-5: Is the Variable a Container, a Tag, or a Pointer? Exercise 2-6: The Power of a Variable Exercise 2-7: String Indexing Exercise 2-8: Variable Assignment-Related Errors Exercise 2-9: SyntaxError: Unterminated String Literal Exercise 2-10: NameError: name ‘variable_name’ is not defined Exercise 2-11: SyntaxError: Invalid Syntax and Python Reserved Keyword Exercise 2-12: TypeError: ‘str’ Object Is Not Callable Exercise 2-13: Handle Long Strings Exercise 2-14: Use \ (Backslash) as an Escape Clause to Remove Special Character Meanings Exercise 2-15: Enter (Inject) Values/Strings into a String Using %s Printing, Concatenating, and Converting Strings Exercise 2-16: Use the print() and len() Functions and Create a Simple Function Exercise 2-17: Use the lower() and upper() String Methods Exercise 2-18: String Concatenation and the str() Method Exercise 2-19: Learn to Change Strings Using Curly Brackets and .format() Exercise 2-20: Adjust Text Position with Curly Brackets and .format() Exercise 2-21: Adjust the Number of Decimal Places Exercise 2-22: Ask and Receive User Input with input() Exercise 2-23: Change a Word or Character in a String Recap: Variables and Strings Numbers and Arithmetic Operators Exercise 2-24: Arithmetic Operators Exercise 2-25: Integer vs. String Recap: Arithmetic Operators Booleans and Relational Operators Exercise 2-26: Booleans Exercise 2-27: Relational Operators Exercise 2-28: Use Boolean Expressions to Test for True or False Exercise 2-29: Logical (Membership) Operators Exercise 2-30: Change the Order of Operation with () (Parentheses) Control Statements: if, elif, and else Exercise 2-31: Use if and else Exercise 2-32: Use if, elif, and else Exercise 2-33: Write Code with if, elif, and else Recap: Boolean and Conditionals Learn Python Basics on Windows – Part II Functions Exercise 2-34: Define a Function Exercise 2-35: Assign Default Values to a Function Exercise 2-36: Define Hello and Goodbye Functions Exercise 2-37: Use the odd or even Function Exercise 2-38: Nest a Function Within a Function and a lambda Function Recap: Functions Lists Exercise 2-39: Create a List and Index Items Exercise 2-40: Use append, extend, and insert in a List Slicing Exercise 2-41: Slice a list Exceptions and Error Handling Exercise 2-42: Handle Errors with try and except in a List Exercise 2-43: Find an Index of an Item in a List with the Customized Exception Practicing Lists Exercise 2-44: Practice a List The for loop and the while loop (Loops) Exercise 2-45: Use the for Loop’s upper() and capitalize() Methods Exercise 2-46: Use the while Loop and the len() Function Sorting and Ranges Exercise 2-47: Use sort() vs. sorted() to Sort a List Exercise 2-48: Link Two Lists Exercise 2-49: Find the List Length Using the len() Function Exercise 2-50: Use range() with the for Loop Exercise 2-51: Create a string list for loop() and range() with Arguments Recap: Lists and Loops Tuples Exercise 2-52: Tuple Basic Examples Exercise 2-53: Tuple to List Conversion Exercise 2-54: Handle Tuples (Are Tuples Immutable?) Exercise 2-55: Tuple-to-List and List-to-Tuple Conversions Exercise 2-56: Use a for Loop in a Tuple Exercise 2-57: Assign Multiple Variables to a Tuple Exercise 2-58: Create a Simple Tuple Function Exercise 2-59: Use Tuples as List Elements Recap: Tuples Dictionary Exercise 2-60: Dictionary Basics Exercise 2-61: Dictionary TypeError and Converting Two Lists as a Single Dictionary Exercise 2-62: Use Keys to Print Values from a Dictionary Exercise 2-63: Change a Dictionary Value Exercise 2-64: Add a New Set of Keys and Values to a Dictionary Exercise 2-65: Find the Number of Dictionary Elements Exercise 2-66: Delete Dictionary Keys and Values Exercise 2-67: Write a Python Script with a Dictionary Exercise 2-68: Dictionary for Loop and Formatting Recap: Dictionary Handling Files Exercise 2-69: Read and Display the Hosts File from Your PC Exercise 2-70: Open and Close Hosts Files Exercise 2-71: Create 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 Whitespace Exercise 2-74: Python File Mode Exercise in r Mode Exercise 2-75: Python File Mode Exercise in r+ Mode Exercise 2-76: Python file Mode Exercise in a Mode Exercise 2-77: Python File Mode Exercise in a+ Mode Exercise 2-78: Python File Mode Exercise in w Mode Exercise 2-79: Python File Mode Exercise in w+ Mode Exercise 2-80: Python File Mode Exercise in x Mode Exercise 2-81: Python File Mode Exercise in x+ Mode Exercise 2-82: Open a Byte File in Python Exercise 2-83: Handle Errors with try and except Recap: The Python File-Handling Concept Using Python Modules Time Module Exercise 2-84: Import a Time Module Sleep Method Exercise 2-85: The time.sleep() Function Exercise 2-86: Browse a Path Using the sys Module Exercise 2-87: Add a New FILEPATH Using the sys Module Exercise 2-88: Check Builtins and the sys.builin_module Exercise 2-89: Create a Simple Import sys Module Exercise 2-90: Understand Lambda by Making a Calculator Recap: Module Concept Summary Chapter 3: More Python Exercises Getting Ready for the Exercises Exercise 3-1: Concatenate a List and a Tuple Into a Single List Exercise 3-2: Use Python as a Calculator Exercise 3-3: Do Some Basic String format() Exercises Exercise 3-4: Ask for a Username Exercise 3-5: Get a Username: Version 1 Exercise 3-6: Get a Username: Version 2 Exercise 3-7: Get a Username: Version 3 Exercise 3-8: Import and Use a Custom Module Exercise 3-9: Use Commas to Add Spaces Between Strings and Speed Test the Methods Exercise 3-10: Practice if; if and else; and if, elif, and else Exercise 3-11: Practice for ~ in range with end=‘' Exercise 3-12: Practice for ~ in range Exercise 3-13: Practice for line in ~ Exercise 3-14: Use the split() Method Exercise 3-15: Practice with lstrip(), rstrip(), strip(), upper(), lower(), title(), and capitalize() Exercise 3-16: Create a File and Read It Four Different Ways Exercise 3-17: Read and Output Files for a More Detailed Understanding Exercise 3-18: Use the getpass() Module and User Input Exercise 3-19: Understand the Difference Between Encoding and Decoding Exercise 3-20: Handle CSV Files in Python with the csv Module Exercise 3-21: Output a CSV File Exercise 3-22: Find the Price of a Cisco ISR 4331 Router from a CSV File Exercise 3-23: Calculate the Total Cost of the Router Purchases: No Module Exercise 3-24: Calculate the Total Cost of the Router Purchases Using the csv Module Exercise 3-25: Convert dd-mmm-yy and Calculate the Difference in Days and Then in Years Furthering Your Understanding of Python Functions Exercise 3-26: Structure of a Function Exercise 3-27: Random Module with a List Exercise 3-28: Random Module with Numbers Exercise 3-29: random.randint Example Exercise 3-30: Use the Random Module to Play PowerBall Exploring the Python IDE Environment Summary Storytime 2: Machine vs. Human, The First Confrontation Chapter 4: Introduction to VMware Workstation VMware Workstation at a Glance Type-1 vs. Type-2 Hypervisors VMware Workstation Pro for a Proof-of-Concept Lab Before Using VMware Workstation What’s Next on VMware Workstation 17 Pro? VMware Workstation 17 Pro User Console Basic Operations of VMware Workstation 17 Pro VMware Workstation Pro: Basic Operations VMware Workstation Menu Virtual Network Adapters Virtual Network Editor Overview Virtual Network Interface Description Virtual Network Adapter Modes Explained Revealing Each Virtual Network Interface Type Host-Only Networking Bridged Networking Network Address Translation Networking Summary Chapter 5: Creating an Ubuntu Server Virtual Machine (VM) Aim for Immersive Learning by Creating the Virtual Machine Yourself! From Image to Server: Mastering VM Installation and Linux Proficiency Downloading and Installing an Ubuntu Server 22 Image Installing Ubuntu Server 22.04 LTS Logging In to a New Ubuntu Server 22 via SSH Customize the Ubuntu Server Ubuntu VM Customization 1: Enable Root User SSH Login on Ubuntu Server 22.04 Ubuntu VM Customization 2: Install a Desktop GUI and Other Packages Ubuntu VM Customization 3: Enable Root User GUI Access Taking a Snapshot of a Virtual Machine Cloning a Virtual Machine Summary Chapter 6: Creating a Fedora Server Virtual Machine (VM) Understanding the Fedora, CentOS Stream, and RHEL Relationship Downloading and Installing Fedora Server Image Downloading the Fedora 38 Server Image Installing Fedora 38 Server Accessing Fedora 38 Server via SSH Forgotten Root User Password Recovery for Fedora 38 Changing the Hostname on the Fedora Server Managing a Network Adapter on Fedora Linux Method 1: Assigning a Static IP Using nmcli (command-line) Method 2: Assigning a Static IP Using nmtui (GUI) Creating a GNS3 VM by Importing a .ova File Summary Storytime 3: The Origin of Hypervisors Chapter 7: Linux Fundamentals I – Linux File and Directory Mastery Building a Strong Linux Base for Network Automation Why Learn Linux? The Beginning of Linux Understanding the Linux Environment Understanding Linux Directories and File Formats vi vs. nano Introduction to vi Basics of vi Reopening a File in vi Copying and Pasting a Line in vi Undo Last in vi Searching for Text in vi Display the Line Number in vi Introduction to nano Installing nano Create/Open a File with nano Using the Auto-Complete Feature to Reopen a File with nano Cut (Delete) and Paste with nano String Search and Replacing String(s) Customize nano for Python Coding Linux Basic Administration Changing and Hard-Coding IP Addresses for System Stability Changing the Hostname to a Fully Qualified Domain Name (FQDN) Bypass DNS Server Lookup Using /etc/hosts Basic Linux File and Directory Commands Linux File and Directory Exercises – Set A Exercise 7-1. File and Directory Basics Exercise 7-2. Freely Create Files/Directories and Freely Navigate Through the Directories Exercise 7-3. Work with the Directories and Hidden Files Linux File and Directory Exercises – Set B Exercise 7-4. Echo, Cat, More, and Less Command Exercise Exercise 7-5. ls Command with Options Exercise 7-6. Create, Delete, and Script Files and Directories Exercise 7-7. Create a Python Application, Make Your File Executable, Add a Shebang, and Run the Application Summary Chapter 8: Linux Fundamentals II – TCP/IP Services Information on Linux: Kernel and Distribution Version System Information and Monitoring Linux Network Tools I: Introduction Linux Network Tools II: Packet INternet Groper (Ping) Linux Network Tools III: Trace Route (traceroute) Information on Linux: Use the netstat Command to Validate TCP/UDP Ports Installing TFTP, FTP, SFTP, and NTP Servers FTP Server Installation Installing the SFTP Server Installing the TFTP Server Installing the NTP Server Linux TCP/IP Troubleshooting Exercise Summary Storytime 4: Linux Odyssey: Unleashing the IT Engineer's Dream Chapter 9: Regular Expressions for Network Automation Unlocking the Power of Regular Expressions: A Universal Key to Programming Languages Mastering Regular Expressions: A Universal Key to Data Processing in Python and Beyond To re or Not to re Studying Regular Expressions Using Python Method 1: Using Notepad++ Method 2: Using the Linux Shell Method 3: Using the Internet to Study Regular Expressions Regex Operation: The Basics Character Class ([ ]) Dot (.): Single Character Match Asterisk (*): Repetition Plus (+): Repetition {m, n}: Repetition {m} {m, n} ? (Question Mark: Repetition) Python’s re Module Python re String Methods re.match() re.search() re.findall() re.finditer( ) Match Object Method Compile Options re.DOTALL (re.S) re.IGNORECASE (re.I) re.MULTILINE (re.M) re.VERBOSE (re.X) \: The Confusing Backslash Character Regular Expressions: A Brief Review and More Exploring More Metacharacters The OR Operator (|) ^ and $ (Anchors) \A and \Z \b and \B (Word Boundaries in Regular Expressions) Grouping Regular Expression Named Groups Lookahead and Lookbehind Assertions Lookahead, Lookbehind, and Non-Capturing group Practice More Lookarounds Lookaround Application Examples sub Method: Substituting Strings Substitute Strings Using sub Using sub and \g to Swap Positions Insert a Function in the sub Method Summary Chapter 10: GNS3 Basics Exploring GNS3 and VMware Networking Labs GNS3 at a Glance Installing GNS3 the First Time Downloading the GNS3 Installation File GNS3 Installation and Setup GNS3 Installation GNS3 Setup Procedures Getting Familiar with GNS3 GNS3 Menus and GUI Gracefully Shutting Down GNS3 and GNS3 VM Starting GNS3 as an Administrator Using GNS3 the First Time: Cisco IOS and Windows Lab Cisco IOS Software License and Downloading an Older Cisco IOS Decompressing Cisco IOS for GNS3 Use Decompressing Cisco IOS Method: Using the Unpack.exe Decompressing Cisco IOS Method 2: Using Dynamips Server (Optional) Installing Cisco IOS on the GNS3 VM Creating an IOS Lab Topology on GNS3 and Connecting to the Internet Installing the Microsoft Loopback Adapter Accessing GNS3 Network Devices Using MS Loopback Configuring the GNS3 IOS Router Using a Python Script from the Windows Host PC Cisco IOS and GNS3 Appliance Lab Manually Assigning an IP Address to GNS3 Linux Appliance Server Using the GNS3 Appliance Linux’s Python to Manage R1 Summary Chapter 11: Cisco IOS, Linux, TFTP, and Telnet Labs Cisco IOS, Linux VM, TFTP Server, and Telnet Practice Labs Chapter 11 Network Topology Explained Creating a New GNS3 Project: Linux VM, Cisco IOS Tcl, and TFTP Lab Mastering Script-Based File Transfers to Cisco IOS Routers Copying (Cloning) a GNS3 Project Summary Index
دانلود کتاب Introduction to Python Network Automation Volume I - Laying the Groundwork: The Essential Skills for Growth