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

Adding support for fan_drawer class in PDDF common platform APIs #10213

Merged
merged 1 commit into from Mar 18, 2022

Conversation

FuzailBrcm
Copy link
Contributor

Why I did it

  1. fan_drawer support was missing in PDDF common platform APIs. This resulted in 'thermalctld' not working and 'show platform fan' and 'show platfomr temperature' commands not working.
  2. _thermal_list array inside PSU class was not initialized. Made changes to attach the PSU related thermal sensors in the PSU instance.

How I did it

Added a common class pddf_fan_drawer.py. This class uses the PDDF JSON to fetch the platform specific data. A platform which uses PDDF would follow the below hierarchy.

fan_drawer_base.py ---> pddf_fan_drawer.py ---> fan_drawer.py

How to verify it

Run the 'show platform fan' and 'show platform temperature' commands and check the o/p.

o/p on AS7326:

root@sonic:/home/admin# show platform fan
s  Drawer    LED         FAN    Speed    Direction    Presence    Status          Timestamp
--------  -----  ----------  -------  -----------  ----------  --------  -----------------
Fantray1  green  Fantray1_1      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray1  green  Fantray1_2      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray2  green  Fantray2_1      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray2  green  Fantray2_2      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray3  green  Fantray3_1      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray3  green  Fantray3_2      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray4  green  Fantray4_1      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray4  green  Fantray4_2      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray5  green  Fantray5_1      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray5  green  Fantray5_2      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray6  green  Fantray6_1      38%      EXHAUST     Present        OK  20220311 04:15:03
Fantray6  green  Fantray6_2      38%      EXHAUST     Present        OK  20220311 04:15:03
     N/A    off   PSU1_FAN1       0%                  Present    Not OK  20220311 04:15:05
     N/A  green   PSU2_FAN1      34%      EXHAUST     Present        OK  20220311 04:15:05
hroot@sonic:/home/admin# show platform temperature
    Sensor    Temperature    High TH    Low TH    Crit High TH    Crit Low TH    Warning          Timestamp
----------  -------------  ---------  --------  --------------  -------------  ---------  -----------------
PSU1_TEMP1            0          N/A       N/A             N/A            N/A      False  20220311 04:15:05
PSU2_TEMP1           37          N/A       N/A             N/A            N/A      False  20220311 04:15:05
     TEMP1           37         80.0       N/A             N/A            N/A      False  20220311 04:15:05
     TEMP2           27         80.0       N/A             N/A            N/A      False  20220311 04:15:05
     TEMP3           28.5       80.0       N/A             N/A            N/A      False  20220311 04:15:05
     TEMP4           30.5       80.0       N/A             N/A            N/A      False  20220311 04:15:05
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin#

o/p on AS7726:

root@as7726-32x-2:~# show platform fan
  Drawer    LED         FAN    Speed    Direction    Presence    Status          Timestamp
--------  -----  ----------  -------  -----------  ----------  --------  -----------------
Fantray1  green  Fantray1_1      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray1  green  Fantray1_2      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray2  green  Fantray2_1      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray2  green  Fantray2_2      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray3  green  Fantray3_1      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray3  green  Fantray3_2      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray4  green  Fantray4_1      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray4  green  Fantray4_2      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray5  green  Fantray5_1      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray5  green  Fantray5_2      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray6  green  Fantray6_1      38%      EXHAUST     Present        OK  20220311 08:13:04
Fantray6  green  Fantray6_2      38%      EXHAUST     Present        OK  20220311 08:13:04
     N/A  green   PSU1_FAN1      23%      EXHAUST     Present        OK  20220311 08:13:04
     N/A  green   PSU2_FAN1      22%      EXHAUST     Present        OK  20220311 08:13:04
root@as7726-32x-2:~# show platform temp
    Sensor    Temperature    High TH    Low TH    Crit High TH    Crit Low TH    Warning          Timestamp
----------  -------------  ---------  --------  --------------  -------------  ---------  -----------------
PSU1_TEMP1           28          N/A       N/A             N/A            N/A      False  20220311 08:13:04
PSU2_TEMP1           25          N/A       N/A             N/A            N/A      False  20220311 08:13:04
     TEMP1           23.5       80.0       N/A             N/A            N/A      False  20220311 08:13:04
     TEMP2           27         80.0       N/A             N/A            N/A      False  20220311 08:13:04
     TEMP3           24         80.0       N/A             N/A            N/A      False  20220311 08:13:04
     TEMP4           27         80.0       N/A             N/A            N/A      False  20220311 08:13:04
     TEMP5           24         80.0       N/A             N/A            N/A      False  20220311 08:13:04   

