sonic-mgmt
sonic-mgmt copied to clipboard
[Snappi] fix Error in get_pg_dropped_packets for T2 testbed
Description of PR
Summary:
Fix the following error when running test case test_multidut_pfc_pause_lossless_with_snappi.py
def get_pg_dropped_packets(duthost, phys_intf, prio):
"""
Get number of ingress packets dropped on a specific priority
of a physical interface
Args:
host_ans: Ansible host instance of the device
phys_intf (str): Name of physical interface ex. Ethernet4
prio (int): Priority group to check ex. 4
Returns:
total number of dropped packets (int)
"""
oid_cmd = "sonic-db-cli COUNTERS_DB HGET COUNTERS_QUEUE_NAME_MAP " + phys_intf + ":" + str(prio)
oid_out = duthost.command(oid_cmd)
> oid_str = str(oid_out["stdout_lines"][0] or 1)
E IndexError: list index out of range
Type of change
- [ ] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [ ] Test case(new/improvement)
Back port request
- [ ] 202012
- [ ] 202205
- [ ] 202305
- [ ] 202311
- [x] 202405
Approach
What is the motivation for this PR?
Fix test case error
How did you do it?
Add asic_value parameter for get_pg_dropped_packets() and verify_in_flight_buffer_pkts
How did you verify/test it?
Tested on T1 and T2 physical testbed.
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation
@amitpawar12 can you help to review this one? Thanks.
The pre-commit check detected issues in the files touched by this pull request. The pre-commit check is a mandatory check, please fix detected issues.
Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
tests/common/snappi_tests/traffic_generation.py:529:65: E251 unexpected spaces around keyword / parameter equals
tests/common/snappi_tests/traffic_generation.py:529:67: E251 unexpected spaces around keyword / parameter equals
flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped
To run the pre-commit checks locally, you can follow below steps:
- Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt docker container.
- Ensure that the
pre-commitpackage is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
Cherry-pick PR to 202405: https://github.com/sonic-net/sonic-mgmt/pull/14575