vtysh: Add JSON output support for show memory - #20605
Merged
riw777 merged 3 commits intoFeb 10, 2026
Merged
Conversation
Greptile OverviewGreptile SummaryThis PR adds JSON output support to the Key Changes:
Implementation Notes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant vtysh as vtysh (CLI)
participant daemon as Daemon (bgpd, zebra, etc.)
participant lib_vty as lib_vty.c
User->>vtysh: show memory [daemon] json
alt JSON output requested
vtysh->>vtysh: argv_find("json")
vtysh->>vtysh: show_memory_send(daemon, true)
vtysh->>User: Output "{"
loop For each connected daemon
vtysh->>vtysh: Check if daemon matches filter
vtysh->>vtysh: Check if daemon is connected
vtysh->>User: Output "daemon_name":
vtysh->>daemon: vtysh_client_execute_name("do show memory json")
daemon->>lib_vty: show_memory with json flag
lib_vty->>lib_vty: use_json(argc, argv) returns true
lib_vty->>lib_vty: json_object_new_object()
lib_vty->>lib_vty: qmem_walk(qmem_walker_json, &jarg)
loop For each memory group & type
lib_vty->>lib_vty: qmem_walker_json()
alt Memory group
lib_vty->>lib_vty: Create JSON array for group
else Memory type
lib_vty->>lib_vty: Add memory stats to JSON
end
end
lib_vty->>daemon: vty_json(vty, json)
daemon->>vtysh: Return JSON output
vtysh->>User: Output daemon's JSON data
end
vtysh->>User: Output "}"
else Non-JSON output
vtysh->>vtysh: show_one_daemon() or show_per_daemon()
Note over vtysh,User: Existing flow unchanged
end
|
mjstapp
reviewed
Jan 27, 2026
ton31337
force-pushed
the
feature/show_memory_json
branch
from
January 27, 2026 17:15
4e0f3c5 to
e5bc9c8
Compare
Member
|
Not sure why |
mjstapp
reviewed
Jan 28, 2026
ton31337
force-pushed
the
feature/show_memory_json
branch
from
January 28, 2026 16:41
e5bc9c8 to
3d7668f
Compare
ton31337
force-pushed
the
feature/show_memory_json
branch
from
January 28, 2026 16:42
3d7668f to
0eaa67c
Compare
mjstapp
reviewed
Jan 28, 2026
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
ton31337
force-pushed
the
feature/show_memory_json
branch
2 times, most recently
from
January 28, 2026 16:54
42f6200 to
42db15a
Compare
mjstapp
reviewed
Jan 28, 2026
E.g.:
donatas# show memory bgpd json
{"bgpd":{
"libfrr":[
{
"name":"Buffer",
"currentAllocations":7,
"size":24,
"sizeVariable":false,
"totalBytes":168,
"maxAllocations":7,
"maxBytes":168
},
...
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
ton31337
force-pushed
the
feature/show_memory_json
branch
from
January 29, 2026 07:55
42db15a to
69f7fbc
Compare
mjstapp
approved these changes
Jan 29, 2026
mjstapp
left a comment
Contributor
There was a problem hiding this comment.
Thanks, looks good to me!
Contributor
|
ci:rerun |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.