Understanding parsers

In the previous chapter, we explored different ways to access network devices, execute commands, and return output to our terminal. We now need to work on the returned output and extract some useful information from it. Notice that, from Python's point of view, the output is just a multiline string and Python doesn't differentiate between IP address, interface name, or node hostname because they're all strings. So, the first step is to design and develop our own parser using Python to categorize and differentiate between items based on the important information in the returned output.

After that, you can work on the parsed data and generate graphs that help to visualize or even store them to persistent and external storage ...

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.