I am rendering following data
set firewall family inet filter v4-test term accept_1 from protocol lilla
set firewall family inet filter v4-test term accept_2 then accept
set firewall family inet filter v4-test term accept_3 from source-prefix-list v4-test
set firewall family inet filter v4-test term accept_3 from destination-port 1
set firewall family inet filter v4-test term accept_3 from destination-port 2
set firewall family inet filter v4-test term accept_3 then accept
set firewall family inet filter v4-test term access_4 from source-address x.x.x.x/32
via ttp templating
parser = ttp(data=data_to_parse, template=ttp_template)
parser.parse()
results = parser.result(format='json')[0]
results_dic = json.loads(results)
Output of rendering is a json file
[
{
"v4-test": {
"accept_2": {
"action": "accept"
},
"accept_1": {
"protocol": "lilla"
},
"accept_3": [
{
"source-prefix-list": "v4-test"
},
{
"destination-port": "1"
},
{
"destination-port": "2"
},
{
"action": "accept"
}
],
"access_4": {
"source-prefix-list": "x.x.x.x/32"
}
}
}
]
Problem: I want the output data to keep the order of original data. Any hint? Thank you.