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-history #1154

Closed
wants to merge 82 commits into from
Closed

Conversation

sujinmkang
Copy link
Collaborator

@sujinmkang sujinmkang commented Oct 9, 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

@sujinmkang sujinmkang requested a review from jleveque October 9, 2020 08:11
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.

I feel like this command should be in the same group as show reboot-cause.

Either:

show reboot-cause
show reboot-cause history

or

show reboot cause
show reboot history

However, if we go with the latter, we would also need to add an alias from show reboot-cause to show reboot cause to retain backward-compatibility.

sujinmkang and others added 3 commits October 9, 2020 12:33
sonic-net#1151)

To ensure a smooth transition once we stop installing the dependencies explicitly in the SONiC image.

We can upgrade dependencies selectively in the future.

Also had to replace single-quotes with double-quotes in expected Click error messages, as it seems the Click package installed via pip uses double quotes, whereas the package installed via Debian used single-quotes.
@lguohan
Copy link
Contributor

lguohan commented Oct 10, 2020

@sujinmkang , please add unit test.

Copy link
Contributor

@lguohan lguohan left a comment

Choose a reason for hiding this comment

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

please add unit tests

jleveque and others added 5 commits October 10, 2020 17:47
…onic-net#1161)

Add instructions for setting up an environment to build the sonic-utilities package and run unit tests

Resolves sonic-net#1160
* Add 'show' CLI for system-health feature

Signed-off-by: Shlomi Bitton <[email protected]>

* Add unit test for 'system-health' feature, add support for testing in 'show' script, Fix comments

Signed-off-by: Shlomi Bitton <[email protected]>

* Fix additional comments

* Fix comments

* Update Command-Reference.md

Add a CLI reference for system-health feature.

* Fix LGTM alerts

* Fix comment

Change 'Ignore' to 'Ignored'

* Update Command-Reference.md

Fix example output

* Update Command-Reference.md

* Change 'summary' output and adapt test and reference to the new change

* Update main.py

* Fix multiline output for expected output

* keep output aligned

* Fix import for unit testing after community change

* Add clicommon for @cli.group after community change

* Align changes in the feature to the CLI on commit
sonic-net/sonic-buildimage@8ea2ab5

Signed-off-by: Shlomi Bitton <[email protected]>

* Update main.py

* Move new group CLI into a separate file

* Organize imports per PEP8 standards

* Organize imports per PEP8 standards

* Reformat docstring for readability
…onic-net#1162)


Previous code only enumerate on distinct neighbors, thus only one
port is shown for a neighbor.

Signed-off-by: Guohan Lu <[email protected]>
…1155)

* Update lib.py
* Keep the code format align see add spaces for special symbols
* remove unused code
@lgtm-com
Copy link

lgtm-com bot commented Oct 13, 2020

This pull request introduces 1 alert when merging d8977fe into 3a7457c - view on LGTM.com

new alerts:

  • 1 for Unused local variable

sujinmkang and others added 11 commits October 13, 2020 01:38
The 'ipaddress.ip_interface' accepts only unicode str as input, which is
default in python3. However, an exception will raise when running in
python2. This commit fix the issue.

Signed-off-by: bingwang <[email protected]>
…-net#1157)

* Add watermark testcases and mock counters

Signed-off-by: Neetha John <[email protected]>
show/main.py Outdated Show resolved Hide resolved
show/aliases.ini Outdated Show resolved Hide resolved
show/main.py Outdated Show resolved Hide resolved
@sujinmkang
Copy link
Collaborator Author

Please review the new PR : #1210. Closing this PR since my rebase attempt messed up the PR.

@sujinmkang sujinmkang closed this Nov 3, 2020
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.