Skip to content

[snappi] Derive TGEN link_training from DUT instead of hardcoding it - #26889

Open
YatishSVC wants to merge 1 commit into
sonic-net:masterfrom
YatishSVC:yatishkoul/snappi_link_training_from_dut
Open

[snappi] Derive TGEN link_training from DUT instead of hardcoding it#26889
YatishSVC wants to merge 1 commit into
sonic-net:masterfrom
YatishSVC:yatishkoul/snappi_link_training_from_dut

Conversation

@YatishSVC

@YatishSVC YatishSVC commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description of PR

snappi_dut_base_config hardcodes the traffic generator's auto_negotiation.link_training = True for single-DUT testbeds (introduced in #14361). On optical 400G single-DUT beds where the DUT runs link_training: off (e.g. Q3D), forcing link training on at the TGEN makes the DUT↔TGEN link fault (mac_local_fault / mac_remote_fault); the link never trains, so ARP never resolves and every snappi test on that bed fails.

This change derives link_training from the DUT's CONFIG_DB PORT table (per peer_port) and applies it to the TGEN, so the TGEN matches the DUT's actual link-training setting.

Summary:

  • Read link_training from the DUT running-config PORT[<peer_port>].
  • Apply the derived value to the TGEN L1 auto_negotiation.link_training.
  • Fall back to the previous behavior (multidut → False, single-DUT → True) when the DUT does not set link_training, so beds that don't configure it are unchanged (backward compatible).

Type of change

  • Bug fix
  • Testbed and Framework (new/improvement)
  • New Test case
  • Test case improvement

Back port request

  • 202405
  • 202411
  • 202505
  • 202511
  • 202512

Approach

What is the motivation for this PR?

Single-DUT snappi testbeds with optical 400G links that run link_training: off (e.g. Q3D) cannot bring up the DUT↔TGEN link, because the TGEN is hardcoded to link_training = True, producing mac_local_fault / mac_remote_fault. The link never trains, ARP never resolves, and every snappi test on the bed fails.

How did you do it?

In snappi_dut_base_config, read link_training from the DUT CONFIG_DB PORT table for the test peer_ports and set the TGEN's auto_negotiation.link_training to that value. The previous hardcoded defaults are kept as a fallback for the case where the DUT does not set link_training (or the read fails), so existing behavior is preserved for those beds.

How did you verify/test it?

Ran snappi_tests/pfcwd/test_pfcwd_basic_with_snappi.py::test_pfcwd_basic_single_lossless_prio on Q3D platform(400G, link_training: off, RS-FEC) single-DUT snappi testbed:

  • Before: mac_local_fault / mac_remote_fault, ARP is not resolved in 60 seconds, all tests fail.
  • After: link trains, ARP resolves, 2 passed.

Any platform specific information?

Affects single-DUT snappi testbeds whose DUT sets link_training (notably optical 400G platforms that require link_training: off). No behavior change for beds that don't set link_training.

snappi_dut_base_config hardcodes auto_negotiation.link_training=True for
single-DUT testbeds (added in sonic-net#14361). On optical 400G single-DUT beds where
the DUT runs link_training=off (e.g. NH-5010), forcing link training on at the
TGEN causes mac_local/remote_fault; the link never trains, ARP never resolves,
and every snappi test fails.

Read link_training from the DUT CONFIG_DB PORT table (per peer_port) and apply
it to the TGEN. Falls back to the previous behavior when the DUT does not set
link_training, so beds that do not configure it are unchanged.

Tested: test_pfcwd_basic_single_lossless_prio -> 2 passed on an NH-5010 400G
single-DUT snappi testbed (previously mac_local/remote_fault, ARP not resolved).
@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).

if lt_val is not None:
lt_from_dut = str(lt_val).lower() in ['on', 'true', 'yes', '1']
break
except Exception:
@mssonicbld mssonicbld added the Request for 202511 branch Request to backport a change to 202511 branch label Aug 7, 2026
@mssonicbld

Copy link
Copy Markdown
Collaborator

This PR has backport request for branch(es): 202511.
Added label(s) for branch(es) 202511.

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

This PR has backport request label(s) for branch(es): 202511, but is missing required test information. Please make sure you tick the tested branch(es) in the Tested branch section and provide test evidence (e.g., 202511: <test result>) in the Test result section as well in your PR description.

---Powered by SONiC BuildBot

@YatishSVC

Copy link
Copy Markdown
Contributor Author

cc: @atul-nexthop

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

Labels

Request for 202511 branch Request to backport a change to 202511 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants