Add platform-level fallback for buffer and QoS templates to support Generic HWSKU#4538
Open
yifei-micas wants to merge 1 commit into
Open
Add platform-level fallback for buffer and QoS templates to support Generic HWSKU#4538yifei-micas wants to merge 1 commit into
yifei-micas wants to merge 1 commit into
Conversation
…eneric HWSKU Why I did it As part of Generic HWSKU initiative (HLD sonic-net#2309), buffer and QoS templates should be shareable at platform level to reduce duplication. Previously they were required per HWSKU. This change adds fallback from HWSKU → platform → global (for qos) during . Fixes #25747 How I did it - Obtain both platform_path and hwsku_path in config/main.py reload() - Add fallback logic for buffers_dynamic.json.j2, buffers.json.j2, qos.json.j2 - For qos.json.j2, add global fallback /usr/share/sonic/templates/qos_config.j2 How to verify it - Remove template files from HWSKU dir, run , verify fallback works - Ensure per-HWSKU overrides still work Signed-off-by: Yifei Li <yifei@micasnetworks.com>
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.
Fixes #25747
What I did
Add platform-level fallback for buffer and QoS template files during
config qos reloadto support the Generic HWSKU initiative (HLD #2309).Previously these files (
buffers_dynamic.json.j2,buffers.json.j2,qos.json.j2) were required to exist in each HWSKU directory, causing duplication.Now they are looked up in the following order:
qos.json.j2only) a global template:/usr/share/sonic/templates/qos_config.j2How I did it
config/main.py, inside thereloadfunction (which implementsconfig qos reload):_, hwsku_path = device_info.get_paths_to_platform_and_hwsku_dirs()toplatform_path, hwsku_pathso both directories are available.hwsku_path/.../buffers_dynamic.json.j2; if missing, tryplatform_path/.../buffers_dynamic.json.j2.buffers.json.j2): same fallback logic.qos.json.j2): check HWSKU, then platform, then the hardcoded global template path.os.path.isfilechecks before each fallback attempt.How to verify it
buffers_dynamic.json.j2,buffers.json.j2, orqos.json.j2from a HWSKU directory.config qos reload(e.g.,sudo config qos reload).qos.json.j2when platform file also missing).Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)