Platform specific changes would be submitted using another PR.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@lgtm-com
Copy link

lgtm-com bot commented Mar 11, 2022

This pull request introduces 2 alerts when merging 2ebb078 into 9cdf812 - view on LGTM.com

new alerts:

  • 2 for Wrong number of arguments in a class instantiation

@FuzailBrcm
Copy link
Contributor Author

@pettershao-ragilenetworks
Please make note of this PR. Could affect your platforms.
#10215 -- You can refer to this PR by Edge-core for the usage of pddf_fan_drawer class.

Thanks

@FuzailBrcm
Copy link
Contributor Author

2 new LGTM alerts can be ignored. These alerts are related to Fan() and Thermal() class initialization. Different platforms uses different number of arguments in the init func.

@FuzailBrcm
Copy link
Contributor Author

@geans-pin
@ds952811
@jostar-yang
Can you review these?

@jostar-yang
Copy link
Contributor

It is fine to me.

Copy link
Contributor

@jostar-yang jostar-yang left a comment

Choose a reason for hiding this comment

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

It is ok

@lguohan lguohan merged commit d3f2da8 into sonic-net:master Mar 18, 2022
@leeprecy
Copy link
Contributor

it looks good.

lguohan pushed a commit that referenced this pull request Mar 29, 2022
Why I did it
Support for show platform temp/fan for psu-temp and fan.
Original code doesn't has fan_drawer to support these information.

How I did it
Support for show platform temp/fan for psu-temp and fan.
Add fan_drawer.py and update thermal.py to add needed code.
It need PDDF common code to support . (Refer to #10213)

How to verify it
Test show platform temp and show platform fan.
root@as7726-32x-2:~# show platform fan
Drawer LED FAN Speed Direction Presence Status Timestamp

Fantray1 green Fantray1_1 38% EXHAUST Present OK 20220311 08:13:04
Fantray1 green Fantray1_2 38% EXHAUST Present OK 20220311 08:13:04
Fantray2 green Fantray2_1 38% EXHAUST Present OK 20220311 08:13:04
Fantray2 green Fantray2_2 38% EXHAUST Present OK 20220311 08:13:04
Fantray3 green Fantray3_1 38% EXHAUST Present OK 20220311 08:13:04
Fantray3 green Fantray3_2 38% EXHAUST Present OK 20220311 08:13:04
Fantray4 green Fantray4_1 38% EXHAUST Present OK 20220311 08:13:04
Fantray4 green Fantray4_2 38% EXHAUST Present OK 20220311 08:13:04
Fantray5 green Fantray5_1 38% EXHAUST Present OK 20220311 08:13:04
Fantray5 green Fantray5_2 38% EXHAUST Present OK 20220311 08:13:04
Fantray6 green Fantray6_1 38% EXHAUST Present OK 20220311 08:13:04
Fantray6 green Fantray6_2 38% EXHAUST Present OK 20220311 08:13:04
N/A green PSU1_FAN1 23% EXHAUST Present OK 20220311 08:13:04
N/A green PSU2_FAN1 22% EXHAUST Present OK 20220311 08:13:04
root@as7726-32x-2:~# show platform temp
Sensor Temperature High TH Low TH Crit High TH Crit Low TH Warning Timestamp

PSU1_TEMP1 28 N/A N/A N/A N/A False 20220311 08:13:04
PSU2_TEMP1 25 N/A N/A N/A N/A False 20220311 08:13:04
TEMP1 23.5 80.0 N/A N/A N/A False 20220311 08:13:04
TEMP2 27 80.0 N/A N/A N/A False 20220311 08:13:04
TEMP3 24 80.0 N/A N/A N/A False 20220311 08:13:04
TEMP4 27 80.0 N/A N/A N/A False 20220311 08:13:04
TEMP5 24 80.0 N/A N/A N/A False 20220311 08:13:04

Co-authored-by: Jostar Yang <jostar_yang@accton.com.tw>
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.

None yet

6 participants