I'm new to TextFSM and I'm trying to parse a BigIP F5 config using TextFSM. The final results only capturing one profile out of multiple profiles associated with a virtual server. I'm trying to get all of them captured.
I already tried a lot of TextFSM combination of commands but maybe I just fail to understand how it properly works.
Input
ltm virtual /Common/Cust_A_Virtual_Server {
destination /Common/10.10.10.10:443
ip-protocol tcp
mask 255.255.255.255
pool /Common/Cust_A_pool
profiles {
/Common/Cust_A_SSL {
context clientside
}
/Common/Cust_A_http { }
/Common/tcp { }
}
rules {
/Common/Cust_A_iRule
}
source 0.0.0.0/0
translate-address enabled
translate-port enabled
vlans {
/Common/Cust_A_v1100
}
vlans-enabled
}
Current Result
{
"virtual": "Cust_A_Virtual_Server",
"virtualpart": "Common",
"vprof": "tcp",
"vprofpart": "Common"
}
Desired Result
{
"virtual": "Cust_A_Virtual_Server",
"virtualpart": "Common",
"vprof": ["Cust_A_SSL","Cust_A_http","tcp"]
"vprofpart": ["Common","Common","Common"]
}
I used below TextFSM template to get above "Current Result"
Value Filldown virtual (\S+)
Value Filldown virtualpart (\S+)
Value Required vprof ([a-zA-Z\/\-0-9.]+(?!:))
Value vprofpart (\S+)
Start
^ltm\svirtual\s\/${virtualpart}\/${virtual} -> Continue
^\s+profiles\s[{]\n+ -> Continue.Record
^\s+\/${vprofpart}\/${vprof}\s[{] -> Continue.Record