sonic-mgmt
sonic-mgmt copied to clipboard
[Snappi] Infra changes to make snappi multidut work for T0/T1 testbed
Description of PR
Summary: This change is to add initial infra changes for current tests/snappi_tests/multidut test cases to be able to run on T0/T1 testbed.
Main changes are the following:
get_snappi_ports_single_dut: generate port lists for T0/T1 testbed without the need to add port definition in variables.py.get_snappi_ports: unified function to return snappi port lists for both T0/T1 and T2 testbed.- Add vlan and port-channel support into
snappi_dut_base_config: make it consistent for T0/T1 testbed. - sample change in two test case
test_multidut_global_pause_with_snappi.pyandtest_multidut_pfc_pause_lossless_with_snappi.py
After this change, following function can work for both T0/T1 and T2, and test case can adopt the same method to support T0/T1.
get_snappi_portscleanup_configsnappi_dut_base_config- existing helper files are unchanged.
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?
support T0/T1 testbed for T2.
How did you do it?
use get_snappi_ports for both T0/T1 testbed and T2 testbed. For T0/T1 testbed, return all the available ports, for T2 testbed, return the ports defined in MULTIDUT_PORT_INFO.
How did you verify/test it?
Tested in local T0/T1 testbed.
snappi_tests/multidut/pfc/test_multidut_global_pause_with_snappi.py::test_global_pause[multidut_port_info0] PASSED [100%]
snappi_tests/multidut/pfc/test_multidut_pfc_pause_lossless_with_snappi.py::test_pfc_pause_single_lossless_prio[xxx|3-multidut_port_info0] PASSED [ 50%]
snappi_tests/multidut/pfc/test_multidut_pfc_pause_lossless_with_snappi.py::test_pfc_pause_single_lossless_prio[xxx|4-multidut_port_info0] PASSED [100%]
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation
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/snappi_fixtures.py:1039:1: E302 expected 2 blank lines, found 1
tests/common/snappi_tests/snappi_fixtures.py:1041:22: E128 continuation line under-indented for visual indent
tests/common/snappi_tests/snappi_fixtures.py:1042:22: F811 redefinition of unused 'fanout_graph_facts' from line 12
tests/common/snappi_tests/snappi_fixtures.py:1042:22: E128 continuation line under-indented for visual indent
tests/common/snappi_tests/snappi_fixtures.py:1043:22: E128 continuation line under-indented for visual indent
tests/common/snappi_tests/snappi_fixtures.py:1044:22: E128 continuation line under-indented for visual indent
tests/common/snappi_tests/snappi_fixtures.py:1045:22: E128 continuation line under-indented for visual indent
tests/common/snappi_tests/snappi_fixtures.py:1046:22: E128 continuation line under-indented for visual indent
tests/common/snappi_tests/snappi_fixtures.py:1047:22: E124 closing bracket does not match visual indentation
tests/common/snappi_tests/snappi_fixtures.py:1100:1: E302 expected 2 blank lines, found 1
tests/common/snappi_tests/snappi_fixtures.py:1102:22: E128 continuation line under-indented for visual indent
...
[truncated extra lines, please run pre-commit locally to view full check results]
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>
@selldinesh @amitpawar12 @developfast can you help to review this change? Thanks. @yejianquan @abdosi @vmittal-msft for viz.
@sdszhang - Existing helper files might also need change to remove/modify to enable/disable credit-watchdog.
@sdszhang - Existing helper files might also need change to remove/modify to enable/disable credit-watchdog. @amitpawar12 can you open a github issue to track this. Thanks.
Discussed in the community meeting, no further comments on this one. Okay to merge.
Cherry-pick PR to 202405: https://github.com/sonic-net/sonic-mgmt/pull/14574