Skip to content

[Snappi] Validate PFC frames should not be counted as RX_OK, TX_OK, RX_DRP, TX_DRP#9775

Merged
developfast merged 19 commits intosonic-net:masterfrom
developfast:tx_rx_check_test
Oct 5, 2023
Merged

[Snappi] Validate PFC frames should not be counted as RX_OK, TX_OK, RX_DRP, TX_DRP#9775
developfast merged 19 commits intosonic-net:masterfrom
developfast:tx_rx_check_test

Conversation

@developfast
Copy link
Copy Markdown
Contributor

Description of PR

Summary: While receiving or sending out PFC frames, the PFC counter should be the only counter increasing on the device. The other counters are not expected to increase. The regular TX and RX counters are also polled to ensure they do not increment by the PFC count.
Fixes (issue) #6638

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?

PFC validation and behavior on the DUT

How did you do it?

  1. Send PFC pause frames from TGEN to DUT, check the RX_OK, RX_DRP and PFC rx counter. Except PFC rx counter, other counters should not increase.
  2. From DUT, send out PFC pause frames to neighbor, check the TX_OK, TX_DRP and PFC tx counter. Except PFC tx counter, other counter should not increase.
  3. Traffic counters will increment minimally for the small amount of regular test traffic sent - this is also verified by polling the DUT.

How did you verify/test it?

Tested on lab device

Any platform specific information?

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

Documentation

@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_tests/traffic_generation.py
Fixing tests/snappi_tests/pfc/files/helper.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_tests/traffic_generation.py:541:56: E261 at least two spaces before inline comment
tests/common/snappi_tests/traffic_generation.py:552:56: E261 at least two spaces before inline comment
tests/snappi_tests/pfc/test_pfc_pause_lossless_with_snappi.py:80:1: E302 expected 2 blank lines, found 1
tests/snappi_tests/pfc/test_pfc_pause_lossless_with_snappi.py:80:34: F811 redefinition of unused 'snappi_api' from line 8
...
[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 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_tests/traffic_generation.py
Fixing tests/snappi_tests/pfc/files/helper.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_tests/traffic_generation.py:540:56: E261 at least two spaces before inline comment
tests/common/snappi_tests/traffic_generation.py:551:56: E261 at least two spaces before inline comment
tests/snappi_tests/pfc/test_pfc_pause_lossless_with_snappi.py:80:1: E302 expected 2 blank lines, found 1
tests/snappi_tests/pfc/test_pfc_pause_lossless_with_snappi.py:80:34: F811 redefinition of unused 'snappi_api' from line 8
...
[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>

@developfast developfast marked this pull request as ready for review August 30, 2023 22:03
@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_tests/traffic_generation.py
Fixing tests/snappi_tests/pfc/files/helper.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_tests/traffic_generation.py:540:56: E261 at least two spaces before inline comment
tests/common/snappi_tests/traffic_generation.py:551:56: E261 at least two spaces before inline comment
tests/snappi_tests/pfc/test_pfc_pause_lossless_with_snappi.py:91:121: E501 line too long (123 > 120 characters)
tests/snappi_tests/pfc/test_pfc_pause_lossless_with_snappi.py:128:5: E303 too many blank lines (2)
...
[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 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_tests/traffic_generation.py
Fixing tests/snappi_tests/pfc/files/helper.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/snappi_tests/pfc/test_pfc_pause_lossless_with_snappi.py:91:121: E501 line too long (123 > 120 characters)
tests/snappi_tests/pfc/test_pfc_pause_lossless_with_snappi.py:128:5: E303 too many blank lines (2)

flake8...............................................(no files to check)Skipped
...
[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 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_tests/traffic_generation.py
Fixing tests/snappi_tests/pfc/files/helper.py

fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed
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:

  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 requested a review from neethajohn August 31, 2023 20:11
@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/snappi_tests/pfc/files/helper.py

fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed
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:

  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>

logger = logging.getLogger(__name__)

SNAPPI_POLL_DELAY_SEC = 2
CONTINUOUS_MODE = -5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is continuous mode? What is the meaning of 5?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's an arbitrary number that isn't used anywhere else - continuous mode means the traffic flows constantly without any fixed duration or fixed packets at some percentage rate

"""
Verify correct frame count for tx frames on the DUT
(OK and DROPS) when the traffic is expected to be paused on the DUT.
DUT is polled after it stops receiving PFC pause frames from TGEN.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When you poll DUT, has DUT drained all the packets in the buffer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes

.format(prios[prio]))
else:
# PFC pause frames should not be transmitted when test traffic is not paused
pytest_assert(pfc_pause_tx_frames <= PFC_FRAME_COUNT_TOL,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

have you ever seen pfc_pause_tx_frames >0 in this case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No - this is just there as a back stopper. If you want me to lower the threshold to 2 or 3, that is also possible. It is currently set to 5.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reset to 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reset to 0

Can you please remove PFC_FRAME_COUNT_TOL?

@developfast
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

.format(prios[prio]))
else:
# PFC pause frames should not be transmitted when test traffic is not paused
pytest_assert(pfc_pause_tx_frames <= PFC_FRAME_COUNT_TOL,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reset to 0

Can you please remove PFC_FRAME_COUNT_TOL?

@developfast
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

neethajohn pushed a commit that referenced this pull request Oct 2, 2023
…nter polling (#9847)

Summary: Currently, all verification for PFC pause frames are done by polling the ixia device at the end of the test. We need to add functionality to poll the appropriate counters on the DUT while the DUT continues to receive PFC pause frames from the neighboring device.

This PR is dependent on #9775.

Fixes (issue) #9843
@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.................................................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:662:5: F841 local variable 'test_tx_frames' is assigned to but never used
tests/common/snappi_tests/traffic_generation.py:667:16: F821 undefined name 'test_traffic_pause'
tests/common/snappi_tests/traffic_generation.py:678:16: F821 undefined name 'test_traffic_pause'
tests/common/snappi_tests/traffic_generation.py:687:1: F811 redefinition of unused 'verify_tx_frame_count_dut' from line 616
tests/common/snappi_tests/traffic_generation.py:715:1: F811 redefinition of unused 'verify_rx_frame_count_dut' from line 644

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:

  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
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

@developfast PR conflicts with 202012 branch

@mssonicbld
Copy link
Copy Markdown
Collaborator

@developfast PR conflicts with 202305 branch

@mssonicbld
Copy link
Copy Markdown
Collaborator

@developfast PR conflicts with 202205 branch

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Oct 24, 2023
…nter polling (sonic-net#9847)

Summary: Currently, all verification for PFC pause frames are done by polling the ixia device at the end of the test. We need to add functionality to poll the appropriate counters on the DUT while the DUT continues to receive PFC pause frames from the neighboring device.

This PR is dependent on sonic-net#9775.

Fixes (issue) sonic-net#9843
mssonicbld pushed a commit that referenced this pull request Oct 26, 2023
…nter polling (#9847)

Summary: Currently, all verification for PFC pause frames are done by polling the ixia device at the end of the test. We need to add functionality to poll the appropriate counters on the DUT while the DUT continues to receive PFC pause frames from the neighboring device.

This PR is dependent on #9775.

Fixes (issue) #9843
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