frr
frr copied to clipboard
pbr: fix nexthop-group json output
- JSON format is changed. currently json output returns as array format, in which we cannot add extra attributes under it. so, we modified the JSON format into dict.
- Added nhgCount into vtysh "show pbr nexthop-groups json".
- Addressed interface-name & vrf-id issues. currently, "vrfId" is mapped with interface name.
supported commands:
show pbr nexthop-groups json
show pbr nexthop-groups <nh-grp> json
Testing:
Before fix:
leaf12# show pbr nexthop-groups json
[
{
"id":10001,
"name":"nh-grp-2",
"valid":true,
"installed":false,
"nexthops":[
{
"nexthop":"12.10.10.1",
"vrfId":"swp1", ====> wrongly mapped
"valid":true
}
]
},
{
"id":10000,
"name":"nh-grp-1",
"valid":false,
"installed":false,
"nexthops":[
{
"nexthop":"11.10.10.1",
"vrfId":"lo", ====> wrongly mapped
"valid":false
}
]
}
]
After fix:
leaf11# show pbr nexthop-groups nh-grp-1 json
{
"10000":{
"id":10000,
"name":"nh-grp-1",
"valid":false,
"installed":false,
"nexthops":[
{
"nexthop":"11.10.10.1",
"valid":false
},
{
"nexthop":"2.2.2.1",
"interfaceName":"swp1",
"vrfId":0,
"valid":false
}
]
},
"nhgCount":1
}
Signed-off-by: Sindhu Parvathi Gopinathan's [email protected]