Skip to content

[warm-reboot] Match virtual routers by VLAN interfaces during APPLY_VIEW - #2007

Open
YairRaviv wants to merge 1 commit into
sonic-net:masterfrom
YairRaviv:yraviv-fix-vrf-restoration-during-warm-reboot
Open

[warm-reboot] Match virtual routers by VLAN interfaces during APPLY_VIEW#2007
YairRaviv wants to merge 1 commit into
sonic-net:masterfrom
YairRaviv:yraviv-fix-vrf-restoration-during-warm-reboot

Conversation

@YairRaviv

@YairRaviv YairRaviv commented Jul 29, 2026

Copy link
Copy Markdown

Description of PR

Summary:
During warm-reboot APPLY_VIEW, multiple virtual routers may have identical SAI attributes and dependency counts. The existing matching logic can therefore select a virtual-router candidate randomly.

An incorrect match makes unchanged VLAN RIFs appear different and generates unnecessary create/remove operations. Duplicate RIF creation may fail with SAI_STATUS_ITEM_ALREADY_EXISTS, causing syncd to enter shutdown-wait mode and orchagent to exit.

This PR makes virtual-router matching deterministic by using the VLAN IDs of their attached VLAN router interfaces.

Fixes # (Bug: [warm-reboot] APPLY_VIEW may randomly mismatch identical virtual routers and recreate existing VLAN RIFs)

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation update
  • Test improvement

Approach

What is the motivation for this PR?

Prevent random virtual-router matching during warm-reboot reconciliation and avoid unnecessary VLAN RIF recreation.

Work item tracking
  • Microsoft ADO (number only):

How did you do it?

Added virtual-router-specific matching to BestCandidateFinder.

For each virtual router, syncd collects the VLAN IDs of its attached VLAN-type router interfaces. A temporary virtual router is matched with the current virtual router that has the same VLAN ID set.

The match is used only when it is unique. Otherwise, syncd falls back to the existing matching logic.

How did you verify/test it?

Unit test:
Added a unit test with two current and two temporary virtual routers that have:

  • Identical virtual-router attributes.
  • Different object IDs and reversed ordering.
  • Different VLAN interfaces associated with each virtual router.
    The test verifies that the virtual routers are matched using their VLAN interfaces rather than random selection.

Manual test:

  1. Create two VRFs.
  2. Create two VLAN interfaces for each VRF and add the required VLAN members.
  3. Bind each VLAN interface to its corresponding VRF.
  4. Save the configuration.
  5. Run multiple warm reboots and make sure restoration works as expected

Any platform specific information?

Documentation

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Comment thread unittest/syncd/TestBestCandidateFinder.cpp Dismissed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix The PR is a bug fix PR Request for 202605 Branch Tested for 202605 branch Tested for 202605 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: [warm-reboot] APPLY_VIEW may randomly mismatch identical virtual routers and recreate existing VLAN RIFs

4 participants