Skip to content

Support recovering Nexus devices via console#11264

Merged
wangxin merged 6 commits intosonic-net:masterfrom
yutongzhang-microsoft:yutongzhang/nexus_recovery
Jan 18, 2024
Merged

Support recovering Nexus devices via console#11264
wangxin merged 6 commits intosonic-net:masterfrom
yutongzhang-microsoft:yutongzhang/nexus_recovery

Conversation

@yutongzhang-microsoft
Copy link
Contributor

Description of PR

In PR #10806, we support auto recovery of testbeds via console. But at that time, we didn't support nexus testbeds.
In Nexus testbeds, they first enter into loader, and after rebooting in loader, they enter into ONIE. So in this PR, we enhance the function which will do recover in ONIE to cover this sistuation.

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205
  • 202305

Approach

What is the motivation for this PR?

In PR #10806, we support auto recovery of testbeds via console. But at that time, we didn't support nexus testbeds.
In Nexus testbeds, they first enter into loader, and after rebooting in loader, they enter into ONIE. So in this PR, we enhance the function which will do recover in ONIE to cover this sistuation.

How did you do it?

Enhance the function which will do recover in ONIE to cover Nexus testbeds. If the type of testbeds is Nexus, first do reboot, and then, recover in ONIE.

How did you verify/test it?

Any platform specific information?

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

Documentation

@wangxin wangxin requested review from lerry-lee and wangxin January 17, 2024 02:49
# enter_onie_flag += 1
# continue

if "-OS-" in x and enter_onie_flag is True:
Copy link
Collaborator

Choose a reason for hiding this comment

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

if "-OS-" in x and enter_onie_flag:

Copy link
Contributor Author

@yutongzhang-microsoft yutongzhang-microsoft Jan 17, 2024

Choose a reason for hiding this comment

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

I do some tests, and because of the rule of Python, we can use bool(enter_onie_flag) or use enter_onie_flag is True here. Simply enter_onie_flag will not be considered as a boolean.

if "*ONIE" in x and "Install OS" not in x:
dut_console.remote_conn.send("\n")
enter_onie_flag += 1
enter_onie_flag = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you create constant for the strings like "-OS-", "*ONIE", "Install OS" and others, so that it would be clear to speculate the usage from the constant name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

# elif type in ["Cisco"]:
# return
elif type in ["mellanox", "nexus", "acs"]:
elif type in ["nexus"]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you rename variable type to something like device_type? The reason is that it conflicts with python's builtin type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

elif type in ["mellanox", "nexus", "acs"]:
elif type in ["nexus"]:
posix_shell_onie(dut_console, mgmt_ip, image_url, is_nexus=True)
elif type in ["mellanox", "cisco", "acs"]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

We also have some Nokia devices. Are they covered?

yejianquan
yejianquan previously approved these changes Jan 17, 2024
Copy link
Collaborator

@yejianquan yejianquan left a comment

Choose a reason for hiding this comment

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

LGTM

@wangxin wangxin changed the title Add nexus testbeds into auto recovery scripts. Support recovering Nexus devices via console Jan 18, 2024
@wangxin wangxin merged commit 523f7d2 into sonic-net:master Jan 18, 2024
@yutongzhang-microsoft yutongzhang-microsoft deleted the yutongzhang/nexus_recovery branch January 18, 2024 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants