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

[arp]: Add tests for dualtor failed neighbors

Open theasianpianist opened this issue 2 years ago • 3 comments

Signed-off-by: Lawrence Lee [email protected]

Description of PR

Summary: Fixes #6298

Type of change

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

Back port request

  • [ ] 201911
  • [ ] 202012
  • [ ] 202205

Approach

What is the motivation for this PR?

We have a test gap for some scenarios involving failed neighbor entries on dualtor as outlined in #6298

How did you do it?

Add two new test cases:

  • test_arp_update_for_failed_standby_neighbor which checks that the arp_update script is able to recover a FAILED neighbor entry on the standby TOR to REACHABLE
  • test_standby_unsolicited_neigh_learning which checks that the standby TOR is able to learn a new, REACHABLE neighbor entry triggered by arp_update on the active TOR

Add new fixtures:

  • config_dualtor_arp_responder which configures the arp_responder service on the PTF to reply to ARP requests for the server IPs configured in the MUX_CABLE table on the TORs
  • pause_garp_service to temporarily stop garp_service on the PTF for test cases where it would interefere

Cleanup some import statements

How did you verify/test it?

Run test_arp_dualtor.py, verify all test cases pass for both IPv4 and IPv6

Any platform specific information?

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

True dual ToR only

Documentation

theasianpianist avatar Nov 01 '22 00:11 theasianpianist

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.................................................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/arp/test_arp_dualtor.py:12:1: F401 'tests.common.dualtor.mux_simulator_control.toggle_all_simulator_ports_to_upper_tor' imported but unused
tests/arp/test_arp_dualtor.py:13:1: F401 'tests.common.dualtor.dual_tor_utils.upper_tor_host' imported but unused
tests/arp/test_arp_dualtor.py:13:1: F401 'tests.common.dualtor.dual_tor_utils.lower_tor_host' imported but unused
tests/arp/test_arp_dualtor.py:13:1: F401 'tests.common.dualtor.dual_tor_utils.config_dualtor_arp_responder' imported but unused
tests/arp/test_arp_dualtor.py:13:121: E501 line too long (156 > 120 characters)
tests/arp/test_arp_dualtor.py:14:1: F401 'tests.common.dualtor.dual_tor_common.mux_config' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.run_garp_service' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.change_mac_addresses' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.run_icmp_responder' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.pause_garp_service' imported but unused
tests/arp/test_arp_dualtor.py:15:121: E501 line too long (126 > 120 characters)
...
[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>

azure-pipelines[bot] avatar Nov 01 '22 00:11 azure-pipelines[bot]

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.................................................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/arp/test_arp_dualtor.py:12:1: F401 'tests.common.dualtor.mux_simulator_control.toggle_all_simulator_ports_to_upper_tor' imported but unused
tests/arp/test_arp_dualtor.py:13:1: F401 'tests.common.dualtor.dual_tor_utils.upper_tor_host' imported but unused
tests/arp/test_arp_dualtor.py:13:1: F401 'tests.common.dualtor.dual_tor_utils.lower_tor_host' imported but unused
tests/arp/test_arp_dualtor.py:13:1: F401 'tests.common.dualtor.dual_tor_utils.config_dualtor_arp_responder' imported but unused
tests/arp/test_arp_dualtor.py:13:121: E501 line too long (156 > 120 characters)
tests/arp/test_arp_dualtor.py:14:1: F401 'tests.common.dualtor.dual_tor_common.mux_config' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.run_garp_service' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.change_mac_addresses' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.run_icmp_responder' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.pause_garp_service' imported but unused
tests/arp/test_arp_dualtor.py:15:121: E501 line too long (126 > 120 characters)
...
[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>

azure-pipelines[bot] avatar Nov 04 '22 22:11 azure-pipelines[bot]

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.................................................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/arp/test_arp_dualtor.py:12:1: F401 'tests.common.dualtor.mux_simulator_control.toggle_all_simulator_ports_to_upper_tor' imported but unused
tests/arp/test_arp_dualtor.py:13:1: F401 'tests.common.dualtor.dual_tor_utils.upper_tor_host' imported but unused
tests/arp/test_arp_dualtor.py:13:1: F401 'tests.common.dualtor.dual_tor_utils.lower_tor_host' imported but unused
tests/arp/test_arp_dualtor.py:13:1: F401 'tests.common.dualtor.dual_tor_utils.config_dualtor_arp_responder' imported but unused
tests/arp/test_arp_dualtor.py:13:121: E501 line too long (156 > 120 characters)
tests/arp/test_arp_dualtor.py:14:1: F401 'tests.common.dualtor.dual_tor_common.mux_config' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.run_garp_service' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.change_mac_addresses' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.run_icmp_responder' imported but unused
tests/arp/test_arp_dualtor.py:15:1: F401 'tests.common.fixtures.ptfhost_utils.pause_garp_service' imported but unused
tests/arp/test_arp_dualtor.py:15:121: E501 line too long (126 > 120 characters)
...
[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>

azure-pipelines[bot] avatar Nov 11 '22 19:11 azure-pipelines[bot]

@theasianpianist There are many conflicts while merging to 202012 branch. Can you create a separate PR to 202012 branch to have this change?

wangxin avatar Nov 17 '22 08:11 wangxin

@theasianpianist There are many conflicts while merging to 202012 branch. Can you create a separate PR to 202012 branch to have this change?

PR here, please check https://github.com/sonic-net/sonic-mgmt/pull/6878

theasianpianist avatar Nov 23 '22 04:11 theasianpianist