ciscoconfparse2 Logo

Contents:

  • Introduction
  • Installation
  • CLI Command
  • CiscoConfParse Examples
  • CiscoConfParse Tutorial
    • Getting Config Values with CiscoConfParse
    • CiscoConfParse Fundamentals: Using Parent / Child Relationships
    • ciscoconfparse2 Configuration branches
    • Example Usage: Build configuration diffs
  • Build and Development
  • Unit-Tests and SonarCloud
  • API
ciscoconfparse2
  • CiscoConfParse Tutorial
  • View page source

CiscoConfParse Tutorial

This tutorial will cover the features that most CiscoConfParse users care about. We make a couple of assumptions throughout this tutorial…

  • You already know Python

  • You (naturally) have a basic understanding of Cisco IOS

Contents:

  • Getting Config Values with CiscoConfParse
    • Intro to BaseCfgLine
      • BaseCfgLine has .parent and .children attributes
    • String methods
    • Regular expressions
    • re_match_typed(): Get a value from an object
    • re_match_iter_typed(): Iterate over all children and get a value
    • Getting multiple values from an interface with re_list_iter_typed()
  • CiscoConfParse Fundamentals: Using Parent / Child Relationships
    • IOS Parent-child relationships
      • Example: Retrieving text from an IOSCfgLine object
    • Baseline configuration for these examples
    • Example Usage: Finding interface names that match a substring
    • Example Usage: Finding parents with a specific child
      • find_parent_objects()
    • Example Usage: Finding parents without a specific child
  • ciscoconfparse2 Configuration branches
  • Example Usage: Build configuration diffs
    • Baseline Configurations
      • bucksnort_before.conf
      • bucksnort_after.conf
    • Diff Script
    • Rollback Script
Previous Next

© Copyright 2007-2025, David Michael Pennington <mike /at\ pennington [dot] net>. Last updated on May 17, 2025.

Built with Sphinx using a theme provided by Read the Docs.