Python Network Programming for Network Engineers (Python 3)

Video description

The days of configuring Cisco networks only with the command-line interface (CLI) are ending. Do you want to program networks using Python, but not sure where to start? Well, this course will show you how you can start programming Cisco networks using Python within 20 minutes.

The course begins by explaining the steps for setting up the lab and takes you through the concepts of network automation. Once you are ready with the environment and the basics, you will dive into automating networks. You will learn how to automate networks using Telnet, Secure Shell (SSH), Paramiko, Netmiko, and Network Automation and Programmability Abstraction Layer with Multivendor support (NAPALM). In the rest of the course, you will learn the various concepts of Python needed to automate the configuration of network devices.

By the end of this course, you will be able to program networks and network devices using Python 3 and Graphical Network Simulator-3 (GNS3).

What You Will Learn

  • Use Telnet to create VLANs
  • Enable Secure Shell (SSH) on switches in a network
  • Distinguish between Ubuntu and network automation container
  • Use Network Automation and Programmability Abstraction Layer with Multivendor support (NAPALM) for device configuration audit and changes
  • Become familiar with Netmiko scripts
  • Get to grips with the concepts of Python

Audience

This course is for network engineers, network architects, and for those who are looking to apply Python programming to network automation. Basic understanding of networking knowledge (CCNA) and Graphical Network Simulator-3 (GNS3) is needed to get started with this course.

About The Author

