Hands-On Cisco Automation with Python
close menu
Bookswagon
search
My Account
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Home > Computing and Information Technology Books > Computer programming / software engineering > Programming and scripting languages: general > Hands-On Cisco Automation with Python: Streamline Network Tasks Using Netmiko, NAPALM, and Nornir for Beginners
Hands-On Cisco Automation with Python: Streamline Network Tasks Using Netmiko, NAPALM, and Nornir for Beginners

Hands-On Cisco Automation with Python: Streamline Network Tasks Using Netmiko, NAPALM, and Nornir for Beginners


     0     
5
4
3
2
1



International Edition


X
About the Book

Learn how to simplify Cisco network management with practical Python automation.

Modern networks demand speed, accuracy, and scalability. Hands-On Cisco Automation with Python teaches network professionals how to automate common Cisco IOS tasks using Python and three widely adopted tools: Netmiko, NAPALM, and Nornir.

This practical, example-driven guide shows how to replace repetitive manual work with reusable scripts that configure devices, collect operational data, and validate network state. Readers follow clear, step-by-step examples that explain both the Python code and the Cisco IOS commands involved.

The book focuses on real-world automation, not theory, making it ideal for readers new to network automation who want immediate, usable results.

What You’ll Learn

  • Automate Cisco IOS access and command execution with Python
  • Manage and validate configurations using NAPALM
  • Scale automation across multiple devices with Nornir
  • Work with structured data such as JSON and Python dictionaries
  • Build reusable scripts to improve consistency and reduce errors

Who This Book Is For

  • Network engineers and administrators
  • CCNA and early-career networking professionals
  • IT practitioners transitioning into automation
  • Anyone managing Cisco IOS-based networks


Table of Contents:

    Introduction xxiii

Chapter 1 Introducing Netmiko, NAPALM, and Nornir 1

    The 3 Ns: Netmiko, NAPALM, and Nornir 1

    Automation and Programmability for All Levels 4

    How Much Cisco IOS and Python Do I Need to Know? 4

    What Do I Need to Get Started? 5

    Using AI as an Alternative to Physical Equipment 6

    Summary 7

Part 1 Netmiko

Chapter 2 Getting Started with Netmiko 9

    Why Start with Netmiko? 9

    A First Look at a Netmiko Program 10

    The Basic Netmiko Framework 11

    Optional: Exploring Python Classes, Objects, Instances, and Methods 15

    Your Turn 17

    Sending Command Output to a Variable 19

    The send_command_expect() Method 23

    The save_config() Method 26

    Debugging Netmiko by Using the Session Log 28

    Summary 34

Chapter 3 Configuring Devices with Netmiko 35

    The send_command() Method 35

    Summary 50

Chapter 4 Accessing Multiple Devices with Netmiko 53

    Using a Variable to Store an IP Address 53

    Understanding Python for Loops 54

    Iterating Through Multiple Devices 56

    Using Dictionaries to Store Device Connection Parameters 65

    Using Python’s getpass() for Secure Password Input 71

    Using Netmiko Exceptions for Troubleshooting 73

    Maintaining Multiple SSH Connections Simultaneously 77

    Summary 81

Part 2 NAPALM

Chapter 5 Introducing NAPALM and Structured Data 85

    What Is NAPALM, and How Is It Different from Netmiko? 85

    Installing the NAPALM Library 88

    Basic NAPALM Framework 88

    How NAPALM Retrieves Data Without an API on Cisco IOS 91

    Good News, Bad News: Understanding Structured Data 92

    get_facts(): Our First NAPALM Method and Dictionary 95

    Assigning the Dictionary to a Variable 97

    Understanding Different Types of Values in a Dictionary 99

    Creating a NAPALM Dictionary Without a Device 100

    NAPALM Methods 102

    Using Python Interactive Mode to Experiment with NAPALM 105

    Summary 107

Chapter 6 Understanding Python Dictionaries with NAPALM 109

    How NAPALM Organizes Data 110

    A Single Dictionary 110

    A Dictionary of Dictionaries 115

    A List of Dictionaries 122

    Sample Program Using All Three Types of Dictionaries 127

    Comparing the Three Types of Dictionaries 131

    Methods by Type of Data Structure 133

    Summary 135

Chapter 7 Iterating Through NAPALM Dictionaries 137

    Live or Simulated Data 138

    Working with .keys(), .values(), and .items() in NAPALM Dictionaries 140

    Using a for Loop with Dictionary Methods 143

    Determining the Type of Value 147

    Looping Through Key/Value Pairs with .items() and Processing Values with isinstance() 153

    Iterating Through a Dictionary of Dictionaries 167

    Iterating Through a List of Dictionaries 173

    Summary 176

Chapter 8 Configuring Devices with NAPALM 179

    A Quick Overview of NAPALM Configuration Methods 179

    Introducing Our Example Scenario 180

    Configuring a Device with load_merge_candidate() 182

    Using the cli() method 188

    Using load_replace_candidate() to Replace the Configuration 193

    Displaying Running and Startup Configuration Files 199

    Next Step: Nornir 200

    Summary 201

Part 3 Nornir

