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

dhcp storm stress test #14768

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

yyynini
Copy link
Contributor

@yyynini yyynini commented Sep 26, 2024

Description of PR

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

The purpose of this test is to conduct a DHCP stress test with CoPP policy, ensuring that the DHCP relay service can withstand the maximum load applied to the CPU

How did you do it?

In the test, we will generate packets at a rate of 10,000 packets per second for 120 seconds to ensure the DHCP relay service can handle the maximum load without failure.

How did you verify/test it?

By monitoring the status of the DHCP container, resource utilization, and verify that the DHCP processes are running.

Any platform specific information?

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

Documentation

@mssonicbld
Copy link
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 ansible/roles/test/files/ptftests/py3/dhcp_relay_stress_test.py
Fixing tests/dhcp_relay/test_dhcp_relay_stress.py

fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing ansible/roles/test/files/ptftests/py3/dhcp_relay_stress_test.py
Fixing tests/dhcp_relay/test_dhcp_relay_stress.py

check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
...
[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
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 ansible/roles/test/files/ptftests/py3/dhcp_relay_stress_test.py
Fixing tests/dhcp_relay/test_dhcp_relay_stress.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>

assert False, "DHCP container is NOT running."

# Check CPU usage of the DHCP process
dhcp_cpu_usage = duthost.shell('show processes cpu --verbose | grep dhcp | awk \'{print $9}\'')["stdout"]
Copy link
Contributor

Choose a reason for hiding this comment

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

suggest to grep dhc, because process name of v4 relay is dhcrelay..

log_file="/tmp/dhcp_relay_stress_test.DHCPStressTest.log",
qlen=100000, is_python3=True, async_mode=True)
check_dhcp_stress_status(duthost, packets_send_duration)
exp_count = int(ptfhost.shell('cat /tmp/dhcp_stress_test_ack.json')['stdout'].strip())
Copy link
Contributor

Choose a reason for hiding this comment

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

ptfrunner run in async mode, would this case end directly when execute to this line without ptfrunner end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants