Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vtysh, zebra: fix malformed json output for multiple vrfs in command 'show ip route vrf all json' #15632

Conversation

piotrsuchy
Copy link
Contributor

Similarly to issue mentioned here: #15277, the 'show ip route vrf all json' command doesn't work as expected, because it doesn't return a valid json object.
Command 'show ip route vrf <vrf_name> json' returns a valid json object, however for multiple vrfs the output looks like this:

{//vrf1 routes}{//vrf2 routes}{//vrf3 routes}

After the fix we get:

{"vrf1":{//vrf1 routes},"vrf2:{//vrf2 routes},"vrf3":{//vrf3 routes}}

Which is a valid json object, that can be parsed effectively using built-in modules. That makes a big difference for anyone that wants to take the json outputs for multiple vrfs and make use of them. The rest of the commands remain unaffected and behave the same.

…'show ip route vrf all json'

Command 'show ip route vrf <vrf_name> json' returns a valid json object,
however if instead of <vrf_name> we specify 'all', we get an invalid json
object, like:

{//vrf1 routes}{//vrf2 routes}{vrf3 routes}

After the fix:

{"vrf1":{//vrf1 routes},"vrf2:{//vrf2 routes},"vrf3":{//vrf3 routes}}

Which is a valid json object, that can be parsed effectively using built-in
modules. The rest of the commands remains unaffected and behave the same.

Signed-off-by: Piotr Suchy <[email protected]>
@piotrsuchy piotrsuchy force-pushed the psuchy/fix_json_malformed_output_ip_route_show_vrf branch from a8e9a31 to 0e2fc3d Compare March 29, 2024 13:02
@ton31337
Copy link
Member

@Mergifyio backport dev/10.0

Copy link

mergify bot commented Mar 30, 2024

backport dev/10.0

✅ Backports have been created

@ton31337 ton31337 merged commit 3a9c16a into FRRouting:master Mar 30, 2024
9 checks passed
Jafaral added a commit that referenced this pull request Apr 1, 2024
vtysh, zebra: fix malformed json output for multiple vrfs in command 'show ip route vrf all json' (backport #15632)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants