Is it platform specific
generic
Importance or Severity
Medium
Description of the bug
run_traffic_and_collect_stats() and verify_egress_queue_frame_count() in tests/common/snappi_tests/traffic_generation.py assume dut_port_config is always a dict with "Tx" and "Rx" keys. However, when base_flow_config_list is populated via multi_base_traffic_config() (used by pfcwd_actions_helper.py), dut_port_config is a list [tx_dict, rx_dict].
This causes a TypeError when accessing dut_port_config["Rx"] on a list object.
Two functions are affected:
run_traffic_and_collect_stats() — accesses base_flow_config_list[0]["dut_port_config"]["Rx"][0].values()
verify_egress_queue_frame_count() — accesses dut_port_config["Rx"][0].items()
Note: generate_test_flows() already handles both formats correctly using isinstance(dut_port_config, dict) checks, but these two functions were not updated with the same pattern.
Steps to Reproduce
Run any test_pfcwd_actions.py test that uses multi_base_traffic_config via the pfcwd_actions_helper:
All 6 tests in test_pfcwd_actions.py fail with the same error.
Actual Behavior and Expected Behavior
Actual Behavior and Expected Behavior:
Actual:
TypeError: list indices must be integers or slices, not str
at traffic_generation.py in run_traffic_and_collect_stats():
rx_port_config_values = snappi_extra_params.base_flow_config_list[0]["dut_port_config"]["Rx"][0].values()
Expected:
The function should handle both dut_port_config formats:
Dict-style: {"Tx": [{port: prios}], "Rx": [{port: prios}]} (from base_traffic_config())
List-style: [{tx_port: prios}, {rx_port: prios}] (from multi_base_traffic_config())
Fix: Apply the same isinstance pattern already used in generate_test_flows():
rx_port_dicts = dut_port_config["Rx"] if isinstance(dut_port_config, dict) else [dut_port_config[1]]
This needs to be applied in two places:
- run_traffic_and_collect_stats() — where base_flow_config_list[0]["dut_port_config"] is accessed
- verify_egress_queue_frame_count() — where dut_port_config["Rx"][0].items() is called
Relevant log output
FAILED tests/snappi_tests/pfcwd/test_pfcwd_actions.py::test_pfcwd_drop_90_10 - TypeError: list indices must be integers or slices, not str
FAILED tests/snappi_tests/pfcwd/test_pfcwd_actions.py::test_pfcwd_drop_uni - TypeError: list indices must be integers or slices, not str
FAILED tests/snappi_tests/pfcwd/test_pfcwd_actions.py::test_pfcwd_fwd_90_10 - TypeError: list indices must be integers or slices, not str
FAILED tests/snappi_tests/pfcwd/test_pfcwd_actions.py::test_pfcwd_fwd_uni - TypeError: list indices must be integers or slices, not str
FAILED tests/snappi_tests/pfcwd/test_pfcwd_actions.py::test_pfcwd_disable_90_10 - TypeError: list indices must be integers or slices, not str
FAILED tests/snappi_tests/pfcwd/test_pfcwd_actions.py::test_pfcwd_disable_uni - TypeError: list indices must be integers or slices, not str
Output of show version
N/A — this is a test framework bug, not platform-specific.
Attach files (if any)
NA
Is it platform specific
generic
Importance or Severity
Medium
Description of the bug
run_traffic_and_collect_stats() and verify_egress_queue_frame_count() in tests/common/snappi_tests/traffic_generation.py assume dut_port_config is always a dict with "Tx" and "Rx" keys. However, when base_flow_config_list is populated via multi_base_traffic_config() (used by pfcwd_actions_helper.py), dut_port_config is a list [tx_dict, rx_dict].
This causes a TypeError when accessing dut_port_config["Rx"] on a list object.
Two functions are affected:
run_traffic_and_collect_stats() — accesses base_flow_config_list[0]["dut_port_config"]["Rx"][0].values()
verify_egress_queue_frame_count() — accesses dut_port_config["Rx"][0].items()
Note: generate_test_flows() already handles both formats correctly using isinstance(dut_port_config, dict) checks, but these two functions were not updated with the same pattern.
Steps to Reproduce
Run any test_pfcwd_actions.py test that uses multi_base_traffic_config via the pfcwd_actions_helper:
All 6 tests in test_pfcwd_actions.py fail with the same error.
Actual Behavior and Expected Behavior
Actual Behavior and Expected Behavior:
Actual:
TypeError: list indices must be integers or slices, not strat traffic_generation.py in run_traffic_and_collect_stats():
rx_port_config_values = snappi_extra_params.base_flow_config_list[0]["dut_port_config"]["Rx"][0].values()Expected:
The function should handle both dut_port_config formats:
Dict-style: {"Tx": [{port: prios}], "Rx": [{port: prios}]} (from base_traffic_config())
List-style: [{tx_port: prios}, {rx_port: prios}] (from multi_base_traffic_config())
Fix: Apply the same isinstance pattern already used in generate_test_flows():
rx_port_dicts = dut_port_config["Rx"] if isinstance(dut_port_config, dict) else [dut_port_config[1]]This needs to be applied in two places:
Relevant log output
Output of
show versionN/A — this is a test framework bug, not platform-specific.Attach files (if any)
NA