sonic-mgmt icon indicating copy to clipboard operation
sonic-mgmt copied to clipboard

[Snappi] Infra changes to make snappi multidut work for T0/T1 testbed

Open sdszhang opened this issue 1 year ago • 3 comments

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:

  1. get_snappi_ports_single_dut: generate port lists for T0/T1 testbed without the need to add port definition in variables.py.
  2. get_snappi_ports: unified function to return snappi port lists for both T0/T1 and T2 testbed.
  3. Add vlan and port-channel support into snappi_dut_base_config: make it consistent for T0/T1 testbed.
  4. sample change in two test case test_multidut_global_pause_with_snappi.py and test_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.

  1. get_snappi_ports
  2. cleanup_config
  3. snappi_dut_base_config
  4. 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

sdszhang avatar Sep 02 '24 02:09 sdszhang

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:

  1. 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.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

mssonicbld avatar Sep 02 '24 02:09 mssonicbld

@selldinesh @amitpawar12 @developfast can you help to review this change? Thanks. @yejianquan @abdosi @vmittal-msft for viz.

sdszhang avatar Sep 02 '24 03:09 sdszhang

@sdszhang - Existing helper files might also need change to remove/modify to enable/disable credit-watchdog.

amitpawar12 avatar Sep 03 '24 15:09 amitpawar12

@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.

sdszhang avatar Sep 11 '24 23:09 sdszhang

Discussed in the community meeting, no further comments on this one. Okay to merge.

sdszhang avatar Sep 13 '24 02:09 sdszhang

Cherry-pick PR to 202405: https://github.com/sonic-net/sonic-mgmt/pull/14574

mssonicbld avatar Sep 13 '24 06:09 mssonicbld