Skip to content

bgpd: Replace update-delay with convergence-wait#21355

Open
donaldsharp wants to merge 1 commit intoFRRouting:masterfrom
donaldsharp:convergence_wait
Open

bgpd: Replace update-delay with convergence-wait#21355
donaldsharp wants to merge 1 commit intoFRRouting:masterfrom
donaldsharp:convergence_wait

Conversation

@donaldsharp
Copy link
Copy Markdown
Member

The update-delay command implies that FRR is just waiting for some time before actually sending updates to a peer. This is not what actually happens. What actually happens is that all bestpath processing is delayed until after this timer pops as well. In an interest of clarifying behavior, especially in light of a desire to add more control to when certain actions happen in bgp. We are changing what the command name is in FRR.

The `update-delay` command implies that FRR is just waiting
for some time before actually sending updates to a peer.  This
is not what actually happens.  What actually happens is that all
bestpath processing is delayed until after this timer pops as well.
In an interest of clarifying behavior, especially in light of
a desire to add more control to when certain actions happen in
bgp.  We are changing what the command name is in FRR.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
@donaldsharp
Copy link
Copy Markdown
Member Author

As discussed in the technical meeting. I would like to propose that we rename update-delay to convergence-wait inside of bgp. I've added a 3 year CPP_NOTICE and duplicated the json outputed as well. From my perspective we would need general agreement from a good chunk of the community before this could go forward.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 25, 2026

Greptile Summary

This PR renames the BGP update-delay feature to convergence-wait across the entire bgpd subsystem to better reflect that the feature delays both bestpath selection and update advertisements — not merely update sending. The approach is sound: internal C symbols, VTY commands, JSON keys, documentation, and tests are all updated. The old update-delay commands are kept as hidden aliases for backward compatibility.

However, there are several concrete bugs that need to be addressed before merge:

  • New per-VRF convergence-wait command is never installedbgp_convergence_wait_cmd and no_bgp_convergence_wait_cmd are defined with DEFPY but no install_element(BGP_NODE, ...) call exists for them. Users under a BGP instance context cannot use the new convergence-wait command at all.
  • Hidden no_bgp_update_delay_cmd has the wrong CLI string — the DEFPY_HIDDEN backward-compat command was accidentally changed to "no convergence-wait ..." instead of keeping "no update-delay ...". This breaks any saved config using no update-delay in a VRF context, and creates a duplicate (hidden) registration for the "no convergence-wait" string.
  • JSON key mismatch between code and tests — the test file was updated to expect "convergenceDelayLimit" and "convergenceWaitEstablishWait", but the production code emits "convergenceWaitLimit" and "convergenceDelayEstablishWait" respectively. The tests will fail as written.
  • Duplicate/typo JSON keybgp_vty.c emits three copies of the same value in show bgp router json: "bgpConvergenceWaitTime", "bgpUpdateDelayTime", and "bgpconvergenceWaitTime" (lowercase c). The third appears to be an accidental copy-paste error.

Confidence Score: 2/5

  • Not safe to merge: the new per-VRF CLI command is inaccessible, backward compat for no update-delay is broken, and tests will fail due to JSON key mismatches.
  • The bulk of the rename (internal symbols, headers, FSM, packet processing, docs) is correct and clean. But bgp_vty.c has three co-located bugs that collectively mean the feature doesn't work as advertised: the new convergence-wait VTY command is never registered in BGP_NODE, the hidden no update-delay alias has the wrong CLI string breaking backward compat, and the JSON key names emitted by the code don't match the test assertions — so CI will fail.
  • bgpd/bgp_vty.c (missing install_element calls, wrong hidden CLI string, duplicate JSON key) and tests/topotests/bgp_update_delay/test_bgp_update_delay.py (JSON key name mismatches vs. production code).

Important Files Changed

