Skip to content

Fix VLAN member tagging_mode updates for existing members - #4771

Draft
johanna-nexthop wants to merge 4 commits into
sonic-net:masterfrom
nexthop-ai:fix-vlan-member-tagging-mode-updates
Draft

Fix VLAN member tagging_mode updates for existing members#4771
johanna-nexthop wants to merge 4 commits into
sonic-net:masterfrom
nexthop-ai:fix-vlan-member-tagging-mode-updates

Conversation

@johanna-nexthop

@johanna-nexthop johanna-nexthop commented Jul 20, 2026

Copy link
Copy Markdown

What I did

This change fixes VLAN member tagging_mode updates for ports that are already members of a VLAN.

Previously, duplicate VLAN member entries were treated as no-ops in both vlanmgrd and PortsOrch, which prevented valid tagging_mode updates from being applied to existing members. This PR changes that behavior so an existing VLAN member is only skipped when the requested tagging_mode already matches the applied state.

The update includes:

  • vlanmgrd now stores and checks tagging_mode in STATE_DB, so it can distinguish a true duplicate from a legitimate mode change, including after restart.
  • PortsOrch now handles existing VLAN members by applying a tagging_mode update instead of always treating them as duplicates.
  • A helper was added to convert string tagging modes to SAI enums and reuse that logic consistently.
  • Because the vendor SAI path does not support in-place updates of SAI_VLAN_MEMBER_ATTR_VLAN_TAGGING_MODE, the implementation falls back to remove-and-recreate of the VLAN member object while reusing the bridge port.
  • Tests were added and updated across DVS and mock/unit coverage, including new vlanmgrd unit test wiring in Makefile.am.

Why I did it

Updating the tagging_mode of an existing VLAN member should be handled as a real configuration change, not ignored as a duplicate.

Without this fix:

  • valid tagging_mode updates can be dropped because the existing member is treated as already programmed
  • restart and replay behavior can lose track of the applied mode
  • host-side VLAN programming can fail during repeated default VLAN cleanup when replacing an existing member
    This change ensures VLAN member mode updates are applied correctly, tracked persistently, and handled safely during replay and replacement.

How I verified it

  • Added and updated DVS test helpers to support VLAN member tagging_mode updates.
  • Updated verification logic to re-resolve the ASIC VLAN member object during polling, since the object is replaced when the tagging mode changes.
  • Added vlanmgrd mock/unit test coverage and wired it into tests/mock_tests/Makefile.am.
  • Included coverage in both mock/unit tests and VLAN DVS tests.

Details if related

@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).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@johanna-nexthop johanna-nexthop changed the title Fix vlan member tagging mode updates Fix VLAN member tagging_mode updates for existing members Jul 20, 2026
@johanna-nexthop
johanna-nexthop force-pushed the fix-vlan-member-tagging-mode-updates branch from a5cc8b8 to 824cce6 Compare July 20, 2026 17:46
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Signed-off-by: Johanna Jegan <johanna@nexthop.ai>
@johanna-nexthop
johanna-nexthop force-pushed the fix-vlan-member-tagging-mode-updates branch from 824cce6 to 582a155 Compare July 20, 2026 21:57
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Signed-off-by: Johanna Jegan <johanna@nexthop.ai>
@johanna-nexthop
johanna-nexthop force-pushed the fix-vlan-member-tagging-mode-updates branch from 0ac64dc to 1d4fe62 Compare July 20, 2026 23:25
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks!

---Powered by SONiC BuildBot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants