Skip to content

[everflow][202511] Skip tests when ASIC does not support bidirectional port mirroring#22709

Open
yxieca wants to merge 1 commit intosonic-net:202511from
yxieca:fix/everflow-mirror-direction-skip-202511
Open

[everflow][202511] Skip tests when ASIC does not support bidirectional port mirroring#22709
yxieca wants to merge 1 commit intosonic-net:202511from
yxieca:fix/everflow-mirror-direction-skip-202511

Conversation

@yxieca
Copy link
Collaborator

@yxieca yxieca commented Mar 3, 2026

What is the motivation for this PR?

Cherry-pick of #22663 for the 202511 branch.

The everflow tests fail on ASICs that do not support bidirectional port mirroring. When config mirror_session add is called without an explicit --direction flag, SONiC defaults to both, which requires both PORT_INGRESS_MIRROR_CAPABLE and PORT_EGRESS_MIRROR_CAPABLE to be true in STATE_DB SWITCH_CAPABILITY|switch. On ASICs that don't support both directions, the command fails with:

Error: Port mirror direction 'both' is not supported by the ASIC

This causes test failures unrelated to the test logic itself.

Fixes #22661

How did you do it?

Added a capability check in the setup_mirror_session and policer_mirror_session fixtures in everflow_test_utilities.py. Before attempting to create a mirror session via CLI, the fixtures now query switch_capabilities_facts for PORT_INGRESS_MIRROR_CAPABLE and PORT_EGRESS_MIRROR_CAPABLE. If either capability is not true, the test is skipped with a descriptive message.

The check is only applied for CONFIG_MODE_CLI since the direct DB write path (used for IPv6 ERSPAN) bypasses the CLI validation.

How did you verify/test it?

  • Code review of SONiC's config/main.py confirms is_port_mirror_capability_supported() checks these exact fields when direction is None (defaults to 'both')
  • The skip message includes actual capability values for debugging
  • Existing tests on platforms that support bidirectional mirroring are unaffected (capabilities default to true when not present in STATE_DB)
  • Master version merged as [everflow] Skip tests when ASIC does not support bidirectional port mirroring #22663

Signed-off-by: Ying Xie ying.xie@microsoft.com

…irroring

Cherry-pick of PR sonic-net#22663 for 202511 branch.

Added capability check in setup_mirror_session and policer_mirror_session
fixtures. Before creating a mirror session via CLI, the fixtures now query
switch_capabilities_facts for PORT_INGRESS_MIRROR_CAPABLE and
PORT_EGRESS_MIRROR_CAPABLE. If the required capability is not supported,
the test is skipped with a descriptive message.

Fixes sonic-net#22661

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
@yxieca
Copy link
Collaborator Author

yxieca commented Mar 3, 2026

This PR was created by an AI agent on behalf of Ying Xie. It is a cherry-pick of #22663 (merged to master) reworked for the 202511 branch.

@mssonicbld
Copy link
Collaborator

/azp run

@github-actions github-actions bot requested a review from xwjiang-ms March 3, 2026 19:24
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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