Skip to content

[action] [PR:17819] Fix BFD status check and ipv6 PTF intermittent issue.#19874

Merged
mssonicbld merged 1 commit intosonic-net:202411from
mssonicbld:cherry/202411/17819
Jul 29, 2025
Merged

[action] [PR:17819] Fix BFD status check and ipv6 PTF intermittent issue.#19874
mssonicbld merged 1 commit intosonic-net:202411from
mssonicbld:cherry/202411/17819

Conversation

@mssonicbld
Copy link
Copy Markdown
Collaborator

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

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
  • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405
  • 202411

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

* Fix BFD status check and ipv6 PTF intermittent issue.

* Add RFC comment.
@mssonicbld
Copy link
Copy Markdown
Collaborator Author

Original PR: #17819

@mssonicbld
Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld mssonicbld merged commit 80ea05a into sonic-net:202411 Jul 29, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants