Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PCBB] Add testcases to verify separated DSCP_TO_TC_MAP on leaf router #6393

Merged
merged 7 commits into from
Nov 8, 2022

Conversation

bingwang-ms
Copy link
Collaborator

Description of PR

Summary:
This PR is to add two new test cases testQosSaiSeparatedDscpQueueMapping and testQosSaiSeparatedDscpToPgMapping to verify separated DSCP_TO_TC_MAP for uplink and downlink on T1.

Code change in sonic-buildimage sonic-net/sonic-buildimage#11569

Type of change

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

Back port request

  • 201911
  • 202012

Approach

What is the motivation for this PR?

This PR is to add two new test cases testQosSaiSeparatedDscpQueueMapping and testQosSaiSeparatedDscpToPgMapping to verify separated DSCP_TO_TC_MAP for uplink and downlink on T1.

How did you do it?

  1. Swap syncd docker to syncd-rpc
  2. Generate traffic with various DSCP value, and send the packet to DUT from uplink ports or downlink ports
  3. Check the increment in each PG and Queue with SAI rpc call.

How did you verify/test it?

Verified on a TH2 device

qos/test_qos_sai.py::TestQosSai::testQosSaiSeparatedDscpToPgMapping[str-7260cx3-acs-7-None-downstream] PASSED                                                                                                                                            [ 50%]
qos/test_qos_sai.py::TestQosSai::testQosSaiSeparatedDscpToPgMapping[str-7260cx3-acs-7-None-upstream]  PASSED      

qos/test_qos_sai.py::TestQosSai::testQosSaiSeparatedDscpQueueMapping[str-7260cx3-acs-7-None-downstream] PASSED                                                                                                                                           [ 50%]
qos/test_qos_sai.py::TestQosSai::testQosSaiSeparatedDscpQueueMapping[str-7260cx3-acs-7-None-upstream] PASSED                                                                                                                                             [100%]

Any platform specific information?

No.

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

T1 specific test cases.

Documentation

@lgtm-com
Copy link

lgtm-com bot commented Sep 22, 2022

This pull request introduces 3 alerts when merging 3c33c95 into 0558e61 - view on LGTM.com

new alerts:

  • 3 for Except block handles 'BaseException'

@bingwang-ms bingwang-ms requested a review from stephenxs November 2, 2022 07:45
@bingwang-ms
Copy link
Collaborator Author

@stephenxs Can you please help review this PR?

@azure-pipelines
Copy link

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

Fixing tests/qos/qos_sai_base.py
Fixing tests/common/fixtures/duthost_utils.py
Fixing tests/qos/test_qos_sai.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/qos/qos_sai_base.py:7:1: F401 'tests.common.fixtures.ptfhost_utils.ptf_portmap_file' imported but unused
tests/qos/qos_sai_base.py:10:1: F401 'tests.common.dualtor.dual_tor_utils.upper_tor_host' imported but unused
tests/qos/qos_sai_base.py:10:1: F401 'tests.common.dualtor.dual_tor_utils.lower_tor_host' 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>

@lgtm-com
Copy link

lgtm-com bot commented Nov 2, 2022

This pull request introduces 3 alerts when merging 68880b8 into b3623be - view on LGTM.com

new alerts:

  • 3 for Except block handles 'BaseException'

Copy link
Contributor

@stephenxs stephenxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We plan to have different DSCP_TO_TC mapping on downlink/uplink ports in t0 as well. so hardcoding AZURE_DOWNLINK is probably not good.
The rest LGTM.



def separated_dscp_to_tc_map_on_uplink(duthost):
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can make it more generic by adding an argument for the expected map name?
Eg., in dual ToR t0 scenario, maybe AZURE_DOWNLINK will be introduced for downlink ports (sonic-net/sonic-buildimage#12605).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Now the code counts the dscp_to_tc_map for each port.

tests/common/fixtures/duthost_utils.py Outdated Show resolved Hide resolved
@azure-pipelines
Copy link

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

Fixing tests/qos/qos_sai_base.py
Fixing tests/qos/test_qos_sai.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/qos/qos_sai_base.py:7:1: F401 'tests.common.fixtures.ptfhost_utils.ptf_portmap_file' imported but unused
tests/qos/qos_sai_base.py:10:1: F401 'tests.common.dualtor.dual_tor_utils.upper_tor_host' imported but unused
tests/qos/qos_sai_base.py:10:1: F401 'tests.common.dualtor.dual_tor_utils.lower_tor_host' imported but unused
tests/qos/qos_sai_base.py:10:1: F401 'tests.common.dualtor.dual_tor_utils.dualtor_ports' 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>

@lgtm-com
Copy link

lgtm-com bot commented Nov 7, 2022

This pull request introduces 5 alerts when merging c5fa8af into a1c1ddb - view on LGTM.com

new alerts:

  • 3 for Except block handles 'BaseException'
  • 2 for Unused import

Copy link
Contributor

@stephenxs stephenxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wangxin
Copy link
Collaborator

wangxin commented Nov 11, 2022

@bingwang-ms There are conflicts cherry-picking this PR to 202012 branch. Can you help create a separate PR to the 202012 branch?

wangxin pushed a commit that referenced this pull request Nov 11, 2022
…ter (#6393)

* Add testcases to verify separated DSCP_TO_TC_MAP on T1
@bingwang-ms
Copy link
Collaborator Author

Open another PR #6817 to backport the change into 202012 branch.

wangxin pushed a commit that referenced this pull request Nov 14, 2022
What is the motivation for this PR?
This PR is to backport PR #6393 into 202012 branch.

This PR is to add two new test cases testQosSaiSeparatedDscpQueueMapping and testQosSaiSeparatedDscpToPgMapping to verify separated DSCP_TO_TC_MAP for uplink and downlink on T1.
Code change in sonic-buildimage sonic-net/sonic-buildimage#11569

How did you do it?
Swap syncd docker to syncd-rpc
Generate traffic with various DSCP value, and send the packet to DUT from uplink ports or downlink ports
Check the increment in each PG and Queue with SAI rpc call.

How did you verify/test it?
Verified on a TH2 device
```
collected 2 items                                                                                                                                                                                     

qos/test_qos_sai.py::TestQosSai::testQosSaiSeparatedDscpQueueMapping[str-7260cx3-acs-7-None-downstream] PASSED                                                                                  [ 50%]
qos/test_qos_sai.py::TestQosSai::testQosSaiSeparatedDscpQueueMapping[str-7260cx3-acs-7-None-upstream]  PASSED                                                                                    [100%]

collected 2 items                                                                                                                                                                                     

qos/test_qos_sai.py::TestQosSai::testQosSaiSeparatedDscpToPgMapping[str-7260cx3-acs-7-None-downstream] PASSED                                                                                   [ 50%]
qos/test_qos_sai.py::TestQosSai::testQosSaiSeparatedDscpToPgMapping[str-7260cx3-acs-7-None-upstream] PASSED                                                                                     [100%]
```

Any platform specific information?
No.

Supported testbed topology if it's a new test case?
T1 specific test cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants