Skip to content

cisco platform-specific timeout update #16762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
21 changes: 21 additions & 0 deletions tests/common/reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
REBOOT_TYPE_KERNEL_PANIC = "Kernel Panic"
REBOOT_TYPE_SUPERVISOR = "Reboot from Supervisor"
REBOOT_TYPE_SUPERVISOR_HEARTBEAT_LOSS = "Heartbeat with the Supervisor card lost"
# Timeout waiting for smartswitch to come back after reboot
SMARTSWITCH_REBOOT_TIMEOUT = 700
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment before these timeouts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added comment for the timeouts.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It might not be a satisfactory solution to modify a generic function to handle the timeout for smartswitch. Can we do that in a more generic way, like updating the reboot_ctrl_dict?

Copy link
Contributor

Choose a reason for hiding this comment

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

Had an offline sync with Bing. There are some concerns in making this platform-specific change in reboot function. @nnelluri-cisco, @rameshraghupathy Let's instead try to do this via plt_reboot_dict which is processed by reboot function using get_plt_reboot_ctrl().

# Time to wait for smartswitch to stabilize
SMARTSWITCH_REBOOT_WAIT = 300

# Event to signal DUT activeness
DUT_ACTIVE = threading.Event()
Expand Down Expand Up @@ -253,6 +257,8 @@ def reboot(duthost, localhost, reboot_type='cold', delay=10,
assert not (safe_reboot and return_after_reconnect)
pool = ThreadPool()
hostname = duthost.hostname
# smartswitch specific reboot and wait time update
smartswitch_update_reboot_timeout(duthost)
try:
tc_name = os.environ.get('PYTEST_CURRENT_TEST').split(' ')[0]
plt_reboot_ctrl = get_plt_reboot_ctrl(duthost, tc_name, reboot_type)
Expand Down Expand Up @@ -613,3 +619,18 @@ def collect_mgmt_config_by_console(duthost, localhost):
logger.info('End: collect mgmt config by console ...')
else:
logger.warning("dut console is not ready, we can get mgmt config by console")


Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a summary to the function here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added summary to the function

def smartswitch_update_reboot_timeout(duthost):
"""
@summary: This function updates the reboot timeout and wait time for a SmartSwitch device,
based on the platform type
@param duthost: DUT host object.
"""
# This is how you get platform info from the DUT
platform = duthost.facts['platform']
# Apply the platform-specific timeout update
if platform == 'x86_64-8102_28fh_dpu_o-r0':
for reboot_type in reboot_ctrl_dict:
reboot_ctrl_dict[reboot_type]["timeout"] = SMARTSWITCH_REBOOT_TIMEOUT
reboot_ctrl_dict[reboot_type]["wait"] = SMARTSWITCH_REBOOT_WAIT
Loading