Skip to content

Commit c1145f4

Browse files
Fix per-commit and missing function.
Signed-off-by: Abhishek <[email protected]>
1 parent 0797820 commit c1145f4

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

tests/common/helpers/ptf_tests_helper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def check_packets_received():
171171
ptf_adapter.dataplane.flush()
172172
return None, None
173173

174+
174175
@pytest.fixture(scope="module")
175176
def downstream_links(rand_selected_dut, tbinfo, nbrhosts):
176177
"""

tests/qos/qos_helpers.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,34 @@ def get_dscp_to_queue_mapping(duthost):
135135
return None
136136

137137

138+
def find_dscp_for_queue(duthost, target_queue):
139+
"""
140+
Find a DSCP value that maps to the target queue
141+
142+
Args:
143+
duthost: DUT host object
144+
target_queue: Target queue number
145+
146+
Returns:
147+
int or None: DSCP value that maps to target queue, or None if not found
148+
"""
149+
# Get DSCP to queue mapping from DUT
150+
dscp_to_queue_map = get_dscp_to_queue_mapping(duthost)
151+
if dscp_to_queue_map is None:
152+
logger.error("Could not get DSCP to queue mapping from DUT")
153+
return None
154+
155+
for dscp, queue in dscp_to_queue_map.items():
156+
if queue == target_queue:
157+
logger.info(f"Found DSCP {dscp} maps to target queue {target_queue}")
158+
return dscp
159+
160+
# If no exact match found, log available mappings and return None
161+
available_mappings = {f"DSCP {dscp}": f"Queue {queue}" for dscp, queue in dscp_to_queue_map.items()}
162+
logger.error(f"No DSCP found that maps to queue {target_queue}. Available mappings: {available_mappings}")
163+
return None
164+
165+
138166
def get_phy_intfs(host_ans):
139167
"""
140168
@Summary: Get the physical interfaces (e.g., EthernetX) of a DUT

0 commit comments

Comments
 (0)