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

bgpd: show json output changes to optimize various show commands #17431

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

krishna-samy
Copy link
Contributor

This PR includes multiple commits that optimize the show json output for various BGP show commands in scaled setup.

Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please write a topotest to verify this new CLI command + documentation.

bgpd/bgp_evpn_vty.c Outdated Show resolved Hide resolved
bgpd/bgp_vty.c Outdated Show resolved Hide resolved
bgpd/bgp_vty.c Outdated Show resolved Hide resolved
bgpd/bgp_vty.c Outdated Show resolved Hide resolved
bgpd/bgp_vty.c Outdated Show resolved Hide resolved
bgpd/bgp_vty.c Outdated Show resolved Hide resolved
bgpd/bgp_vty.c Outdated Show resolved Hide resolved
@krishna-samy krishna-samy force-pushed the bgpd_json_commits branch 3 times, most recently from c32f90a to b2af790 Compare November 16, 2024 05:57
Pdoijode and others added 2 commits November 15, 2024 22:48
Introduced JSON support of "show bgp router" command

VTY:
mlx-3700-19# show bgp router
BGP started gracefully at Tue Nov 14 21:18:34 2023
Graceful restart completed at Tue Nov 14 21:18:37 2023
Number of BGP instances (including default): 1

JSON:
mlx-3700-19# show bgp router json
{
  "bgpStartedAt":"Tue Nov 14 21:18:34 2023\n",
  "bgpStartedGracefully":"Yes",
  "grComplete":"Yes",
  "grCompletedAt":"Tue Nov 14 21:18:37 2023\n",
  "bgpInMaintenanceMode":"No",
  "bgpInstanceCount":1
}

Issue:3624937
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
Json object could lead to out-of-memory in scaled bgp l2vpn evpn route setup.

Changes:

- not use pretty print and stringify smaller json objects to reduce memory
usage
- free memory after ouput of json_rd
- minor formatting of json output

Commands supported with this Json stringify:

show bgp l2vpn evpn route detail json
show bgp l2vpn evpn route detail type 2 json
show bgp l2vpn evpn route detail type 2 self-originate json
show bgp l2vpn evpn route detail self-originate json
show bgp l2vpn evpn route json
show bgp l2vpn evpn route type 2 json
show bgp l2vpn evpn route type 2 self-originate json
show bgp l2vpn evpn route self-originate json

Ticket:#3513249

Issue:3513249

Signed-off-by: Ashwini Reddy <ashred@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
@krishna-samy krishna-samy force-pushed the bgpd_json_commits branch 5 times, most recently from cc3769b to 819db39 Compare November 16, 2024 09:21
@ton31337
Copy link
Member

Please fix frrbot yet.

Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, the documentation is missing for this new CLI command.

@krishna-samy krishna-samy force-pushed the bgpd_json_commits branch 2 times, most recently from 6c0726e to 631ba8f Compare November 16, 2024 14:03
@krishna-samy
Copy link
Contributor Author

Please write a topotest to verify this new CLI command + documentation.

Done

@ton31337
Copy link
Member

Lots of failed existing tests?

Sindhu Parvathi Gopinathan and others added 4 commits November 18, 2024 18:58
JSON object could lead to out-of-memory in scaled bgp
neighbors received-routes/advertised-routes setup.

Changes:

not use pretty print and stringify smaller json objects to reduce memory
usage
free memory after ouput of json object

Commands supported with this Json stringify:

```
show bgp vrf <vrf-id> neighbors <nbr-id> advertised-routes json
show bgp vrf <vrf-id> neighbors <nbr-id> advertised-routes detail json
show bgp vrf <vrf-id> neighbors <nbr-id> advertised-routes <prefix> json
show bgp vrf <vrf-id> neighbors <nbr-id> received-routes json
show bgp vrf <vrf-id> neighbors <nbr-id> received-routes detail json
show bgp vrf <vrf-id> neighbors <nbr-id> received-routes <prefix> json
```

Ticket:#3513253, #3513254

Issue:3513253, 3513254

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
Issue: 3576989

Ticket# 3576989

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>

Signed-off-by: Ashwini Reddy's <ashred@nvidia.com>
This commit has changes to validate show bgp router json command

Signed-off-by: Krishnasamy R <krishnasamyr@nvidia.com>
Signed-off-by: Krishnasamy R <krishnasamyr@nvidia.com>
@krishna-samy
Copy link
Contributor Author

Lots of failed existing tests?

Fixed the json format issue

@krishna-samy krishna-samy marked this pull request as ready for review November 19, 2024 05:25
@krishna-samy
Copy link
Contributor Author

CI:rerun

if (json)
if (json) {
if (first) {
vty_out(vty, "\"%s\":", rd_str);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by these literal json outputs: why do we want to hard-code these kinds of components in the output? if we're not managing the json object hierarchy correctly, I'd rather we fix that than stick some hard-coded tokens in the output like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the parameters were identified to stringify them in the output so that the overall memory consumption is reduced when the json command was executed in a high scale setup.

@krishna-samy
Copy link
Contributor Author

krishna-samy commented Nov 22, 2024

Still, the documentation is missing for this new CLI command.

Hi @ton31337, This is taken care. Please take a look!

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.

5 participants