David Bombal: David Bombal (CCIE #11023 Emeritus) passed his Cisco Certified Internetwork Expert Routing and Switching exam in January 2003 and is one of a small percentage of Cisco engineers that pass their CCIE labs on their first attempt. David was qualified as a Cisco Certified Systems Instructor (CCSI #22787) many years ago! He has been conducting Cisco courses for over 15 years and has delivered instructor-led courses in various countries around the world covering a wide range of Cisco topics from CCNA to CCIE. He has also personally developed Cisco engineer utilities, such as the VPN Config Generator, software, training materials, eBooks, videos and other products, which are used throughout the world. David has designed, implemented, and managed networks ranging from single sites to those that span 50 countries.

Table of contents

  1. Chapter 1 : Introduction
    1. Introduction
  2. Chapter 2 : Lab Setup
    1. Installing the Graphical Network Simulator (GNS3) 2.2 Graphical User Interface (GUI)
    2. Installing the Graphical Network Simulator-3 (GNS3) 2.2 Virtual Machine
    3. Graphical Network Simulator-3 (GNS3) IOS Images
    4. Installing Continuous Machine Learning (CML) Virtual Internet Routing Lab (VIRL 2.0) - Part 1
    5. Installing Continuous Machine Learning (CML) Virtual Internet Routing Lab (VIRL 2.0) - Part 2
    6. Installing Emulated Virtual Environment (EVE)-New Generation (NG)
    7. Emulated Virtual Environment (EVE)-New Generation (NG) Cisco Images
    8. DevNet: Free Continuous Machine Learning (CML)
  3. Chapter 3 : Quick Start Guide to Network Automation
    1. Quick Start 1: Setting up the Graphical Network Simulator-3 (GNS3) Lab and Integrated Development Environments (IDEs)
    2. Quick Start 2: Creating a Telnet Script
    3. Quick Start 3: Testing a Telnet Script
    4. Quick Start 4: Telnet to a Switch and Create VLANs
    5. Quick Start 5: Loops
    6. Quick Start 6: PEP8: Python Style Guide
    7. Quick Start 7: Configuring Switch Virtual LANs (VLANs) Using Loops
    8. Quick Start 8: Creating a Multiple Switch Network
    9. Quick Start 9: Opening a File of Switch Internet Protocol (IP) Addresses
    10. Quick Start 10: Configuring Multiple Switches with a Loop
    11. Quick Start 11: Loops within Loops
    12. Quick Start 12: Backup Network Device Configurations
  4. Chapter 4 : Netmiko: Using Secure Shell (SSH) for Network Automation
    1. Netmiko Part 1: Introduction
    2. Netmiko Part 2: Enabling Secure Shell (SSH) on Switches in the Network
    3. Netmiko Part 3: Your First Netmiko Secure Shell (SSH) Script
    4. Netmiko Part 4: Scripting for Multiple Switches
    5. Netmiko Part 5: Running a Script and Configuring Multiple Devices
    6. Netmiko Part 6: File of Multiple Cisco Commands
    7. Netmiko Part 7: Programming Multiple Switches with File of Commands
    8. Netmiko Part 8: Scripting to Program an Entire Network
    9. Netmiko Part 9: Running a Script to Program an Entire Network
  5. Chapter 5 : Network Automation and Programmability Abstraction Layer with Multivendor support (NAPALM)
    1. Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) Introduction
    2. Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) Python 3 versus Python 2.7
    3. Installing Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM)
    4. Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) Connect to Switch 1 (P68_14)
    5. JSON and More Commands
    6. Media Access Control (MAC) Address Table and Address Resolution Protocol (ARP) Cache
  6. Chapter 6 : Network Automation and Programmability Abstraction Layer with Multivendor (NAPALM) and Border Gateway Protocol (BGP)
    1. Using Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) to Retrieve Border Gateway Protocol (BGP) Neighbor Information - Part 1
    2. Use Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) to retrieve Border Gateway Protocol (BGP) Neighbor Information - Part 2
    3. Use Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) to Retrieve Border Gateway Protocol (BGP) Neighbor Information - Part 3
    4. Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM): Multiple Border Gateway Protocol (BGP) Neighbors
    5. Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) and Bigger Border Gateway Protocol (BGP) Network - Part 1
    6. Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) and Bigger Border Gateway Protocol (BGP) Network - Part 2
  7. Chapter 7 : Using Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) for Device Configuration Audit and Changes
    1. Using Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) to Configure Access Lists
    2. Checking if Access Control List (ACL) Already Exists and Adding if Missing
    3. Using Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) for Auditing Device Configurations
    4. Using Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM) to Add Multiple Configuration Files
    5. Network Automation and Programmability Abstraction Layer with Multivendor Support (NAPALM): Multiple Configuration Files and Multiple Devices
  8. Chapter 8 : Iteration Examples: Netmiko Scripts
    1. Netmiko Iteration: Script Overview
    2. Netmiko Iteration (Script 1): Basic Script
    3. Netmiko Iteration (Script 2): Opening a File of Commands
    4. Netmiko Iteration (Script 3): Configuring Multiple Devices Using a File of Devices
    5. Netmiko Iteration (Script 4): Removing Passwords from the Script
    6. Netmiko Iteration (Script 5): Handling Exceptions (Error)
    7. Netmiko Iteration (Script 6): Determining Device Types and Running a Specific Device Type
    8. Netmiko Iteration (Script 7): Iterating Device Typescript
  9. Chapter 9 : Netmiko Scaling
    1. Part 1: Encrypted Password File
    2. Part 2: Netmiko Sequential - Part 1
    3. Part 3: Netmiko Sequential Part 2
    4. Part 4: Netmiko Multithreading
    5. Part 5: Netmiko Thread Pools
  10. Chapter 10 : Python Theory
    1. Theory Topics - Very Short
    2. Keep Learning
    3. Setting up Python 2.7 and 3
    4. Python 2.7 and 3 Examples
    5. Basic Hello World Scripts
  11. Chapter 11 : Python Theory: Objects, Variables, and Data Types
    1. Python Objects - Part 1
    2. Python Objects - Part 2
    3. Python Variables - Part 1
    4. Python Variables - Part 2
    5. Python Variables - Part 3
    6. Python Variables - Part 4
    7. Data Types
    8. Testing Data Types
  12. Chapter 12 : Python Theory: Numbers
    1. Introduction
    2. Numeric Types
    3. Integer (Int) and Float Data Types
    4. Operators - Part 1
    5. Operators - Part 2
    6. Operators - Part 3
    7. Binary, Hexadecimal, and Octal
    8. Binary, Decimal, and Octal Number Examples
    9. Integer (int) Calculation
    10. Floats
  13. Chapter 13 : Python Theory: Strings
    1. Strings
    2. Strings
    3. Converting to a String Using the str() Function
    4. Escape Special Character Meaning with \
    5. Strings
    6. String Concatenation with the Addition (+) Operator
    7. Multiplication (*) Operator
    8. String Offsets - Extract Characters with []
    9. string slice _ slicing
    10. string slice _ slicing 2
    11. string slice _ slicing 3
    12. lower upper
    13. startswith endswith Methods
    14. Strip lstrip() and rstrip() Methods
    15. isdigit() Method
    16. count() Method
    17. Old Style Text Using %
    18. Strings: New Way to Do Text Using {}
    19. dir() Method (P73_9)
  14. Chapter 14 : Getting Version Information from a Switch
    1. Getting Show Version from Switch
    2. Telnet and String Offset
    3. Showing Version Using the len() Method
    4. Split Functions - Part 1
    5. Split Functions - Part 2
    6. list() and join() Methods
    7. List and len - use Interface example
    8. Index Introduction
    9. Real Switch Get Version Using Index and Slice
    10. Python 3 Telnet to Switch
    11. count() Method
    12. Using the find() Method to Get Information from a Real Switch
    13. Python 3 Telnet versus Python 2 - Finding the Version of the Software
    14. Find not Found
    15. String Methods - upper() Method
    16. String Methods - startswith() and endswith() Methods
    17. String Methods - strip() Method
    18. String Methods - split() Method
    19. String Methods - join() Method
    20. String Methods - Is It in a String?
    21. String Concatenation
    22. Capitalize, Upper, Lower, and Swap
  15. Chapter 15 : Python Theory: Comparisons
    1. Boolean Comparisons
    2. Boolean Truth Table
    3. Boolean Truth Table Demo
    4. False Conditions
  16. Chapter 16 : Python Theory: Lists
    1. Lists versus Tuples
    2. Lists
    3. Creating a List Using Split
    4. Lists in Lists
    5. Lists versus Tuples - Documentation
    6. list(), merge(), and extend() Methods
    7. List Methods
    8. lists insert and delete
    9. list pop index and in
    10. Reverse Sort
    11. len copy list
  17. Chapter 17 : Python Theory: Tuples
    1. Tuples
    2. Tuples and Sequences
  18. Chapter 18 : Python Theory: Code Structures
    1. Comments in Code
    2. Line Continuation
  19. Chapter 19 : Python Theory: If/Else/Else-if Logic
    1. If Logic
    2. Physical Router Demonstration
    3. Else-if Logic
  20. Chapter 20 : Python Theory: While Loops
    1. While Loop
    2. Infinite While Loop with Break
    3. Infinite While Loop with Continue
    4. While Loop with a List
    5. While Loop with Else
  21. Chapter 21 : Python Theory: For Loop
    1. For Loop
    2. For Loop with Dictionary
    3. For Loop with If and Lists
  22. Chapter 22 : Python Theory: Ranges
    1. Ranges - Part 1
    2. Ranges - Part 2
  23. Chapter 23 : Python Theory: Dictionaries
    1. Dictionary Theory
    2. Dictionary Demonstration
    3. Combining Dictionaries
    4. Dictionaries: Clear and Check
    5. Dictionaries: Adding values
  24. Chapter 24 : Python Theory: Functions
    1. Functions Introduction - Part 1
    2. Functions Introduction - Part 2
    3. Functions - Part 3
    4. Functions - Netmiko and Router
    5. Functions - Netmiko and Router (continued)
    6. Function 6 - Named Keyword Arguments (Netmiko)

Product information

  • Title: Python Network Programming for Network Engineers (Python 3)
  • Author(s): David Bombal
  • Release date: December 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781838551957