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

Platform Driver Development Framework (PDDF): Adding PDDF CLI utils #624

Merged
merged 3 commits into from
Dec 6, 2019

Conversation

FuzailBrcm
Copy link
Contributor

- What I did
This change is related to Platform Driver Development Framework (PDDF) which is being added to sonic-buildimage repo. More details can be found here,
sonic-net/SONiC#406

PDDF supports its own CLI utilities, which use generic PDDF component plugins. I added these PDDF CLI utilities.

- How I did it
Created pddf_psuutil, pddf_fanutil, pddf_thermalutil, pddf_ledutil.

- How to verify it
Under non-PDDF mode, these utilities won't run,

root@sonic:/home/admin# pddf_psuutil mfrinfo
PDDF mode should be supported and enabled for this platform for this operation
root@sonic:/home/admin#
root@sonic:/home/admin# pddf_fanutil status
PDDF mode should be supported and enabled for this platform for this operation
root@sonic:/home/admin#

In PDDF mode, these utilities can be run with root privileges.

- 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)

root@sonic:/home/admin# pddf_fanutil getspeed
FAN      Front Fan RPM    Rear Fan RPM
-----  ---------------  --------------
FAN 1             8700            7400
FAN 2             8600            7300
FAN 3             8800            7500
FAN 4             8800            7500
FAN 5             8500            7300
FAN 6             8600            7300
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin# pddf_fanutil status
FAN    Status
-----  --------
FAN 1  OK
FAN 2  OK
FAN 3  OK
FAN 4  OK
FAN 5  OK
FAN 6  OK
root@sonic:/home/admin# pddf_psuutil mfrinfo
PSU 1 is OK
Manufacture Id: 3Y POWER
Model: YM-2651
Serial Number: SA290N091739133083
Fan Direction: INTAKE

PSU 2 is Not OK

root@sonic:/home/admin#

-->

@FuzailBrcm
Copy link
Contributor Author

Retest this please

@FuzailBrcm
Copy link
Contributor Author

Retest this please

2 similar comments
@FuzailBrcm
Copy link
Contributor Author

Retest this please

@FuzailBrcm
Copy link
Contributor Author

Retest this please

@FuzailBrcm
Copy link
Contributor Author

sonic-buildimage PR (sonic-net/sonic-buildimage#3387) has dependency on this PR. Please review this and provide comments so that the main PR can be approved and pushed.

Thanks,

# ========================== Syslog wrappers ==========================


def log_info(msg, also_print_to_console=False):
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should avoid redundant code here, same log_* functions defined in several files, maybe you can consider to use a common log class: https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-daemon-base/sonic_daemon_base/daemon_base.py#L50

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Making changes as per your comments. The daemon_base.py class you mentioned can not be used in sonic-utilities as it is not part of HOST. So I added similar class

@click.argument('index', type=click.STRING)
@click.argument('color', type=click.STRING)
@click.argument('color_state', type=click.STRING)
def setstatusled(device_name, index, color, color_state):
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's the motivation to expose a CLI to set status led? Shouldn't it be controlled by the system itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some are but some are not. Usually PSU1/PSU2/FAN are controlled by system itself, But LOC are controlled by user. CPLD spec has R/W permission on the control register. DIAG led too, is not controlled by system sometimes.

# ==================== Methods for initialization ====================

# Returns platform and HW SKU
def get_platform_and_hwsku():
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function also defined in several files, would like to suggest to find a way to reduce redundant code. for the below load_platform_*util functions, although they are loading different device utilities, I believe can define one common function and load different device util according to input.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made changes as per your comments

@FuzailBrcm
Copy link
Contributor Author

@fk410167
Adding changes as per the comments: moving common functions to a sepa… …
a1bde51

@FuzailBrcm
Copy link
Contributor Author

restest this please

@FuzailBrcm
Copy link
Contributor Author

retest default please

@FuzailBrcm
Copy link
Contributor Author

retest this please

1 similar comment
@FuzailBrcm
Copy link
Contributor Author

retest this please

@lguohan lguohan merged commit 0e4fc9c into sonic-net:master Dec 6, 2019
abdosi pushed a commit that referenced this pull request Feb 24, 2020
…624)

This change is related to Platform Driver Development Framework (PDDF) which is being added to sonic-buildimage repo. More details can be found here, sonic-net/SONiC#406

PDDF supports its own CLI utilities, which use generic PDDF component plugins. I added these PDDF CLI utilities.
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.

5 participants