Filename Overview
bgpd/bgp_vty.c Core of the rename: adds new convergence-wait DEFPY commands and keeps old update-delay as hidden. Critical bugs: new bgp_convergence_wait_cmd/no_bgp_convergence_wait_cmd are never installed in BGP_NODE; hidden no_bgp_update_delay_cmd has its CLI string changed to "no convergence-wait" (breaks backward compat and duplicates the new command). Duplicate/typo JSON key bgpconvergenceWaitTime (lowercase c) also emitted alongside two correct keys.
tests/topotests/bgp_update_delay/test_bgp_update_delay.py Test expectations updated to new JSON keys, but several key names do not match what the production code actually emits: test expects convergenceDelayLimit but code outputs convergenceWaitLimit; test expects convergenceWaitEstablishWait but code outputs convergenceDelayEstablishWait. Tests will fail.
bgpd/bgp_fsm.c Straightforward rename of all internal symbols (bgp_update_delay_*bgp_convergence_wait_*) including timer, struct fields, and log messages. No logic changes.
bgpd/bgpd.h Struct fields renamed: v_update_delayv_convergence_wait, timer fields, and timestamp buffers. Clean, mechanical rename with no logic changes.
bgpd/bgp_packet.c Renamed bgp_check_update_delaybgp_check_convergence_wait, update_delay_overconvergence_wait_over. Clean rename, logic unchanged.
bgpd/bgpd.c Three call-sites updated to use renamed fields (v_convergence_wait, t_convergence_wait). No logic changes.
bgpd/bgp_route.c Single timestamp field rename: update_delay_zebra_resume_timeconvergence_wait_zebra_resume_time. No logic change.
bgpd/bgp_updgrp_adv.c Two call-sites updated: bgp_update_delay_activebgp_convergence_wait_active. Clean rename.
doc/user/bgp.rst Documentation updated from update-delay to convergence-wait throughout. Note added explaining the rationale. The note mistakenly says "convergence-delay" in the explanation text instead of "convergence-wait", but this is a minor wording inconsistency.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["BGP peer establishes"] --> B{"bgp_convergence_wait_configured?"}
    B -- No --> Z["Normal route advertisement"]
    B -- Yes --> C["bgp_convergence_wait_begin()\nPlug process_queue\nStart t_convergence_wait timer\nSet peer.convergence_wait_over = 0"]
    C --> D{"t_establish_wait != t_convergence_wait?"}
    D -- Yes --> E["Start t_establish_wait timer"]
    D -- No --> F["Wait for EORs / peer events"]
    E --> F
    F --> G{"Peer EOR received or\nrestarted peer?"}
    G -- Yes --> H["bgp_check_convergence_wait()\nCount received_eors + restarted_peers"]
    G -- No --> I{"t_convergence_wait\nexpired?"}
    I -- Yes --> J["bgp_convergence_wait_timer()\ncalls bgp_convergence_wait_end()"]
    H --> K{"All peers accounted for?"}
    K -- No --> F
    K -- Yes --> J
    J --> L["bgp_convergence_wait_end()\nUnplug process_queue\nSet convergence_wait_over=1\nResume zebra + peer updates\nUpdate timestamps"]
    L --> Z
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: bgpd/bgp_vty.c
Line: 22097-22098

Comment:
**New `convergence-wait` commands missing from `BGP_NODE`**

`bgp_convergence_wait_cmd` and `no_bgp_convergence_wait_cmd` are defined with `DEFPY` but are never installed into `BGP_NODE`. As a result, the new per-VRF `convergence-wait` command is inaccessible to users — only the hidden (legacy) `update-delay` command is registered here. The comment says `/* bgp convergence-wait command */` but the two new commands are never installed.

```suggestion
	/* bgp convergence-wait command */
	install_element(BGP_NODE, &bgp_convergence_wait_cmd);
	install_element(BGP_NODE, &no_bgp_convergence_wait_cmd);
	install_element(BGP_NODE, &bgp_update_delay_cmd);
	install_element(BGP_NODE, &no_bgp_update_delay_cmd);
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: bgpd/bgp_vty.c
Line: 2651-2658

Comment:
**Hidden `no_bgp_update_delay` has wrong CLI string, breaking backward compatibility**

The hidden `no_bgp_update_delay_cmd` was changed to use `"no convergence-wait ..."` instead of keeping `"no update-delay ..."`. This has two problems:

1. **Backward compatibility is broken**: existing configs that saved `no update-delay` in a VRF context will now be rejected.
2. **Duplicate CLI string**: both `no_bgp_convergence_wait_cmd` and this hidden command register `"no convergence-wait ..."` for `BGP_NODE`. However, since only `no_bgp_update_delay_cmd` is installed in `BGP_NODE` (the new `no_bgp_convergence_wait_cmd` is not — see other comment), the deconfig path works only via this hidden command with the wrong name.

The correct fix is to keep the old CLI string for backward compat:

```suggestion
DEFPY_HIDDEN (no_bgp_update_delay,
       no_bgp_update_delay_cmd,
       "no update-delay [(0-3600) [(1-3600)]]",
       NO_STR
       "Force initial delay for best-path and updates\n"
       "Max delay in seconds\n"
       "Establish wait in seconds\n")
{
	return bgp_convergence_wait_deconfig_vty(vty);
}
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: tests/topotests/bgp_update_delay/test_bgp_update_delay.py
Line: 131-132

