Optimize ip/test_mgmt_ipv6_only.py to reduce runtime by ~85%#25501
Open
peterbailey-arista wants to merge 1 commit into
Open
Optimize ip/test_mgmt_ipv6_only.py to reduce runtime by ~85%#25501peterbailey-arista wants to merge 1 commit into
peterbailey-arista wants to merge 1 commit into
Conversation
Right now, ip/test_mgmt_ipv6_only.py takes 2 to 2.5 hours to run. The test is so slow because every ansible connection times out after removing the ipv4 mgmt interface address. The new runtime is about 22 minutes, which is 6x to 7x faster. We need to update the ansible host to be aware of the correct IPv6 address it should now be using. Previously this test still passed because every ansible ssh connection would fall back to using the IPv6 address So the fix is to set the default address to the IPv6 as soon as we remove the IPv4 configuration. As-is the test "worked" and tested the ipv6 address on the management interface, just in a roundabout way since it relied on ipv4 timing out and falling back to ipv6. I added a new function to update this address on the ansible host after it is found. The new set_ansible_host function is called twice: once before config reload and once after `duthosts.reset()` This is intentional, to speed up the config reload which will and then to speed up the tests after `duthosts.reset` wipes out the ansible_host ip address setting update. Signed-off-by: Peter <peterbailey@arista.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
This PR has backport request for branch(es): 202511,202605. ---Powered by SONiC BuildBot
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now,
ip/test_mgmt_ipv6_only.pytakes 2 to 2.5 hours to run. The test is so slow because every ansible connection times out after removing the ipv4 mgmt interface address. The new tested runtime is about 22 minutes, which is 6x to 7x faster.We need to update the ansible host to be aware of the correct IPv6 address it should now be using. Previously this test still passed because every ansible ssh connection would fall back to using the IPv6 address, it just took a very long time to do so.
The fix is to set the default address to the IPv6 as soon as we remove the IPv4 configuration.
Description of PR
Speed up
ip/test_mgmt_ipv6_only.pyup to 7 times faster.Type of change
Back port request
Approach
What is the motivation for this PR?
Right now ip/test_mgmt_ipv6_only.py takes an excessively long time to run, I am fixing it and speeding it up.
How did you do it?
As-is the test "worked" and tested the IPv6 address on the management interface, just in a roundabout way since it relied on IPv4 timing out and falling back to IPv6. I added a new function to update this address on the ansible host after it is found.
The new
set_ansible_hostfunction is called twice: once before config reload and once afterduthosts.reset()This is intentional, to speed up the config reload which will and then to speed up the tests afterduthosts.resetwipes out theansible_hostip address setting update.How did you verify/test it?
I ran
ip/test_mgmt_ipv6_only.pyseveral times without then with my change.Without my change on a max topology T2 device this test would take as long as 2 hours and 40 minutes.
With my change this test file took between 20 and 30 minutes.
9 passed, 1 skipped, 531 warnings in 1323.60s (0:22:03)I also verified that this change did not affect the tests running before and after it: