0

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 :

  1. cisco "show clock" command
  2. cisco "Show version" command,
  3. cisco "show ip route" command.

Question, suppose i have data saved in a single file from all of those command from different routers (sorted by Router): Router A : show clock Router A : Show version Router A : show ip route Router B : show clock Router B : Show version Router B : show ip route

What i want is:

  • show-clock.texfsm start when match "show clock" in the line.
  • show-clock.textfsm stop the match "show version" in the line
  • show version start when match "show version" and stop when see "show ip route" in the line.
  • show ip route start when match "show ip route" and stop when see other show commands.

What i get : show clock template keep read and record other line (because it match pattern from other command output).

I suspect i must use "state" keyword, but it still cannot works as expected.

sample data from router from https://github.com/google/textfsm/wiki/Code-Lab:

Rtr_A# show clock
18:42:41.321 PST Sun Feb 8 2009
Rtr_A# show version
Cisco IOS Software, Catalyst 4500 L3 Switch Software (cat4500-ENTSERVICESK9-M), Version 12.2(31)SGA1, RELEASE SOFTWARE (fc3)
...
Rtr_A# show ip route
       Destination        Gateway                      Dist/Metric Last Change
       -----------        -------                      ----------- -----------
  B IN 192.0.2.76/30     via 203.0.113.183                200/100        4w2d
  B IN 192.0.2.204/30    via 203.0.113.183                200/100        4w2d
Rtr_B#show clock
...
Rtr_B#show version
...
Rtr_B#show ip route
...

TIA.

0 Answers0