[action] [PR:17819] Fix BFD status check and ipv6 PTF intermittent issue.#19874
Merged
mssonicbld merged 1 commit intosonic-net:202411from Jul 29, 2025
Merged
Conversation
* Fix BFD status check and ipv6 PTF intermittent issue. * Add RFC comment.
12 tasks
Collaborator
Author
|
Original PR: #17819 |
Collaborator
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Description of PR
Summary:
Fixes # (issue)
On Smartswitch, the following non-multihop specific failures are seen after running test_bfd.py:
Failure 1:
Testcases: bfd/test_bfd.py::test_bfd_basic[ipv4-dut_init_first], bfd/test_bfd.py::test_bfd_basic[ipv4-ptf_init_first], bfd/test_bfd.py::test_bfd_basic[ipv6-dut_init_first]
File "/usr/local/lib/python3.8/dist-packages/pluggy/_hooks.py", line 493, in call
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 115, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 113, in _multicall
raise exception.with_traceback(exception.traceback)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 77, in _multicall
res = hook_impl.function(*args)
File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 192, in pytest_pyfunc_call
result = testfunction(**testargs)
File "/data/tests/bfd/test_bfd.py", line 396, in test_bfd_basic
check_dut_bfd_status(duthost, neighbor_addr, "Admin_Down")
File "/data/tests/bfd/test_bfd.py", line 236, in check_dut_bfd_status
assert expected_state in bfd_state[0] # If all attempts fail, raise an assertion error
AssertionError
Failure 2:
Testcase: bfd/test_bfd.py::test_bfd_basic[ipv6-ptf_init_first]
File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 1761, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_hooks.py", line 493, in call
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 115, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 113, in _multicall
raise exception.with_traceback(exception.traceback)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 77, in _multicall
res = hook_impl.function(*args)
File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 192, in pytest_pyfunc_call
result = testfunction(**testargs)
File "/data/tests/bfd/test_bfd.py", line 387, in test_bfd_basic
check_dut_bfd_status(duthost, neighbor_addr, "Up")
File "/data/tests/bfd/test_bfd.py", line 236, in check_dut_bfd_status
assert expected_state in bfd_state[0] # If all attempts fail, raise an assertion error
AssertionError
Failure 1 is happening because testcase is expecting AdminDown state in SONIC when AdminDown state is set on remote end (PTF). This expection is wrong because SONIC displays local BFD state and not remote. If PTF goes to AdminDown then local state will go to Down. This matches the RFC (see section 6.2):
https://datatracker.ietf.org/doc/html/rfc5880#section-6.8.16
https://datatracker.ietf.org/doc/html/rfc5880#section-6.2
"AdminDown state means that the session is being held administratively down. This causes the remote system to enter Down state, and remain there until the local system exits AdminDown state."
Failure 2 is intermittent. When IPv6 BFD sessions are configured on PTF before DUT then some sessions always stay in Down state. Initially, IPv6 addresses are configured on both DUT and BFD, then right away BFD sessions on PTF are started. PTF does not send IPv6 neighbor solicitation (NS) packets to DUT for some of the IPv6 addresses when BFD sessions are configured. Because these packets are missing, the IPv6 adjacency is not resolved on the DUT and BFD sessions stay down. The solution is add a 5 second delay between configuring IPv6 addresses on PTF and configuring BFD on PTF. This allows for enough delay so IPv6 addresses are fully programmed and BFD session can trigger sending of IPv6 NS packets on PTF.
Type of change
Back port request
Approach
What is the motivation for this PR?
Fix test run failures in the tests/bfd/test_bfd.py for ipv4/ipv6 singlehop testcases
How did you do it?
Added a delay to allow IPv6 adjacency to resolve before BFD sessions are programmed, updated state check to check for 'Down'.
How did you verify/test it?
Ran sonic-mgmt test_bfd.py and it passed
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation