Questions tagged [python-textfsm]

a template-based state machine for parsing semi-formatted text in Python that is often used to analyze the output of CLI driven devices, such as network routers and switches, but it can be used for any textual output. This tag should not be confused with [fsm].

TextFSM is a template-based finite state machine for parsing semi-formatted text in Python developed at Google Inc.

This tag should be only used for questions specific to TextFSM and not for general or questions that work the same outside of the context of TextFSM. Should not be confused with finite state machine questions as well.

The purpose of TextFSM is to simplify the extraction of semi-structured data out of traditional network devices, such as network routers and switches, but it can be used for any (CLI-driven) textual output.

Basically, an extraction and transformation template, consisting of variables and rules with regular expressions, is applied to text input, e.g. a log file, to produce the desired result.

Further Information:

59 questions
0
votes
0 answers

Regex, TextFSM - How to avoid duplicated entries?

Hello Developer Community! I would like to ask for some help about a regular expression used in TextFSM parser. I have the following configuration lines what I would like to parse with TextFSM: Sample data: set applications application…
Belabacsi
  • 121
  • 2
  • 10
0
votes
1 answer

TextFSM - how do I capture lines with blank fields

In the text below, I would like to extract the 3 services. However only the second 2 work, since teh Service Name in the first one is blank. =============================================================================== ServiceId Type Adm …
0
votes
1 answer

Parse output with TextFSM from different sections

I am trying to create a textfsm template for command of a Cisco switch. the command is show platform. This command doesn't have a predefined template in ntc-templates. The CLI command output (Serials and MAC addresses are fake): Switch Ports …
Tes3awy
  • 2,166
  • 5
  • 29
  • 51
0
votes
2 answers

Is there a way to record multiple values for a single key with TextFSM?

I'm new to TextFSM and I'm trying to parse a BigIP F5 config using TextFSM. The final results only capturing one profile out of multiple profiles associated with a virtual server. I'm trying to get all of them captured. I already tried a lot of…
IPD86
  • 1
0
votes
1 answer

Netmiko / textfsm

'Hello, i got my information parsed the way I want it. But now I'm trying to save the output to a possible .txt file. Im not sure what to type in the "backup.write()" if I type the "output" variable it saves the whole output not the parsed…
Donny
  • 1
  • 1
0
votes
1 answer

Parse hierarchical text output with textfsm

I'm having some trouble to parse hierarchical data from an equipment with textfsm. The data is something similar to that: pcc-filter-base-name : P2P-BASE filter = 1337x filter-state = enabled flow-inactivity-time = 0 flow-initiation = uplink l7-uri…
redcode
  • 81
  • 1
  • 10
0
votes
1 answer

textfsm return empty value

I am trying to parse value from bgp neighbor output from Cisco router using textfsm but it seems like the textfsm config file is incorrect because it return empty list. Below are sample of textfsm config. Value NEIGHBOR…
0
votes
2 answers

single regex using groups that matches either of these lines

I am looking for a single regexp that will match either of these 2 lines, and capture/group the values for speed and duplex. speed: 1000Mbps (Duplex: full) speed: n/a Line #1 should have group 1 with value '1000Mbps' and group 2 value 'full'. Line…
refriedjello
  • 657
  • 8
  • 18
0
votes
0 answers

Ansible Jinja2 template - catch textfsm exception

I'm using a textfsm filter inside a Jinja2 template to create a report. The textfsm filter can throw an exception, which stops the Jinja2 template from completing. Below is how I call the textfsm filter in the Jinja2 template. The textfsm filter…
Greenjoy
  • 59
  • 2
  • 12
0
votes
2 answers

TextFSM Template for Netmiko for "inc" phrase

I am trying to create a textfsm template with the Netmiko library. While it works for most of the commands, it does not work when I try performing "inc" operation in the network device. The textfsm index file seems like it is not recognizing the…
Gauk
  • 1
0
votes
1 answer

parse_cli_textfsm filter requires TextFSM library to be installed

I'm trying to use Textfsm in a playbook I'm writing. - name: PLAY1 - Gather Data hosts: cisco_ios_switches gather_facts: False tasks: - name: Get CDP Facts ios_command: commands: - show cdp nei details …
Modo
  • 21
  • 2
0
votes
1 answer

Regex - Match word/letters underneath a specific pattern

Very unusual one but I'm trying to match output from an SSH session that may collapse view and fall underneath the output required (like a collapsed column)... Take a look at the example output: System Id Interface Circuit Id …
0
votes
1 answer

Textfsm template for arp table output

I'm Trying to create a template for the following out. I don't get any matches when run through the textfsm parser but when using a regex tester it seems like it should work. Value PROTOCOL (\w+) Value IP_ADDRESS (\d+\.\d+\.\d+\.\d+) Value…
dmw_code
  • 37
  • 4
0
votes
1 answer

match string from end on TextFSM

Would like match output from end of line to white space netmgmt@CCC-CC-CCC-RE1> show lldp neighbors Local Interface Parent Interface Chassis Id Port info System Name xe-11/3/0 ae2 00:23:9c:d5:7f:c0 …
ajay
  • 31
  • 2
  • 12
0
votes
1 answer

How to individually match three separate portions of a single line of CLI output (LLDP) with regex (TextFSM template)

I'm working with Ansible and TextFSM (Python) templates to dynamically pull LLDP info from network devices then to apply the LLDP output to the same devices interface descriptions. I Currently have a working model however I need to fine tune what is…
Mr. PBH
  • 3
  • 2