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

modifying psushow script to use key names instead of index #3208

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gregoryboudreau
Copy link

@gregoryboudreau gregoryboudreau commented Mar 11, 2024

What I did

Change psushow to use key names under the PSU_INFO|* banner for clarity instead of via indexing method as was done previously.

How I did it

As stated above, query for keys in a sorted manner and grab/display information like that instead of grabbing information based on PSU index

How to verify it

Run psushow command (or its SONiC mask show platform psustatus)

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

cisco@sfd-t2-sup:~$ psushow --status
PSU    Model            Serial       HW Rev    Voltage (V)    Current (A)    Power (W)    Status       LED
-----  ---------------  -----------  --------  -------------  -------------  -----------  -----------  -----
PSU 1  N/A              N/A          N/A       N/A            N/A            N/A          NOT PRESENT  N/A
PSU 2  N/A              N/A          N/A       N/A            N/A            N/A          NOT PRESENT  N/A
PSU 3  N/A              N/A          N/A       N/A            N/A            N/A          NOT PRESENT  N/A
PSU 4  N/A              N/A          N/A       N/A            N/A            N/A          NOT PRESENT  N/A
PSU 5  N/A              N/A          N/A       N/A            N/A            N/A          NOT PRESENT  N/A
PSU 6  N/A              N/A          N/A       N/A            N/A            N/A          NOT PRESENT  N/A
PSU 7  PSU6.3KW-20A-HV  DTM243501TF  1.0       54.426         35.309         1924.904     OK           green
PSU 8  PSU6.3KW-20A-HV  DTM243501WZ  1.0       54.582         18.27          999.402      OK           green
PSU 9  PSU6.3KW-20A-HV  DTM243501TU  1.0       54.582         17.996         985.326      OK           green

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

cisco@yy39-rp:~$ show plat psu
PSU            Model            Serial       HW Rev    Voltage (V)    Current (A)    Power (W)    Status       LED
-------------  ---------------  -----------  --------  -------------  -------------  -----------  -----------  -----
psutray0.psu0  PSU6.3KW-20A-HV  DTM2503026B  1.0       N/A            N/A            N/A          NOT OK       off
psutray0.psu1  N/A              N/A          N/A       N/A            N/A            N/A          NOT PRESENT  N/A
psutray0.psu2  PSU6.3KW-20A-HV  DTM255001J9  1.0       N/A            N/A            N/A          NOT OK       off
psutray1.psu0  PSU6.3KW-20A-HV  DTM255001JK  1.0       N/A            N/A            N/A          NOT OK       off
psutray1.psu1  PSU6.3KW-20A-HV  DTM253401KD  1.0       N/A            N/A            N/A          NOT OK       off
psutray1.psu2  PSU6.3KW-20A-HV  DTM253404FZ  1.0       54.348         18.407         1002.921     OK           green
psutray2.psu0  PSU6.3KW-20A-HV  DTM255001JF  1.0       54.504         18.202         995.883      OK           green
psutray2.psu1  PSU6.3KW-20A-HV  DTM255001HM  1.0       54.426         18.27          995.883      OK           green
psutray2.psu2  PSU6.3KW-20A-HV  DTM255001HU  1.0       54.582         18.681         1020.516     OK           green

Related PRs:
sonic-net/sonic-mgmt#11944
sonic-net/sonic-platform-daemons#446
sonic-net/sonic-snmpagent#312

@prgeor
Copy link
Contributor

prgeor commented Apr 9, 2024

@gregoryboudreau from user perspective isn't the previous output easily readable compared to your proposal?

@gregoryboudreau
Copy link
Author

@gregoryboudreau from user perspective isn't the previous output easily readable compared to your proposal?

It depends. Having enumerated names can make it "readable" but provides minimal information about the actual device. By using the vendor defined name (if available), we can provide more accurate and contextual information for the user in the same way we do for fans/fantrays. The enumerated names can also cause confusion as the PSU enumeration != PSU index and may != PSU name. It is better to organize these under a simple and vendor implemented manner, same as fan trays.

@gechiang
Copy link
Contributor

gechiang commented Jun 3, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@assrinivasan
Copy link
Contributor

@gregoryboudreau could you please add the corresponding unit test to: sonic-utilities/tests/psushow_test.py ? It is currently testing the old format.

@prgeor
Copy link
Contributor

prgeor commented Jun 4, 2024

@gregoryboudreau could you please run test_psu*.py from sonic-mgmt test and attach the result to PR?

@gregoryboudreau
Copy link
Author

will update test and attach logs for test_psu

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