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

Add show reboot-cause history cli #1210

Merged
merged 19 commits into from
Dec 1, 2020
Merged

Conversation

sujinmkang
Copy link
Collaborator

@sujinmkang sujinmkang commented Nov 3, 2020

  • What I did
    To make the reboot cause history information available for telemetry service, during processing the reboot-cause on boot, the information is saved in state-db.
    The cli command show reboot-cause is changed to support the new file format and file name.
    New command show reboot-cause history is added to display the reboot-cause information which is stored in state-db.

  • How I did it
    Add the 'show reboot-cause history' command to read up to the10 previous reboot-cause information from state-db and display them.
    Read the last reboot-cause from the new file "previous-reboot-cause.json" and process the data to display for show reboot-cause

  • How to verify it
    Unit test added.
    Verified also in DUT

  • Previous command output (if the output of a command-line utility has changed)

  • New command output (if the output of a command-line utility has changed)

admin@sonic:~$ show reboot-cause history
name                 cause        time                          user    comment
-------------------  -----------  ----------------------------  ------  ---------
2020_10_09_04_53_58  warm-reboot  Fri Oct  9 04:51:47 UTC 2020  admin
2020_10_09_02_33_06  reboot       Fri Oct  9 02:29:44 UTC 2020  admin
2020_10_09_02_00_53  fast-reboot  Fri Oct  9 01:58:04 UTC 2020  admin
2020_10_09_01_56_59  reboot       Fri Oct  9 01:53:49 UTC 2020  admin

HLD : sonic-net/SONiC#669

Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

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

As comments. Also, since reboot-cause is now a group, can you please move this functionality to a new file, reboot_cause.py and import the file in main.py? There are a number of other examples.

show/main.py Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Nov 3, 2020

This pull request introduces 1 alert when merging 7182079 into ef5f212 - view on LGTM.com

new alerts:

  • 1 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Nov 3, 2020

This pull request introduces 1 alert when merging 1ac64c6 into ef5f212 - view on LGTM.com

new alerts:

  • 1 for Syntax error

@lgtm-com
Copy link

lgtm-com bot commented Nov 4, 2020

This pull request introduces 1 alert when merging 24f8dd0 into 061f428 - view on LGTM.com

new alerts:

  • 1 for Unused import

show/reboot_cause.py Outdated Show resolved Hide resolved
show/reboot_cause.py Outdated Show resolved Hide resolved
show/reboot_cause.py Outdated Show resolved Hide resolved
@lguohan
Copy link
Contributor

lguohan commented Nov 5, 2020

please paste code coverage number.

@lgtm-com

This comment has been minimized.

@sujinmkang
Copy link
Collaborator Author

retest this please!

show/reboot_cause.py Outdated Show resolved Hide resolved
@sujinmkang
Copy link
Collaborator Author

retest this please!

tests/reboot_cause_test.py Outdated Show resolved Hide resolved
@sujinmkang
Copy link
Collaborator Author

retest this please

show/reboot_cause.py Show resolved Hide resolved
jleveque
jleveque previously approved these changes Nov 19, 2020
@sujinmkang
Copy link
Collaborator Author

retest this please

@sujinmkang
Copy link
Collaborator Author

retest this please

@lguohan
Copy link
Contributor

lguohan commented Nov 20, 2020

can you fix unit test failure?

@sujinmkang
Copy link
Collaborator Author

@lguohan yes, I'm checking it. I got some other errors on sonic-utilities builds so I'm doing a clean up build to reproduce this unit test failure.

show/main.py Outdated Show resolved Hide resolved
show/main.py Outdated Show resolved Hide resolved
@sujinmkang
Copy link
Collaborator Author

[2020-11-28T07:13:01.701Z] ----------- coverage: platform linux, python 3.7.3-final-0 -----------
[2020-11-28T07:13:01.701Z] Name Stmts Miss Cover
[2020-11-28T07:13:01.701Z] -----------------------------------------------------------------
[2020-11-28T07:13:01.702Z] show/reboot_cause.py 48 4 92%

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.

3 participants