Skip to content

lib, zebra: Vty show yield/resume, use for "show ip route"#19337

Open
mjstapp wants to merge 3 commits into
FRRouting:masterfrom
mjstapp:vty_show_resume
Open

lib, zebra: Vty show yield/resume, use for "show ip route"#19337
mjstapp wants to merge 3 commits into
FRRouting:masterfrom
mjstapp:vty_show_resume

Conversation

@mjstapp
Copy link
Copy Markdown
Contributor

@mjstapp mjstapp commented Aug 5, 2025

This is some preliminary work towards support for yield/resume during long-running show commands - such as "show ip route" or the high-scale bgp show commands. I understand there's been some interest in that area that may appear in a PR ... soon, and I wanted to offer some of the vty library ideas in case that aspect is useful.
This PR adds library support, and converts the "show ip[X] route" commands in zebra so that they can use the yield/resume features.

The main zebra change is converting the series of apis that locates vrfs and route-tables and then iterates for the all-vrfs and all-tables forms of the clis. These apis now use a common show "context" struct that captures the incoming cli parameters, such as afi/safi and various filters. The context struct also includes fields to capture the last-processed key data from zebra's route-nodes and route-entries; that data is then used after yielding when resuming iteration.

A question for reviewers would be: which error cases should be treated as failure, and which should be handled gracefully? For example, if a vrf or route-table is deleted before a show iteration resumes, should the show command just fail and stop? or should it terminate data from the deleted vrf (for json particularly) and move on to the next object in the iteration?

@github-actions github-actions Bot added the rebase PR needs rebase label Aug 15, 2025
@mjstapp mjstapp force-pushed the vty_show_resume branch 2 times, most recently from 7327949 to 00baaab Compare August 18, 2025 18:17
@mjstapp
Copy link
Copy Markdown
Contributor Author

mjstapp commented Aug 18, 2025

added a small commit that should help some CI pass - only yield in common show handler when the calling path supports yield/resume. Also cleaned up a style warning.

@mjstapp
Copy link
Copy Markdown
Contributor Author

mjstapp commented Aug 19, 2025

rebase to newer master

Comment thread lib/vty.c
&vty->yield_resume.t_resume);

/* Ensure reading new input is disabled */
event_cancel(&vty->t_read);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we stop the read action at this point, how can we respond to certain control commands, such as using Ctrl+C to terminate output?
Can we control vtysh so that it does not respond to any command line input, except for control commands, until it receives the finish response from the previous command?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

correct - there isn't a way yet to interrupt one of these long-running commands. I'm hoping we can get some benefits from this first round of changes, ensure that they're working correctly, and then that's a follow-on that I'm hoping to do.

@mjstapp
Copy link
Copy Markdown
Contributor Author

mjstapp commented Aug 28, 2025

Updated and rebased; start another CI cycle, and open for review now

@mjstapp mjstapp marked this pull request as ready for review August 28, 2025 16:06
@mjstapp mjstapp changed the title lib, zebra: Vty show yield/resume [DRAFT] lib, zebra: Vty show yield/resume, use for "show ip route" Aug 28, 2025
@mjstapp
Copy link
Copy Markdown
Contributor Author

mjstapp commented Aug 29, 2025

pushed some fixes

@github-actions
Copy link
Copy Markdown

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 5, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 5, 2026

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@mjstapp mjstapp force-pushed the vty_show_resume branch 2 times, most recently from d08581d to 77cd1e2 Compare February 5, 2026 22:01
@github-actions github-actions Bot removed the conflicts label Feb 5, 2026
@mjstapp
Copy link
Copy Markdown
Contributor Author

mjstapp commented Feb 26, 2026

rebase to use new srcdest table api, and newer master

@mjstapp
Copy link
Copy Markdown
Contributor Author

mjstapp commented Feb 26, 2026

fixed a one-liner, let's try CI again...

@riw777
Copy link
Copy Markdown
Member

riw777 commented Mar 3, 2026

the only question I think is open here is whether Max routes to show before yielding should be configurable or not ...

@mjstapp
Copy link
Copy Markdown
Contributor Author

mjstapp commented Mar 3, 2026

yes, still looking at that, and doing some additional testing around vrfs and route-tables

the only question I think is open here is whether Max routes to show before yielding should be configurable or not ...

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@mjstapp mjstapp force-pushed the vty_show_resume branch 2 times, most recently from 2e4bddb to e5484a4 Compare April 9, 2026 13:45
@github-actions github-actions Bot removed the conflicts label Apr 9, 2026
@mjstapp
Copy link
Copy Markdown
Contributor Author

mjstapp commented Apr 9, 2026

clearing conflicts, again, sigh

@riw777
Copy link
Copy Markdown
Member

riw777 commented Apr 13, 2026

really just waiting on deciding if this should be configurable, I think (?) ... I don't know if @choppsv1 still has comments open here

@choppsv1
Copy link
Copy Markdown
Contributor

choppsv1 commented Apr 13, 2026

really just waiting on deciding if this should be configurable, I think (?) ... I don't know if @choppsv1 still has comments open here

I don't have any comments. I've done this generically for YANG modeled data (which does include routes), but haven't opened a PR for it yet, and regardless that shouldn't block this work.

@github-actions
Copy link
Copy Markdown

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Mark Stapp added 3 commits June 2, 2026 10:50
Support YIELD operation for long-running cli operations. A new
api allows a daemon to supply a callback and context pointer;
the vty lib will reschedule and call through to the daemon
allowing it to resume a long-running show operation. The vty
lib avoids new reads until the daemon is done.

Signed-off-by: Mark Stapp <mjs@cisco.com>
Yield and resume long-running show operation using the vty
yield feature; capture "resume" context as we iterate through
route tables.

Signed-off-by: Mark Stapp <mjs@cisco.com>
Ensure the common show code can tell when it's being used in
a path that supports yield/resume; only yield when that's
happening.

Signed-off-by: Mark Stapp <mjs@cisco.com>
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.

4 participants