Skip to content

RDMA Multi-Dut/Multi-Asic Infrastructure changes#7849

Merged
developfast merged 34 commits intosonic-net:masterfrom
selldinesh:master
Jul 28, 2023
Merged

RDMA Multi-Dut/Multi-Asic Infrastructure changes#7849
developfast merged 34 commits intosonic-net:masterfrom
selldinesh:master

Conversation

@selldinesh
Copy link
Copy Markdown
Contributor

@selldinesh selldinesh commented Mar 24, 2023

Description of PR

Summary:
This PR contains fixtures that has the logic for customizing the port selection from ansible files based on the multi-chassis or non-chassis based port for enhanced RDMA cases based on the users input from the tests/snappi/variables.py file
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?

How did you do it?

How did you verify/test it?

Tested against Nokia Ixre7520

Any platform specific information?

The DUT configuration commands might be specific to a Vendor. If other vendor doesn't support the commands, then they can modify the DUT commands in common_helpers.py file.

Supported testbed topology if it's a new test case?

T2

Documentation

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 24, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@mssonicbld
Copy link
Copy Markdown
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame
author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

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/snappi_fixtures.py:580:31: F811 redefinition of unused 'conn_graph_facts' from line 10
tests/common/snappi/snappi_fixtures.py:581:31: F811 redefinition of unused 'fanout_graph_facts' from line 10
tests/common/snappi/snappi_fixtures.py:602:13: F841 local variable 'snappi_fanout' is assigned to but never used
tests/common/snappi/snappi_fixtures.py:761:34: F811 redefinition of unused 'conn_graph_facts' from line 10
tests/common/snappi/snappi_fixtures.py:842:23: F821 undefined name 'unicode'
tests/common/snappi/snappi_fixtures.py:844:34: F821 undefined name 'unicode'
tests/common/snappi/snappi_fixtures.py:845:25: F821 undefined name 'unicode'
tests/common/snappi/snappi_fixtures.py:849:34: F821 undefined name 'unicode'
tests/snappi/test_multidut_snappi.py:5:1: F401 'tests.common.fixtures.conn_graph_facts.conn_graph_facts' imported but unused
tests/snappi/test_multidut_snappi.py:5:1: F401 'tests.common.fixtures.conn_graph_facts.fanout_graph_facts' imported but unused
tests/snappi/test_multidut_snappi.py:7:1: F401 'tests.common.snappi.snappi_fixtures.snappi_api_serv_ip' imported but unused
...
[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
Copy link
Copy Markdown
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame
author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

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/snappi_fixtures.py:580:31: F811 redefinition of unused 'conn_graph_facts' from line 10
tests/common/snappi/snappi_fixtures.py:581:31: F811 redefinition of unused 'fanout_graph_facts' from line 10
tests/common/snappi/snappi_fixtures.py:602:13: F841 local variable 'snappi_fanout' is assigned to but never used
tests/common/snappi/snappi_fixtures.py:761:34: F811 redefinition of unused 'conn_graph_facts' from line 10
tests/common/snappi/snappi_fixtures.py:842:23: F821 undefined name 'unicode'
tests/common/snappi/snappi_fixtures.py:844:34: F821 undefined name 'unicode'
tests/common/snappi/snappi_fixtures.py:845:25: F821 undefined name 'unicode'
tests/common/snappi/snappi_fixtures.py:849:34: F821 undefined name 'unicode'
tests/snappi/test_multidut_snappi.py:5:1: F401 'tests.common.fixtures.conn_graph_facts.conn_graph_facts' imported but unused
tests/snappi/test_multidut_snappi.py:5:1: F401 'tests.common.fixtures.conn_graph_facts.fanout_graph_facts' imported but unused
tests/snappi/test_multidut_snappi.py:7:1: F401 'tests.common.snappi.snappi_fixtures.snappi_api_serv_ip' imported but unused
...
[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
Copy link
Copy Markdown
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame
author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

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/common_helpers.py:513:1: E302 expected 2 blank lines, found 1

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>

selldinesh and others added 2 commits March 29, 2023 15:48
* Fix "logging not defined" issue of some snappi tests (sonic-net#7855)

What is the motivation for this PR?
The logging module is used by some files under tests.snappi. However, the module is not imported in the files. This caused error like below while collecting the snappi tests:
E NameError: name 'logging' is not defined

How did you do it?
The fix is to import logging in those files.

Signed-off-by: Xin Wang <[email protected]>

* [Python3 migration]Fix oid issue in snmp_pdu_controllers.py sonic-net#7887

What is the motivation for this PR?
In Python2, oid.prettyPrint() prints 1.3.6.1.4.1.9.1.283
In Python3, oid.prettyPrint() prints SNMPv2-SMI::enterprises.9.1.283
This difference breaks port_label_dict in _build_outlet_maps() in snmp_pdu_controllers.py

How did you do it?
Change oid.prettyPrint() to str(oid). This will make code work both in Python2 and Python3.

How did you verify/test it?
PDU testcase can run manually both in Python2 and Python3.

* Fix pdu KeyError for pdu_controller fixture (sonic-net#7876)

What is the motivation for this PR?
PR sonic-net#7782 updated the pdu_manager_factory interface. Only devutils using this function was updated accordingly. Fixtures like pdu_controller using this function also need to be updated.

How did you do it?
This PR updated the pdu_controller and get_pdu_controller fixtures accordingly to pass correct PDU variables to the pdu_manager_factory function.

This change only can fix the issue under python2.
Under python3, the pysnmp package version 4.4.12 is much higher than the 4.2.5 package used in python2. The newer package has compatibility issues. The current snmp_pdu_controllers.py script needs to be updated for python3. That issue is fixed in sonic-net#7887

Signed-off-by: Xin Wang <[email protected]>

* Make test_plan.py compatible between python2 and python3 (sonic-net#7886)

* Make test_plan.py compatible between python2 and python3

Approach
What is the motivation for this PR?
Make test_plan.py compatible between python2 and python3

co-authorized by: [email protected]

* RDMA pfc global pause multi dut test

* Refine testbedv2 template output (sonic-net#7895)

* Refine testbedv2 template output

Approach
What is the motivation for this PR?
Refine testbedv2 template output

Co-authorized by: [email protected]

* fix test_route_perf packet verify issue (sonic-net#7877)

* fix route perf failure caused by missing some port-channel members

* Skip warm-reboot cases for T2. (sonic-net#7784)

---------

Signed-off-by: Xin Wang <[email protected]>
Co-authored-by: Xin Wang <[email protected]>
Co-authored-by: ShiyanWangMS <[email protected]>
Co-authored-by: Ye Jianquan <[email protected]>
Co-authored-by: jcaiMR <[email protected]>
Co-authored-by: rraghav-cisco <[email protected]>
@wangxin
Copy link
Copy Markdown
Collaborator

wangxin commented Apr 16, 2023

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@kamalsahu0001
Copy link
Copy Markdown
Contributor

Test plan for Global pause multidut test case is same as that of singledut. Below is the link for testplan.
https://github.com/sonic-net/sonic-mgmt/blob/master/docs/testplan/pfc/GLOBAL_PAUSE_README.md

@baiwei0427
Copy link
Copy Markdown
Contributor

@selldinesh Can you remove PFC tests from this PR?

@mssonicbld
Copy link
Copy Markdown
Collaborator

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.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/common/snappi/snappi_fixtures.py

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/snappi_fixtures.py:729:31: E711 comparison to None should be 'if cond is None:'

check conditional mark sort..........................(no files to check)Skipped

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>

@developfast developfast self-requested a review July 21, 2023 17:38
@rlhui
Copy link
Copy Markdown

rlhui commented Jul 26, 2023

@developfast , would you be approving this soon? thanks.

@mssonicbld
Copy link
Copy Markdown
Collaborator

@selldinesh PR conflicts with 202305 branch

@mssonicbld
Copy link
Copy Markdown
Collaborator

@selldinesh PR conflicts with 202012 branch

@mssonicbld
Copy link
Copy Markdown
Collaborator

@selldinesh PR conflicts with 202205 branch

@developfast
Copy link
Copy Markdown
Contributor

@selldinesh please fix all necessary conflicts for other branches and create separate PRs for them, when you get a chance.

@wangxin
Copy link
Copy Markdown
Collaborator

wangxin commented Aug 16, 2023

@developfast Do we really need this "feature" change in 202205 and 202012 branches?

@developfast
Copy link
Copy Markdown
Contributor

@wangxin this is needed for 202205. Let me get back to you on 202012.

AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Jan 25, 2024
…frastructure (sonic-net#7849)

* Added Multi Dut Multi asic Support

* PreCommit Check

* Update common_helpers.py

* Rdma multiasic global pause (sonic-net#9)

* Fix "logging not defined" issue of some snappi tests (sonic-net#7855)

What is the motivation for this PR?
The logging module is used by some files under tests.snappi. However, the module is not imported in the files. This caused error like below while collecting the snappi tests:
E NameError: name 'logging' is not defined

How did you do it?
The fix is to import logging in those files.

Signed-off-by: Xin Wang <[email protected]>

* [Python3 migration]Fix oid issue in snmp_pdu_controllers.py sonic-net#7887

What is the motivation for this PR?
In Python2, oid.prettyPrint() prints 1.3.6.1.4.1.9.1.283
In Python3, oid.prettyPrint() prints SNMPv2-SMI::enterprises.9.1.283
This difference breaks port_label_dict in _build_outlet_maps() in snmp_pdu_controllers.py

How did you do it?
Change oid.prettyPrint() to str(oid). This will make code work both in Python2 and Python3.

How did you verify/test it?
PDU testcase can run manually both in Python2 and Python3.

* Fix pdu KeyError for pdu_controller fixture (sonic-net#7876)

What is the motivation for this PR?
PR sonic-net#7782 updated the pdu_manager_factory interface. Only devutils using this function was updated accordingly. Fixtures like pdu_controller using this function also need to be updated.

How did you do it?
This PR updated the pdu_controller and get_pdu_controller fixtures accordingly to pass correct PDU variables to the pdu_manager_factory function.

This change only can fix the issue under python2.
Under python3, the pysnmp package version 4.4.12 is much higher than the 4.2.5 package used in python2. The newer package has compatibility issues. The current snmp_pdu_controllers.py script needs to be updated for python3. That issue is fixed in sonic-net#7887

Signed-off-by: Xin Wang <[email protected]>

* Make test_plan.py compatible between python2 and python3 (sonic-net#7886)

* Make test_plan.py compatible between python2 and python3

Approach
What is the motivation for this PR?
Make test_plan.py compatible between python2 and python3

co-authorized by: [email protected]

* RDMA pfc global pause multi dut test

* Refine testbedv2 template output (sonic-net#7895)

* Refine testbedv2 template output

Approach
What is the motivation for this PR?
Refine testbedv2 template output

Co-authorized by: [email protected]

* fix test_route_perf packet verify issue (sonic-net#7877)

* fix route perf failure caused by missing some port-channel members

* Skip warm-reboot cases for T2. (sonic-net#7784)

---------

Signed-off-by: Xin Wang <[email protected]>
Co-authored-by: Xin Wang <[email protected]>
Co-authored-by: ShiyanWangMS <[email protected]>
Co-authored-by: Ye Jianquan <[email protected]>
Co-authored-by: jcaiMR <[email protected]>
Co-authored-by: rraghav-cisco <[email protected]>

* removing 2nd asic value

* review feedback changes

* removing global pause case from infra changes

* removing qos fixture from this branch

* namespace to asic_value

* resolving comments

Signed-off-by: selldinesh <[email protected]>

* resolving comments

Signed-off-by: selldinesh <[email protected]>

* typo fix

* removing mlnx only

* adding qos fixtures file back

* pre commit fix

* pre commit fix

* changing 'None' to None

* resolving precommit  errors

* resolving comments

* adding a short description about this file

* review comment fixes

* removing quotes

* review changes

* review changes

* review changes

* review changes

---------

Signed-off-by: Xin Wang <[email protected]>
Signed-off-by: selldinesh <[email protected]>
Co-authored-by: vkuma82 <[email protected]>
Co-authored-by: Xin Wang <[email protected]>
Co-authored-by: ShiyanWangMS <[email protected]>
Co-authored-by: Ye Jianquan <[email protected]>
Co-authored-by: jcaiMR <[email protected]>
Co-authored-by: rraghav-cisco <[email protected]>
Co-authored-by: Vinod Kumar <[email protected]>
Co-authored-by: selldinesh <[email protected]>
@amitpawar12
Copy link
Copy Markdown
Contributor

Currently the cleanup_config called at the end of the each testcase will not called/work if the run_xyz_test or any other function in the testcase asserts. We have to manually remove the assigned IP-addresses on the DUT. This is a problem if we are executing series of testcases and there is a testcase failure.

We need to modify the cleanup_config function as a pytest.fixture to be called irrespective of the testcase execution result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.