Closed evilmonkey19 closed 6 months ago
Take a look at FILLDOWN
Since TextFSM produces a table as output (not JSON) then the first thing you need to decide - is what the output table needs to look like for you to be able to post-process it into JSON. Once you have your table format sorted then it should be clear which columns will need FILLDOWN to insure the innermost, child elements are complete when they are recorded to the table.
You probably want to make use of the state based parsing to make parsing the different sections of your config easier/clearer.
Lastly consider parsing this data in multiple passes. Using a different TextFSM template each time. The decision on if this is desirable or not, will be driven by whether you can readily represent the results in a single table, or several tables.
Thanks for the answer! I have already used passing multiple times over the output, which to me it produces the most maintainable template. Thanks for the suggestion :D
Hello! I'm trying to parse some output data from a certain device and I'm trying to do a nested output. I have the following output from a network device:
I would like to have a json format output like so:
Do you any suggestions how can i achieve this in textfsm? My current template in textfsm is the following: