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
- Main version is indicated with a
Note: The Patch is optional :)
Any good suggestions for a template?
This template should contain the desired output:
Output:
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:
Output: