Working with CiscoConfParse

The first example that we will work on is extracting the shutdown interfaces from a sample Cisco configuration located in a file named Cisco_Config.txt.

In this example, we can see the following:

  • From the CiscoConfParse module, we imported the CiscoConfParse class. Also, we imported the pprint module to print the output in readable format to fit the Python console output.
  • Then, we provided the config file full path to the CiscoConfParse class.
  • The final step is to use one of the built-in functions such as find_parents_w_child() and provide two parameters. The first one is the parent specification, which is searching ...

Get Hands-On Enterprise Automation with Python. now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.