[manual cherry-pick][PR:26931] Apply per-link link training via golden config, preserve deploy-time golden config across minigraph reloads - #1423
Open
frank-nexthop wants to merge 1 commit into
Conversation
…golden config across minigraph reloads (#26931) Wire per-link link training (LT) into deploy-mg via golden config, driven by the `LinkTraining` column of `sonic_lab_links.csv` (parsed into `device_conn` by `conn_graph_facts`), and keep it applied across test-time minigraph reloads by re-applying just the `PORT.<intf>.link_training` field after a non-override reload. DAC-cabled testbeds need link training on DUT-fanout links. Minigraph cannot express LT, and CONFIG_DB edits are lost when sonic-mgmt reverts config between tests. Golden config is the delivery path; this extends it from t0-f2-only to any topology, per link from the lab links CSV. LT injection (deploy-mg): - `ansible/library/generate_golden_config_db.py`: new `device_conn` param and a topology-agnostic `apply_link_training_from_device_conn()` post-pass that sets `PORT.<intf>.link_training` for ports whose CSV row says `on`/`off`. Because `--override_config` replaces PORT wholesale, the pass bases PORT on the minigraph-derived table (rendered with an explicit `-p <port_config>`) when the topology generator emitted none. Blank CSV values are left untouched; multi-asic is skipped with a warning. - `ansible/config_sonic_basedon_testbed.yml`: pass `device_conn[inventory_hostname]` into both generator invocations. LT preservation (test time): - `tests/common/config_reload.py`: after a non-override minigraph reload on a DUT, re-apply `link_training` from `golden_config_db.json.origin.backup` (falling back to the golden config path) with `sonic-db-cli hset`, only for ports present in the reloaded PORT table. Override (`-o`) reloads are unchanged. - `tests/common/utilities.py`: `reload_minigraph_with_golden_config` restores the deploy-time golden config from `.origin.backup` after moving the test's temporary one aside. - `tests/common/constants.py`, `tests/conftest.py`: share the golden config path constants. Hand-resolved cherry-pick of sonic-net/sonic-mgmt#26931 onto msft-202512. The three conflicts were with neighbouring master-only additions this lineage does not carry (`enabled_dpu_indices` / `lacp_fast_rate` module params, `generate_c0_golden_config_db`, the `is_pfcwd_hw_recovery_enabled` import); the PR's own hunks are unchanged. (cherry picked from commit 5ab9811baeb593a78dd0acf26356e4133a702e15) Signed-off-by: Frank Jiang <frank@nexthop.ai>
frank-nexthop
requested review from
Sai Kiran (opcoder0) and
Ying Xie (yxieca)
as code owners
September 18, 2026 06:17
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Collaborator
|
/azp run |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
Author
@microsoft-github-policy-service agree |
Author
|
bingwang-ms This is the cherry-pick to 202512. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Manual cherry pick of sonic-net/sonic-mgmt#26931 (master commit 5ab9811b).
Wires per-link link training into deploy-mg via golden config, driven by the
LinkTrainingcolumn ofsonic_lab_links.csv, and keeps it applied across test-time minigraph reloads by re-applying justPORT.<intf>.link_trainingafter a non-override reload.reload_minigraph_with_golden_configalso restores the deploy-time golden config from.origin.backupafter moving the test's temporary one aside.Hand-resolved: the three conflicts (
generate_golden_config_db.pyargument_spec,config_sonic_basedon_testbed.yml,tests/conftest.pyimports) were only with neighbouring master-only additions that 202512 does not carry (enabled_dpu_indices/lacp_fast_ratemodule params,generate_c0_golden_config_db, theis_pfcwd_hw_recovery_enabledimport). The PR's own hunks are unchanged. Only DUTs whose lab links CSV rows carry aLinkTrainingvalue render a different golden config; single-asic only, multi-asic is skipped with a warning.