Skip to content
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

integrated reboot-cause history into reboot tests in platfrom_tests/test_reboot.py #4270

Merged
merged 2 commits into from
Sep 17, 2021

Conversation

JibinBao
Copy link
Contributor

Description of PR

Summary:
Fixes # (issue)
Since adding the feature(sonic-net/SONiC#669) of show reboot-cause history, so integrate "show reboot-cause history" into sonic-mgmt/tests/platform_tests/test_reboot.py.
e.g.

show reboot-cause history
Name                 Cause          Time                             User    Comment
-------------------  -------------  -------------------------------  ------  ---------
2021_09_09_14_15_13  Power Loss ()  N/A                              N/A     N/A
2021_09_09_14_06_17  reboot         Thu 09 Sep 2021 02:05:17 PM UTC  admin   N/A
2021_09_09_13_59_11  Watchdog ()    N/A                              N/A     N/A
2021_09_09_13_52_13  Power Loss ()  N/A                              N/A     N/A
2021_09_09_13_45_18  warm-reboot    Thu 09 Sep 2021 01:44:14 PM UTC  admin   N/A
2021_09_09_13_37_58  fast-reboot    Thu 09 Sep 2021 01:37:09 PM UTC  admin   N/A
2021_09_09_13_30_52  soft-reboot    Thu 09 Sep 2021 01:30:24 PM UTC  admin   N/A
2021_09_09_13_24_17  reboot         Thu 09 Sep 2021 01:23:17 PM UTC  admin   N/A

Type of change

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

Back port request

  • 201911

Approach

What is the motivation for this PR?

In order to verify reboot-cause history function, add new checker for "show reboot-cause history" into reboot tests

How did you do it?

Add one new function of check_reboot_cause_history in sonic-mgmt/tests/platform_tests/test_reboot.py.
In test_reboot.py, there are 8 different reboot tests. In order to save test execution time, we leverage the reboot-cause history generated by them to test it.

  1. Verify the reboot-cause history title
  2. Verify reboot-cause output are sorted in reverse chronological order

How did you verify/test it?

run test_reboot.py

Any platform specific information?

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

Documentation

sonic-net/SONiC#669

@JibinBao JibinBao requested review from sujinmkang and a team as code owners September 15, 2021 06:41
@JibinBao JibinBao changed the title add reboot-cause history into reboot tests in platfrom_test integrated reboot-cause history into reboot tests in platfrom_tests/test_reboot.py Sep 15, 2021
@lgtm-com
Copy link

lgtm-com bot commented Sep 15, 2021

This pull request introduces 1 alert when merging f8100cc into 7c947a7 - view on LGTM.com

new alerts:

  • 1 for Unnecessary 'else' clause in loop

2021_09_09_13_30_52 soft-reboot Thu 09 Sep 2021 01:30:24 PM UTC admin N/A
2021_09_09_13_24_17 reboot Thu 09 Sep 2021 01:23:17 PM UTC admin N/A
"""
reboot_cause_history_got = dut.show_and_parse("show reboot-cause history")
Copy link
Contributor

Choose a reason for hiding this comment

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

show reboot-cause history is a new feature in 202012, can we make it a new test and skip the test for release before 202012?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because reboot consume too much time, so I don't create a new test for it, and want to leverage the reboot-cause history generated by them to test it.
can we add an version check when version is before 202012, skip the test. Is it ok?

Copy link
Contributor

Choose a reason for hiding this comment

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

ok to skip the check

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

@wangxin wangxin merged commit 15cb900 into sonic-net:master Sep 17, 2021
vmittal-msft pushed a commit to vmittal-msft/sonic-mgmt that referenced this pull request Sep 28, 2021
…est_reboot.py (sonic-net#4270)

This is to add test case in sonic-mgmt/tests/platform_tests/test_reboot.py to cover new feature reboot-cause history introduced in sonic-net/SONiC#669. Example:

show reboot-cause history
Name                 Cause          Time                             User    Comment
-------------------  -------------  -------------------------------  ------  ---------
2021_09_09_14_15_13  Power Loss ()  N/A                              N/A     N/A
2021_09_09_14_06_17  reboot         Thu 09 Sep 2021 02:05:17 PM UTC  admin   N/A
2021_09_09_13_59_11  Watchdog ()    N/A                              N/A     N/A
2021_09_09_13_52_13  Power Loss ()  N/A                              N/A     N/A
2021_09_09_13_45_18  warm-reboot    Thu 09 Sep 2021 01:44:14 PM UTC  admin   N/A
2021_09_09_13_37_58  fast-reboot    Thu 09 Sep 2021 01:37:09 PM UTC  admin   N/A
2021_09_09_13_30_52  soft-reboot    Thu 09 Sep 2021 01:30:24 PM UTC  admin   N/A
2021_09_09_13_24_17  reboot         Thu 09 Sep 2021 01:23:17 PM UTC  admin   N/A

What is the motivation for this PR?
In order to verify reboot-cause history function, add new checker for "show reboot-cause history" into reboot tests

How did you do it?
Add one new function of check_reboot_cause_history in sonic-mgmt/tests/platform_tests/test_reboot.py.
In test_reboot.py, there are 8 different reboot tests. In order to save test execution time, we leverage the reboot-cause history generated by them to test it.
1. Verify the reboot-cause history title
2. Verify reboot-cause output are sorted in reverse chronological order
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.

4 participants