sonic-mgmt icon indicating copy to clipboard operation
sonic-mgmt copied to clipboard

Fix dhcp testcase failures in Dual TOR AA Setups

Open santoss3 opened this issue 10 months ago • 4 comments

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

santoss3 avatar Apr 04 '24 19:04 santoss3

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:

  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 avatar Apr 04 '24 19:04 mssonicbld

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:

  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 avatar Apr 04 '24 20:04 mssonicbld

@santoss3 could you fix the conflict?

kevinskwang avatar Jun 24 '24 02:06 kevinskwang

@santoss3 could you fix the conflict?

Done @kevinskwang Thanks

santoss3 avatar Jul 11 '24 22:07 santoss3

/azp run

kevinskwang avatar Aug 14 '24 02:08 kevinskwang

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 14 '24 02:08 azure-pipelines[bot]

I didn't see any failure with dualtor-aa at msft end.

kevinskwang avatar Aug 14 '24 02:08 kevinskwang