TextFSM template for Cisco ISE version

29 views Asked by At

I'm pretty new to TextFSM and try to parse a "show application version ise" output from a Cisco ISE. The output looks like:

Cisco Identity Services Engine
---------------------------------------------
Version      : 3.2.0.542
Build Date   : Wed Oct 19 18:27:24 2022
Install Date : Fri Sep  8 07:14:14 2023

Cisco Identity Services Engine Patch
---------------------------------------------
Version      : 2
Install Date : Fri Sep 08 12:11:02 2023

Cisco Identity Services Engine Patch
---------------------------------------------
Version      : 3
Install Date : Fri Sep 08 12:31:55 2023

At the end of the day I'm interested in the main version (example above 3.2.0.542) and the installed patches (example: 2,3).

I tried a couple of templates, but since there is no differentiator for the line itself (Version) I fail

If referring to the example above, I want the following result lines:

[[3.2.0.542, 2], [[3.2.0.542, 3]]

or

[[3.2.0.542, [2,3]]

For me the main problem is, that the template lines for the main version and patches are the same ^Version\s+:\s+${ISE_VERSION}

The only differentiators I can think of is:

  • Main version is another Regex as the Patch version
  • Reading the output "block wise"
    • Main version is indicated with a Cisco Identity Services Engine block
    • Patch versions are indicated with a Cisco Identity Services Engine Patch block

Note: The Patch is optional :)

Any good suggestions for a template?

1

There are 1 answers

0
Mircea Cristian On

This template should contain the desired output:

##################  ##################
Value Required ISE (.*)
Value VERSION (.*)
Value BUILD_DATE (.*)
Value INSTALL_DATE (.*)

Start 
  ^Cisco Identity Services ${ISE} -> Continue
  ^Version\s+:\s+${VERSION}
  ^Build Date\s+:\s+${BUILD_DATE}
  ^Install Date\s+:\s+${INSTALL_DATE} -> Record

Output:

table_header: ['ISE', 'VERSION', 'BUILD_DATE', 'INSTALL_DATE']

['Engine', '3.2.0.542', 'Wed Oct 19 18:27:24 2022', 'Fri Sep  8 07:14:14 2023']
['Engine Patch', '2', '', 'Fri Sep 08 12:11:02 2023']
['Engine Patch', '3', '', 'Fri Sep 08 12:31:55 2023']

You can then parse the table output and use the data.

You could use Lists but you must be shore that all devices have the same number of outputs present:

##################  ##################
Value List ISE (.*)
Value List VERSION (.*)
Value List BUILD_DATE (.*)
Value List INSTALL_DATE (.*)

Start 
  ^Cisco Identity Services ${ISE} -> Continue
  ^Version\s+:\s+${VERSION}
  ^Build Date\s+:\s+${BUILD_DATE}
  ^Install Date\s+:\s+${INSTALL_DATE} 

Output:

table_header: ['ISE', 'VERSION', 'BUILD_DATE', 'INSTALL_DATE']

[['Engine', 'Engine Patch', 'Engine Patch'], ['3.2.0.542', '2', '3'], ['Wed Oct 19 18:27:24 2022'], ['Fri Sep  8 07:14:14 2023', 'Fri Sep 08 12:11:02 2023', 'Fri Sep 08 12:31:55 2023']]