Chapter 9 Introducing Nornir: A Pythonic Framework for Network Orchestration 203

    What Is Orchestration? 204

    How Does Nornir Compare to Netmiko and NAPALM? 205

    How Nornir Uses Netmiko and NAPALM 206

    Installing Nornir 207

    Basic Nornir Framework: Python and YAML 207

    Your First Nornir Program and YAML Files 208

    What’s Next? 218

    Summary 219

Chapter 10 Using Nornir with Netmiko 221

    Installing Support for Netmiko: nornir_netmiko 221

    Using Nornir and netmiko_send_command() 222

    Sending Configuration Commands with netmiko_send_config 236

    Summary 246

Chapter 11 Using Nornir with NAPALM 247

    A Quick Review 247

    Installing Support for NAPALM: nornir_napalm 249

    nornir_napalm Tasks 250

    Advantages of Using These Tasks with Nornir 251

    Using Nornir and the napalm_cli Task 251

    Using Nornir and the napalm_get Task 261

    Using Nornir and the napalm_configure Task 268

    Summary 276

Chapter 12 Inventory Management with Nornir 277

    A Quick Overview with a Focus on Inventory 278

    Where Inventory Data Comes From 280

    A Note on Filtering 281

    Inventory Management Core Architecture 282

    Hosts 282

    Groups 289

    Effective Values After Inheritance 292

    Using Group Data for Filtering 295

    Defaults 296

    Accessing Inventory Data 298

    Inventory Plugins 300

    Inventory Plugin Options 301

    Summary 319

Part 4 What’s Next

Chapter 13 What’s Next 321

    Why Network Automation Became Necessary 321

    Netmiko, NAPALM, and Nornir in Context 324

    Ansible, NETCONF, and RESTCONF: Expanding the Automation Comparisons 331

    Understanding YANG Models 332

    Understanding APIs 334

    Artificial Intelligence and Network Automation 336

    Closing Thoughts 338

Appendix A Python Virtual Environments 341

Appendix B Understanding expect_string with send_command() 345

Appendix C Using Python Dictionaries as NAPALM Outputs 347

Appendix D The Relationship Between Python Dictionaries and JSON 353

Appendix E Understanding Objects and Variables in Python 355

Appendix F Using a Recursive Function to Handle Nested Dictionaries of Any Depth 357

Appendix G Using Tabular Output 359

Appendix H Using Public and Private Keys 361

Appendix I Netmiko-Supported Network Operating Systems 365

 

9780135463192, TOC, 3/25/2026



About the Author :

Rick Graziani has been teaching and working in the computer networking industry since 1980. He is a full time Computer Science/Computer Information Systems faculty member at Cabrillo College and an adjunct Computer Science and Engineering faculty member at the University of California Santa Cruz. Rick also works for Cisco Systems on their Curriculum Engineering team as part of the Cisco Networking Academy. He has written several books for Cisco Press including Fundamentals of IPv6 and has presented at technical conferences for the Cisco Networking Academy. Prior to teaching, he worked in the information technology field for Santa Cruz Operation, Tandem Computers, Lockheed Martin and served in the U.S. Coast Guard. When he is not working, he is most likely surfing at one of his favorite Santa Cruz surf breaks.

Adrian Iliesiu, CCIE No. 43909 (EI), is a network engineer with more than 20 years of professional experience in the field. He currently works as a Principal Engineer within the Cisco DevNet organization. Throughout his career, Adrian has held a wide range of roles, including team leader and network, systems, and QA engineer across multiple industries and international organizations. In his current role at Cisco, Adrian focuses on advancing network programmability and automation, with particular emphasis on enterprise infrastructure. He is an established author, a distinguished speaker at Cisco Live!, and a recipient of the prestigious Cisco Pioneer Award. Adrian has also appeared on Cisco TechWise, Cisco Champion podcasts, and DevNet webinars. He is the host of the Simplifying Network Automation with NerGru series of live streams. He holds a Bachelor’s degree in Electronics and Telecommunications from the Technical University of Cluj-Napoca and a Master’s degree in Telecommunication Networks from Politehnica University of Bucharest.


Best Sellers


Product Details
  • ISBN-13: 9780135463192
  • Publisher: Pearson Education (US)
  • Publisher Imprint: Cisco Press
  • Height: 233 mm
  • No of Pages: 416
  • Spine Width: 24 mm
  • Weight: 707 gr
  • ISBN-10: 013546319X
  • Publisher Date: 15 May 2026
  • Binding: Paperback
  • Language: English
  • Returnable: Y
  • Sub Title: Streamline Network Tasks Using Netmiko, NAPALM, and Nornir for Beginners
  • Width: 186 mm


Similar Products

Add Photo
Add Photo

Customer Reviews

REVIEWS      0     
Click Here To Be The First to Review this Product
Hands-On Cisco Automation with Python: Streamline Network Tasks Using Netmiko, NAPALM, and Nornir for Beginners
Pearson Education (US) -
Hands-On Cisco Automation with Python: Streamline Network Tasks Using Netmiko, NAPALM, and Nornir for Beginners
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Hands-On Cisco Automation with Python: Streamline Network Tasks Using Netmiko, NAPALM, and Nornir for Beginners

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept


    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!