I am trying to parse following sample configurations located in the same file. I have two different service in which interfaces configured. I need to get each interfaces from the each service. However, as following services' interfaces have similar templates, when try to parse vprn interfaces, I am also getting ies interfaces. And vice versa.
ies 10102 customer 1 create
interface "Y" create
description X
address 192.168.19.134/30
sap 1/3/7:3500.22 create
exit
exit
vprn 10101 customer 1 create
interface X create
description X
address 192.168.19.130/30
sap 1/3/7:3500.21 create
exit
exit
I did find a workaround to get interfaces configured under each service using ttp. But, I would like to know if there is a way to parse data using start and end with multiple lines.
For example:
{{_init_}}ies {{id}} customer {{id2}} create
interface {{interface_name}} create
address {{address|PREFIX}}
sap {{sap_port}} create
exit{{_end_}}
exit
maybe someting like this would work
Data:
Template:
Result:
You can quickly test above template here - http://textfsm.nornir.tech/