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
1
vote
0 answers

TextFSM: Extracting Data From Different Lines

I am trying to create a TextFSM template to extract data from certain lines in order. Raw Data Mod Ports Card Type Model Serial No. --- ----- -------------------------------------- ------------------…
gh0st
  • 402
  • 5
  • 13
1
vote
1 answer

Optional string in textFSM template

I have a cli output by moxa switch show running-config. Interface section may or may not have a name string. interface ethernet 1/3 shutdown name Unused speed-duplex Auto no flowcontrol media cable-mode auto no gmrp switchport access vlan 1 …
1
vote
2 answers

Regex, TextFSM - Match content between two characters while excluding unwanted list of strings

Hello Developer Community! I'm currently working on developing some Ansible playbooks to manage Citrix NetScaler configuration and would like to ask for some help about the following. I have the following configuration line what I would like to…
Belabacsi
  • 121
  • 2
  • 10
1
vote
1 answer

Netmiko and Textfsm Path and Env Issue Windows

I am currently trying to set up a test with Netmiko and Textfsm in Windows 10, but no matter what path I try to setup the textfsm environment variable, it still doesn't pick it up and throws an error: Valid ntc-templates not found, please install…
Alejandro Suarez
  • 149
  • 3
  • 16
1
vote
2 answers

Use a captured value as row identifier

I need to parse this raw data in order to process it: Port Align-Err FCS-Err Xmit-Err Rcv-Err UnderSize OutDiscards Gi0/1 1 2 3 4 5 6 Gi0/2 11 …
DrySaucisse
  • 53
  • 1
  • 7
1
vote
1 answer

How to escape multiline regex text to valid json?

Value Year (\d+) Value Timezone (\S+) Value MonthDay (\d+) Value Month (\w+) Value Time (..:..:..) Start ^${Time}.* ${Timezone} \w+ ${Month} ${MonthDay} ${Year} -> Record This is a template for texfsm which does parsing of cli based responses…
Justin
  • 2,940
  • 3
  • 25
  • 43
0
votes
0 answers

Textfsm column is getting populated more than required

I have an input textfile that looks like this Field1A Field2 : A1 Field3 : A1.5 Field4: 1 Field4: 1.5 Field2 : A2 Field4: 2 Field1B Field2 : B1 Field3 : B1.5 Field4: 3 Field4: 4 Field1C Field2 :…
0
votes
0 answers

Python TextFSM Parsing dump file stanzas, returning wrong values

I need to parse a single entry of a dump file. I've tried more than a few iterations of my template, and I keep getting only the entries of the first stanza. Here is my template: Value Route1 (\d+) Value Route2 (\d+) Value Route3 (\d+) Value Route4…
0
votes
0 answers

TextFSM : How to run multiple textfsm template against a single data file?

Question: How to run multiple textfsm template against a single data file ? Example from https://github.com/google/textfsm/wiki/Code-Lab , it has output and template of : cisco "show clock" command cisco "Show version" command, cisco "show ip…
0
votes
0 answers

Parse multiple lines of route target values from running config without running into the next section

I have a Cisco config file and I want to parse all vrf information, route-targets, policies etc. The problem I have is parsing multiple lines of route-targets as they do not have an associated descriptor in the same line, only white space. The…
DeGr
  • 1
0
votes
0 answers

textfsm parse two different outputs with one template

I use ntc-templates for cisco output. In all of cisco's wisdom, from 16.x to 17.x IOS-XE, they have changed the output of 'show license status' Is there a way to use one textfsm template with conditional matches to determine which part of the…
ntwrkguy
  • 23
  • 3
0
votes
0 answers

Python TextFSM template for parsing CLI output

I have CLI output from FortiGate looks like edit "Company_1" set member "Member_1" next edit "Company_2" set member "Member_3" "Member_2" "Member_6" "Member_10" next edit "Company_3" set member "Member_4"…
DjDeD
  • 1
  • 1
0
votes
1 answer

How to parse cisco switch output data with Netmiko

I am doing TDR cable-diagnostics on a Cisco switch and I need to know how to transfer that information to Excel (ordered). from netmiko import ConnectHandler #Credenciales ip = "192.168.xx.xx" username = "admin" password = "pass" pass_enable =…
pepex7
  • 1
  • 1
0
votes
0 answers

How do I Join the output of One Vrf?

I am excuting command on cisco router Here is the sample output:- ABISVP_01 65:235 import 65:236 IPV4 Unicast import 65:237 IPV4…
0
votes
0 answers

textfsm.parser.TextFSMError: State Error raised

I am still leaning python and Nornir for network automation as a network engineer. I am scripting to find any BGP issue from multiple devices with Nornir using "TextFSM". The python with nornir works correctly without "TextFSM. I get an error…