Comment:
**JSON key mismatch: test expects `convergenceDelayLimit` but code emits `convergenceWaitLimit`**

The `bgp_show_summary` function in `bgp_vty.c` emits `"convergenceWaitLimit"`, but the test (and the parallel `_bgp_check_update_delay_and_wait` and `_bgp_check_vrf_update_delay_and_wait` functions below) expect `"convergenceDelayLimit"`. These tests will fail.

Similarly, the test at lines 148–151 expects `"convergenceWaitEstablishWait"` but the code emits `"convergenceDelayEstablishWait"`.

The JSON key names are inconsistent throughout the new code — some use the `convergenceDelay*` prefix and others use `convergenceWait*`. Either the test expectations or the production code needs to be aligned to a single naming scheme.

Affected test assertions:
- `"convergenceDelayLimit"` (lines ~132, 159) — code emits `"convergenceWaitLimit"`
- `"convergenceWaitEstablishWait"` (line ~151, 164) — code emits `"convergenceDelayEstablishWait"`

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: bgpd/bgp_vty.c
Line: 12582

Comment:
**Duplicate JSON key with inconsistent casing: `bgpconvergenceWaitTime`**

Three JSON fields are now emitted for the same value:
- `"bgpConvergenceWaitTime"` (new canonical name)
- `"bgpUpdateDelayTime"` (old name, kept for backward compat)
- `"bgpconvergenceWaitTime"` (lowercase `c` — looks like an accidental typo)

The third entry with a lowercase `c` does not match any expected naming convention and appears to be a copy-paste error. It should be removed or, if intentional, should be documented.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "bgpd: Replace `update-delay` with `conve..." | Re-trigger Greptile

Comment thread bgpd/bgp_vty.c
Comment on lines 22097 to 22098
install_element(BGP_NODE, &bgp_update_delay_cmd);
install_element(BGP_NODE, &no_bgp_update_delay_cmd);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 New convergence-wait commands missing from BGP_NODE

bgp_convergence_wait_cmd and no_bgp_convergence_wait_cmd are defined with DEFPY but are never installed into BGP_NODE. As a result, the new per-VRF convergence-wait command is inaccessible to users — only the hidden (legacy) update-delay command is registered here. The comment says /* bgp convergence-wait command */ but the two new commands are never installed.

Suggested change
install_element(BGP_NODE, &bgp_update_delay_cmd);
install_element(BGP_NODE, &no_bgp_update_delay_cmd);
/* bgp convergence-wait command */
install_element(BGP_NODE, &bgp_convergence_wait_cmd);
install_element(BGP_NODE, &no_bgp_convergence_wait_cmd);
install_element(BGP_NODE, &bgp_update_delay_cmd);
install_element(BGP_NODE, &no_bgp_update_delay_cmd);
Prompt To Fix With AI
This is a comment left during a code review.
Path: bgpd/bgp_vty.c
Line: 22097-22098

Comment:
**New `convergence-wait` commands missing from `BGP_NODE`**

`bgp_convergence_wait_cmd` and `no_bgp_convergence_wait_cmd` are defined with `DEFPY` but are never installed into `BGP_NODE`. As a result, the new per-VRF `convergence-wait` command is inaccessible to users — only the hidden (legacy) `update-delay` command is registered here. The comment says `/* bgp convergence-wait command */` but the two new commands are never installed.

```suggestion
	/* bgp convergence-wait command */
	install_element(BGP_NODE, &bgp_convergence_wait_cmd);
	install_element(BGP_NODE, &no_bgp_convergence_wait_cmd);
	install_element(BGP_NODE, &bgp_update_delay_cmd);
	install_element(BGP_NODE, &no_bgp_update_delay_cmd);
```

How can I resolve this? If you propose a fix, please make it concise.

