TextFSM templates for parsing show commands of network devices
Switch branches/tags
Clone or download
jkraszewski and jmcgill298 juniper_junos_show_chassis_cluster_status: Add new template (#297)
* added juniper_junos_show_chassis_cluster_status.template

* Update parsed file to be YAML

 * Parsed file is currently a list object instead of abiding by proper
JSON format.

 * Add `parsed_sample` key, and place parsed data under key.

 * Format list object to use YAML format.

* Separate parsing key map from parsing data

 * Current parsing of key map is very strict on what leading key will be, but this is likely to have high variance.

 * Add new state, `Cluster`, to parse the interesting data

* Fix collecting empty data on first `Record`

 * The template currently records an empty set of data when encountering the first Redundancy Group header.

 * Update the State change to change upon encountering the first Redundnacy Group header, and then record on every subsequent RG header.

 * Remove empty data set from parsed test file.
Latest commit 3fdfe53 Dec 7, 2018


Build Status


NTC-Templates contains a set of multi-vendor templates based around TEXTFSM parsing engine.

These templates take the raw string input from the CLI of network infrastructure devices, such as Cisco IOS, Juniper JUNOS or HPE Comware devices, run them through a TEXTFSM template and return structured text in the form of a Python dictionary.


Pull request are welcomed and automatically built and tested through TravisCI.

To contribute new templates, each new pull request must include the folowing

  • TextFSM template
  • raw version of text to be parsed
  • YAML file containing the expected parsed dictionary
  • Modified version of the index file

Some notes on contributing that should help you ensure that your TravisCI builds comes back as successful:

TextFSM Templates

TextFSM templates should be placed in the ./templates folder and should adhere to the NTC-Templates style. The TextFSM template name should be in the following format

{{ vendor_name }}_{{show_command}}

Note: The vendor name must be valid from the Netmiko library.

The Value variable should be in UPPERCASE.

An example of the proper format is shown below.

Value TIME (\d+:\d+:\d+)
Value TIMEZONE (\S+)
Value DAYWEEK (\w+)
Value MONTH (\d+)
Value DAY (\d+)
Value YEAR (\d+)

  ^${TIME}\s+${TIMEZONE}\s+${DAYWEEK}\s+${DAY}/${MONTH}/${YEAR} -> Record

Raw version of Input Text

The raw text file should contain only the output of the CLI command to be parsed. It should not contain the CLI command itself The raw text file should be placed in a folder in the ./tests directory with the same name as the template file minus the .template extension

An example of the proper format is shown below

19:35:31 UTC Sat 01/08/2011

YAML file containing expected parsed dictionary

The parsed dictionary must be in a dictionary format. All keys in the dictionary should be in all lowercase

The parsed text file should be placed in a folder in the ./tests directory with the same name as the template file minus the .template extension. The raw text file and the parsed text file should be in the same folder.

An example of the proper format is shown below



- {day: '01', dayweek: Sat, month: 08, time: '19:35:31', timezone: UTC, year: '2011'}

Multiple RAW and Parsed files are supported per folder, and are encouraged, as there are differences depending on version, length, etc... that additional testing and more real life data helps identify.

Index File

The Index file binds the templates to the commands being run. Special care has been taken on ordering, as there is potential for issues. e.g. show ip route picking up for show ip router vrf <vrf-name>. We have used a combination of ordering, as defined:

  • OS in alphabetical order
  • Command in length other
  • When Length is the same, use alphabetical order
  • Keep space between OS's


Template, Hostname, Platform, Command

arista_eos_show_mlag.template, .*, arista_eos, sh[[ow]] ml[[ag]]
arista_eos_show_vlan.template, .*, arista_eos, sh[[ow]] vl[[an]]

cisco_asa_dir.template,  .*, cisco_asa, dir

cisco_ios_show_capability_feature_routing.template,  .*, cisco_ios, sh[[ow]] cap[[ability]] f[[eature]] r[[outing]]
cisco_ios_show_interface_transceiver.template, .*, cisco_ios, sh[[ow]] int[[erface]] trans[[ceiver]]
cisco_ios_show_cdp_neighbors_detail.template, .*, cisco_ios, sh[[ow]] c[[dp]] neig[[hbors]] det[[ail]]


For any questions or comments, please feel free to swing by the networktocode slack channel.

Sign up here