Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[crm/test_crm_nexthop]: Enhance test_crm_nexthop to cleanup ip addres…
…ses added to ptf interfaces if test fails (sonic-net#11748) What is the motivation for this PR? The crm test - test_crm_nexthop does not cleanup the ip added to PTF interfaces correctly when the testcase fails. This PR is an enhancement to include a fixture to cleanup correctly after the testcase runs regardless of the outcome of the testcase. How did you do it? A fixture cleanup_ptf_interface() was added in tests/crm/conftest.py to run after the test completes. This fixture calls the function remove_ip_addresses() to remove the ip addresses assigned to the ptf interfaces during the test run. How did you verify/test it? Ran the test - test_crm_nexthop to see if the testcase passes and cleanup is correctly executed through the fixture. test_crm_nexthop scenarios tested: 1. Fail ipv4 test_crm_nexthop to see if cleanup is executed correctly. Check if ipv6 scenario passes correctly. 2. Fail ipv6 scenario to see if cleanup is executed correctly. Check ipv4 scenario passes correctly with cleanup. 3. Fail both scenarios to see if cleanup is executed correctly. 4. Pass both scenarios and see if cleanup is executed correctly. 5. Run the entire test_crm.py suite to see if all testcases pass and cleanup is executed correctly.
- Loading branch information