This section will provide an overview of Netmiko parsing and then explore how we can use TTP to parse our device output.

The related scripts and code can be found within examples/parsing/ttp.

Netmiko Parsing

Netmiko provides the ability to parse the data returned from the device into a Python data structure. By having our data in a Python based structure rather than a single block of text, it allows us to interact with the data in a programmatic way. Below visualizes this further:


Nemiko provides support for the following open source parsing libraries. Below provides a table showing Netmikos implementation of each. It shows whether you can supply your own template and if a template library for the parser is available.

Parser Custom Templates Template Library
TTP (Template Text Parser) Yes No
TextFSM Yes Yes
Genie No Yes

TTP Overview

TTP (Template Text Parser) is a fairly new tool. A TTP template (shown below) is defined, this is then applied to your data, and your structured data is rendered. TTP is straightforward to use, one of the main reasons for this is that it abstracts away much of the regex required when creating parsing templates.

interface {{ interface }}
 ip address {{ ip }}/{{ mask }}
 description {{ description }}
 ip vrf {{ vrf }}
Members Only Content
To get access join our membership and enjoy:
  • Deep Dive Library
  • Community Support
  • Hands-on Examples
  • Multivendor Labs (beta)

100% Satisfaction Guaranteed!
Cancel your membership at any time.

Join our Membership Today
Close You've successfully subscribed to PacketFlow.
Close Success! Your account is fully activated, you now have access to all content.
Close Welcome back! You've successfully signed in.
Close Nearly there! To activate your account, please click the link in the email we just sent you.