Skip to content

[sanity] Fix sanity check bgp not ready after restart#19296

Merged
bingwang-ms merged 1 commit intosonic-net:masterfrom
lolyu:fix_sanity_bgp
Jul 3, 2025
Merged

[sanity] Fix sanity check bgp not ready after restart#19296
bingwang-ms merged 1 commit intosonic-net:masterfrom
lolyu:fix_sanity_bgp

Conversation

@lolyu
Copy link
Copy Markdown
Collaborator

@lolyu lolyu commented Jul 1, 2025

Description of PR

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Approach

What is the motivation for this PR?

Fix the following error:

tests.common.errors.RunAnsibleModuleFail: run module bgp_facts failed, Ansible Results =>
failed = True
msg = Command failed rc=1, out=, err=Exiting: failed to connect to any daemons.

invocation = {'module_args': {'num_npus': 1, 'instance_id': None}}
_ansible_no_log = None
changed = False
stdout =
stderr =

, error:run module bgp_facts failed, Ansible Results =>
failed = True
msg = Command failed rc=1, out=, err=Exiting: failed to connect to any daemons.

invocation = {'module_args': {'num_npus': 1, 'instance_id': None}}
_ansible_no_log = None
changed = False
stdout =
stderr =

This issue is due to that, if the first _check_bgp_status_helper fails, the recover tries to restart bgp on the DUT; but bgpd takes time to startup, so the vtysh is not responsive.

wait_until(timeout, interval, 0, _check_bgp_status_helper)
if (check_result['failed']):
# try restart bgp and verify again
_restart_bgp(dut)
wait_until(60, interval, 0, _check_bgp_status_helper)

Signed-off-by: Longxiang Lyu [email protected]

How did you do it?

catch any exception raised by the bgp_facts and return False in this case.

How did you verify/test it?

Run testcase with no default route, verify no complain that vtysh is not responsive:

bgp/test_bgp_fact.py::test_bgp_facts[str2-7050cx3-acs-06-None] PASSED                                                                                                                                                                                                  [ 50%]
bgp/test_bgp_fact.py::test_bgp_facts[str2-7050cx3-acs-07-None] PASSED                                                                                                                                                                                                  [100%]

Any platform specific information?

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

Documentation

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@lolyu lolyu force-pushed the fix_sanity_bgp branch from 1432dec to 5f51ebb Compare July 1, 2025 10:20
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@lolyu lolyu marked this pull request as ready for review July 1, 2025 10:24
@lolyu lolyu requested a review from yxieca July 1, 2025 10:24
Copy link
Copy Markdown
Collaborator

@bingwang-ms bingwang-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bingwang-ms bingwang-ms merged commit db3f8fc into sonic-net:master Jul 3, 2025
19 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jul 3, 2025
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202505: #19390

mssonicbld pushed a commit that referenced this pull request Jul 3, 2025
nissampa pushed a commit to nissampa/sonic-mgmt_dpu_test that referenced this pull request Aug 7, 2025
ashutosh-agrawal pushed a commit to ashutosh-agrawal/sonic-mgmt that referenced this pull request Aug 14, 2025
vidyac86 pushed a commit to vidyac86/sonic-mgmt that referenced this pull request Oct 23, 2025
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Mar 27, 2026
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.

4 participants