sonic-mgmt
sonic-mgmt copied to clipboard
Fix dhcp testcase failures in Dual TOR AA Setups
Description of PR
n Dual TOR scenario the "dhcp" testcase is failing due to the following reasons -
in AA Setup the packets from server may land into any TOR due to ECMP, whereas the testcase expects it to land on DUT port Fix is to toggle non-DUT ports so that the dhcp request will always be received on the DUT
Summary: Fixes # Failures in dhcp_relay/test_dhcp_relay.py in Dual Tor Setups
Type of change
- [X] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [ ] Test case(new/improvement)
Back port request
- [ ] 201911
- [ ] 202012
- [X] 202205
- [X] 202305
- [X] 202311
Approach
What is the motivation for this PR?
Fix Failures in dhcp_relay/test_dhcp_relay.py in Dual Tor Setups
How did you do it?
Specified in PR Description
How did you verify/test it?
Verified that the dhcp testcase passes after the code changes.
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html --------------------------------------------------------- generated xml file: /data/tests/logs/tr_2024-03-19-15-12-14.xml --------------------------------------------------------- ============================================================================= short test summary info ============================================================================= SKIPPED [5] dhcp_relay/test_dhcp_relay.py:213: skip SINGLE_TOR_MODE tests on Dual ToR testbeds SKIPPED [1] dhcp_relay/test_dhcp_relay.py:415: skip the link flap testcase on dual tor testbeds SKIPPED [1] dhcp_relay/test_dhcp_relay.py:468: skip the uplinks down testcase on dual tor testbeds =============================================================== 4 passed, 7 skipped, 1 warning in 563.27s (0:09:23) =============================================================== INFO:root:Can not get Allure report URL. Please check logs sonic@sonic-ucs-m6-1:/data/tests$
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation
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/dhcp_relay/test_dhcp_relay.py:328:1: E302 expected 2 blank lines, found 1
tests/dhcp_relay/test_dhcp_relay.py:330:50: F811 redefinition of unused 'toggle_all_simulator_ports_to_rand_selected_tor_m' from line 10
tests/dhcp_relay/test_dhcp_relay.py:539:33: F811 redefinition of unused 'toggle_all_simulator_ports_to_rand_selected_tor_m' from line 10
tests/dhcp_relay/test_dhcp_relay.py:578:34: F811 redefinition of unused 'toggle_all_simulator_ports_to_rand_selected_tor_m' from line 10
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:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
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/dhcp_relay/test_dhcp_relay.py:331:50: F811 redefinition of unused 'toggle_all_simulator_ports_to_rand_selected_tor_m' from line 10
tests/dhcp_relay/test_dhcp_relay.py:540:33: F811 redefinition of unused 'toggle_all_simulator_ports_to_rand_selected_tor_m' from line 10
tests/dhcp_relay/test_dhcp_relay.py:579:34: F811 redefinition of unused 'toggle_all_simulator_ports_to_rand_selected_tor_m' from line 10
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:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
@santoss3 could you fix the conflict?
@santoss3 could you fix the conflict?
Done @kevinskwang Thanks
/azp run
Azure Pipelines successfully started running 1 pipeline(s).
I didn't see any failure with dualtor-aa at msft end.