Comment thread bgpd/bgp_vty.c
Comment on lines 2651 to +2658
no_bgp_update_delay_cmd,
"no update-delay [(0-3600) [(1-3600)]]",
"no convergence-wait [(0-3600) [(1-3600)]]",
NO_STR
"Force initial delay for best-path and updates\n"
"Max delay in seconds\n"
"Establish wait in seconds\n")
{
return bgp_update_delay_deconfig_vty(vty);
return bgp_convergence_wait_deconfig_vty(vty);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Hidden no_bgp_update_delay has wrong CLI string, breaking backward compatibility

The hidden no_bgp_update_delay_cmd was changed to use "no convergence-wait ..." instead of keeping "no update-delay ...". This has two problems:

  1. Backward compatibility is broken: existing configs that saved no update-delay in a VRF context will now be rejected.
  2. Duplicate CLI string: both no_bgp_convergence_wait_cmd and this hidden command register "no convergence-wait ..." for BGP_NODE. However, since only no_bgp_update_delay_cmd is installed in BGP_NODE (the new no_bgp_convergence_wait_cmd is not — see other comment), the deconfig path works only via this hidden command with the wrong name.

The correct fix is to keep the old CLI string for backward compat:

Suggested change
no_bgp_update_delay_cmd,
"no update-delay [(0-3600) [(1-3600)]]",
"no convergence-wait [(0-3600) [(1-3600)]]",
NO_STR
"Force initial delay for best-path and updates\n"
"Max delay in seconds\n"
"Establish wait in seconds\n")
{
return bgp_update_delay_deconfig_vty(vty);
return bgp_convergence_wait_deconfig_vty(vty);
DEFPY_HIDDEN (no_bgp_update_delay,
no_bgp_update_delay_cmd,
"no update-delay [(0-3600) [(1-3600)]]",
NO_STR
"Force initial delay for best-path and updates\n"
"Max delay in seconds\n"
"Establish wait in seconds\n")
{
return bgp_convergence_wait_deconfig_vty(vty);
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: bgpd/bgp_vty.c
Line: 2651-2658

Comment:
**Hidden `no_bgp_update_delay` has wrong CLI string, breaking backward compatibility**

The hidden `no_bgp_update_delay_cmd` was changed to use `"no convergence-wait ..."` instead of keeping `"no update-delay ..."`. This has two problems:

1. **Backward compatibility is broken**: existing configs that saved `no update-delay` in a VRF context will now be rejected.
2. **Duplicate CLI string**: both `no_bgp_convergence_wait_cmd` and this hidden command register `"no convergence-wait ..."` for `BGP_NODE`. However, since only `no_bgp_update_delay_cmd` is installed in `BGP_NODE` (the new `no_bgp_convergence_wait_cmd` is not — see other comment), the deconfig path works only via this hidden command with the wrong name.

The correct fix is to keep the old CLI string for backward compat:

```suggestion
DEFPY_HIDDEN (no_bgp_update_delay,
       no_bgp_update_delay_cmd,
       "no update-delay [(0-3600) [(1-3600)]]",
       NO_STR
       "Force initial delay for best-path and updates\n"
       "Max delay in seconds\n"
       "Establish wait in seconds\n")
{
	return bgp_convergence_wait_deconfig_vty(vty);
}
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 131 to +132
output = json.loads(router.vtysh_cmd("show ip bgp sum json"))
expected = {"ipv4Unicast": {"updateDelayLimit": 20}}
expected = {"ipv4Unicast": {"convergenceDelayLimit": 20}}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 JSON key mismatch: test expects convergenceDelayLimit but code emits convergenceWaitLimit

The bgp_show_summary function in bgp_vty.c emits "convergenceWaitLimit", but the test (and the parallel _bgp_check_update_delay_and_wait and _bgp_check_vrf_update_delay_and_wait functions below) expect "convergenceDelayLimit". These tests will fail.

Similarly, the test at lines 148–151 expects "convergenceWaitEstablishWait" but the code emits "convergenceDelayEstablishWait".

The JSON key names are inconsistent throughout the new code — some use the convergenceDelay* prefix and others use convergenceWait*. Either the test expectations or the production code needs to be aligned to a single naming scheme.

Affected test assertions:

  • "convergenceDelayLimit" (lines ~132, 159) — code emits "convergenceWaitLimit"
  • "convergenceWaitEstablishWait" (line ~151, 164) — code emits "convergenceDelayEstablishWait"
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/topotests/bgp_update_delay/test_bgp_update_delay.py
Line: 131-132

Comment:
**JSON key mismatch: test expects `convergenceDelayLimit` but code emits `convergenceWaitLimit`**

The `bgp_show_summary` function in `bgp_vty.c` emits `"convergenceWaitLimit"`, but the test (and the parallel `_bgp_check_update_delay_and_wait` and `_bgp_check_vrf_update_delay_and_wait` functions below) expect `"convergenceDelayLimit"`. These tests will fail.

Similarly, the test at lines 148–151 expects `"convergenceWaitEstablishWait"` but the code emits `"convergenceDelayEstablishWait"`.

The JSON key names are inconsistent throughout the new code — some use the `convergenceDelay*` prefix and others use `convergenceWait*`. Either the test expectations or the production code needs to be aligned to a single naming scheme.

Affected test assertions:
- `"convergenceDelayLimit"` (lines ~132, 159) — code emits `"convergenceWaitLimit"`
- `"convergenceWaitEstablishWait"` (line ~151, 164) — code emits `"convergenceDelayEstablishWait"`

How can I resolve this? If you propose a fix, please make it concise.

Comment thread bgpd/bgp_vty.c
@@ -12537,7 +12580,9 @@ DEFPY(show_bgp_router,
json_object_int_add(json, "bgpOutputQueueLimit", bm->outq_limit);
json_object_int_add(json, "zebraAnnounceCount",
zebra_announce_count(&bm->zebra_announce_head));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Duplicate JSON key with inconsistent casing: bgpconvergenceWaitTime

Three JSON fields are now emitted for the same value:

  • "bgpConvergenceWaitTime" (new canonical name)
  • "bgpUpdateDelayTime" (old name, kept for backward compat)
  • "bgpconvergenceWaitTime" (lowercase c — looks like an accidental typo)

The third entry with a lowercase c does not match any expected naming convention and appears to be a copy-paste error. It should be removed or, if intentional, should be documented.

Prompt To Fix With AI
This is a comment left during a code review.
Path: bgpd/bgp_vty.c
Line: 12582

Comment:
**Duplicate JSON key with inconsistent casing: `bgpconvergenceWaitTime`**

Three JSON fields are now emitted for the same value:
- `"bgpConvergenceWaitTime"` (new canonical name)
- `"bgpUpdateDelayTime"` (old name, kept for backward compat)
- `"bgpconvergenceWaitTime"` (lowercase `c` — looks like an accidental typo)

The third entry with a lowercase `c` does not match any expected naming convention and appears to be a copy-paste error. It should be removed or, if intentional, should be documented.

How can I resolve this? If you propose a fix, please make it concise.

@enkechen-panw
Copy link
Copy Markdown
Contributor

Is this really worth changing? The update-delay is a well-established concept (Please search for "Cisco IOS bgp update-delay"). It controls the initial best-path calculation, RIB installation and updates to peers.

@donaldsharp
Copy link
Copy Markdown
Member Author

I think so yes, because it is confusingly named and we want to introduce more control to allow for bestpath processing but not sending route updates to the peers yet. We discussed this during the technical meeting and I was asked to give specific examples so I did.

@enkechen-panw
Copy link
Copy Markdown
Contributor

In addition to renaming, would the command be split into multiples?

@donaldsharp
Copy link
Copy Markdown
Member Author

I do not understand your question, can you rephrase?

@enkechen-panw
Copy link
Copy Markdown
Contributor

I do not understand your question, can you rephrase?

The question is about whether the existing functionalities of "update-delay" would be replaced by multiple commands for "better control" as you mentioned, as renaming alone would not offer "better control".

@github-actions
Copy link
Copy Markdown

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

@shyam-nexthop
Copy link
Copy Markdown

I'm inclined to agree with @enkechen-panw. While the cmd name is definitely misleading, it's been there forever and well understood. For the other feature, one option is to call it something like "startup advertisement-delay".

@ton31337
Copy link
Copy Markdown
Member

ton31337 commented Apr 8, 2026

I agree with Donald to rename it, because it's more "descriptive" of what it actually does. More context is here: #21430. update-delay defers FIB/best-path, which is not really what we imagine (BGP UPDATE), while #21430 introduces advertisement-delay, which is what we expect (to delay only UPDATEs).

So, in general, two changes are coming: a) rename "update-delay" to "convergence-wait"; b) add a new command "advertisement-delay".

@enkechen-panw
Copy link
Copy Markdown
Contributor

Could this be addressed via documentation? It's always tricky (and difficult) to change a customer-facing configuration.

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