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 PDDF common framework enhancements. #12863

Merged
merged 2 commits into from
Dec 17, 2022

Conversation

FuzailBrcm
Copy link
Contributor

  1. Consolidating multiple read functions in a PSU driver on the basis of byte, word or block read,
  2. Enhancing PDDF parsing script support for CPU and PCH temperature reading,
  3. Adding missing methods in PDDF common APIs

Why I did it

  • PSU driver changes are to optimize the code and increase the code coverage
  • PDDF parser script enhancements to accommodate the CPU and PCH temp reading using hwmon device path
  • Some of the new APIs were missing from the PDDF common platform classes

How I did it

Added code changes and verified them on AS7816 adn AS7726 platforms.

How to verify it

AS7816

root@sonic:/home/admin# show platform summary
Platform: x86_64-accton_as7816_64x-r0
HwSKU: Accton-AS7816-64X
ASIC: broadcom
ASIC Count: 1
Serial Number: AAA1903AAEV
Model Number: FP3AT7664000A
Hardware Revision: N/A
root@sonic:/home/admin#
root@sonic:/home/admin# show platform psustatus
PSU    Model     Serial              HW Rev      Voltage (V)    Current (A)    Power (W)  Status    LED
-----  --------  ------------------  --------  -------------  -------------  -----------  --------  -----
PSU 1                                N/A                0.00           0.00         0.00  NOT OK    off
PSU 2  YM-2851F  SA070U461830013847  N/A               12.03          20.88       251.00  OK        green
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin# show platform fan
  Drawer    LED         FAN    Speed    Direction    Presence    Status          Timestamp
--------  -----  ----------  -------  -----------  ----------  --------  -----------------
Fantray1  green  Fantray1_1      52%      EXHAUST     Present        OK  20221129 09:30:17
Fantray1  green  Fantray1_2      52%      EXHAUST     Present        OK  20221129 09:30:17
Fantray2  green  Fantray2_1      52%      EXHAUST     Present        OK  20221129 09:30:17
Fantray2  green  Fantray2_2      52%      EXHAUST     Present        OK  20221129 09:30:17
Fantray3  green  Fantray3_1      52%      EXHAUST     Present        OK  20221129 09:30:17
Fantray3  green  Fantray3_2      52%      EXHAUST     Present        OK  20221129 09:30:17
Fantray4  green  Fantray4_1      52%      EXHAUST     Present        OK  20221129 09:30:17
Fantray4  green  Fantray4_2      52%      EXHAUST     Present        OK  20221129 09:30:17
     N/A    off   PSU1_FAN1       0%      exhaust     Present    Not OK  20221129 09:30:18
     N/A  green   PSU2_FAN1      78%      exhaust     Present        OK  20221129 09:30:18
root@sonic:/home/admin#
root@sonic:/home/admin# show platform temperature
                   Sensor    Temperature    High TH    Low TH    Crit High TH    Crit Low TH    Warning          Timestamp
-------------------------  -------------  ---------  --------  --------------  -------------  ---------  -----------------
      CpuBoard_temp(0x4B)           26.5       80.0       N/A             N/A            N/A      False  20221129 09:30:18
          FB_1_temp(0x4D)           28         80.0       N/A             N/A            N/A      False  20221129 09:30:18
          FB_2_temp(0x4E)           28         80.0       N/A             N/A            N/A      False  20221129 09:30:18
        MB_MAC_temp(0x48)           31.5       80.0       N/A             N/A            N/A      False  20221129 09:30:18
 MB_RearCenter_temp(0x49)           35         80.0       N/A             N/A            N/A      False  20221129 09:30:18
MB_RightCenter_temp(0x4A)           26.5       80.0       N/A             N/A            N/A      False  20221129 09:30:18
               PSU1_TEMP1            0          N/A       N/A             N/A            N/A      False  20221129 09:30:19
               PSU2_TEMP1           25          N/A       N/A             N/A            N/A      False  20221129 09:30:19
root@sonic:/home/admin#
root@sonic:/home/admin# pddf_psuutil mfrinfo
PSU    Status    Manufacturer ID    Model     Serial              Fan Airflow Direction
-----  --------  -----------------  --------  ------------------  -----------------------
PSU1   NOT OK                                                     exhaust
PSU2   OK        3Y POWER           YM-2851F  SA070U461830013847  exhaust
root@sonic:/home/admin# pddf_psuutil seninfo
PSU    Status      Output Voltage (V)    Output Current (A)    Output Power (W)    Temperature1 (C)    Fan1 Speed (RPM)
-----  --------  --------------------  --------------------  ------------------  ------------------  ------------------
PSU1   NOT OK                    0.00                  0.00                0.00                0.00                   0
PSU2   OK                       12.05                 20.97              253.00               25.00               14096
root@sonic:/home/admin# pddf_fanutil getspeed
FAN           SPEED (RPM)
----------  -------------
Fantray1_1           9897
Fantray1_2           7961
Fantray2_1           9897
Fantray2_2           8138
Fantray3_1           9897
Fantray3_2           8138
Fantray4_1           9897
Fantray4_2           7961
root@sonic:/home/admin# pddf_fanutil direction
FAN         Direction
----------  -----------
Fantray1_1  Exhaust
Fantray1_2  Exhaust
Fantray2_1  Exhaust
Fantray2_2  Exhaust
Fantray3_1  Exhaust
Fantray3_2  Exhaust
Fantray4_1  Exhaust
Fantray4_2  Exhaust
root@sonic:/home/admin# pddf_thermalutil gettemp
Temp Sensor                Label           Value
-------------------------  --------------  -------
FB_1_temp(0x4D)            lm75-i2c-17-4d  temp1	 +28.0 C (high = +80.0 C)
FB_2_temp(0x4E)            lm75-i2c-17-4e  temp1	 +28.0 C (high = +80.0 C)
MB_MAC_temp(0x48)          lm75-i2c-18-48  temp1	 +31.5 C (high = +80.0 C)
MB_RearCenter_temp(0x49)   lm75-i2c-18-49  temp1	 +34.5 C (high = +80.0 C)
MB_RightCenter_temp(0x4A)  lm75-i2c-18-4a  temp1	 +27.0 C (high = +80.0 C)
CpuBoard_temp(0x4B)        lm75-i2c-18-4b  temp1	 +26.5 C (high = +80.0 C)
root@sonic:/home/admin#
root@sonic:/home/admin# python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sonic_platform
>>> ch = sonic_platform.platform.Platform().get_chassis()
>>> p1 = ch.get_psu(0)
>>> p2 = ch.get_psu(1)
>>> p2.get_position_in_parent()
2
>>> p1.get_position_in_parent()
1
>>> p1.is_replaceable()
True
>>> p2.is_replaceable()
True
>>>
root@sonic:/home/admin#

AS7726

root@sonic:/home/admin# show platform summary
Platform: x86_64-accton_as7726_32x-r0
HwSKU: Accton-AS7726-32X
ASIC: broadcom
ASIC Count: 1
Serial Number: 772632X1911067
Model Number: FP3ZZ7632074A
Hardware Revision: N/A
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin# show platform psustatus
PSU    Model     Serial              HW Rev      Voltage (V)    Current (A)    Power (W)  Status    LED
-----  --------  ------------------  --------  -------------  -------------  -----------  --------  -----
PSU 1  N/A       N/A                 N/A                0.00           0.00         0.00  NOT OK    off
PSU 2  YM-2651Y  SA070V581905000496  N/A               12.16          11.00       133.00  OK        green
root@sonic:/home/admin# show platform fan
  Drawer    LED         FAN    Speed    Direction    Presence    Status          Timestamp
--------  -----  ----------  -------  -----------  ----------  --------  -----------------
Fantray1  green  Fantray1_1      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray1  green  Fantray1_2      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray2  green  Fantray2_1      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray2  green  Fantray2_2      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray3  green  Fantray3_1      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray3  green  Fantray3_2      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray4  green  Fantray4_1      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray4  green  Fantray4_2      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray5  green  Fantray5_1      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray5  green  Fantray5_2      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray6  green  Fantray6_1      38%      EXHAUST     Present        OK  20221129 09:31:05
Fantray6  green  Fantray6_2      38%      EXHAUST     Present        OK  20221129 09:31:05
     N/A    off   PSU1_FAN1       0%                  Present    Not OK  20221129 09:31:06
     N/A  green   PSU2_FAN1      23%      EXHAUST     Present        OK  20221129 09:31:06
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin# show platform temperature
                  Sensor    Temperature    High TH    Low TH    Crit High TH    Crit Low TH    Warning          Timestamp
------------------------  -------------  ---------  --------  --------------  -------------  ---------  -----------------
           CB_temp(0x4B)           36.5       80.0       N/A             N/A            N/A      False  20221129 09:31:06
           FB_temp(0x4C)           34.5       80.0       N/A             N/A            N/A      False  20221129 09:31:06
  MB_FrontMAC_temp(0x49)           34         80.0       N/A             N/A            N/A      False  20221129 09:31:06
MB_LeftCenter_temp(0x4A)           34.5       80.0       N/A             N/A            N/A      False  20221129 09:31:06
   MB_RearMAC_temp(0x48)           36.5       80.0       N/A             N/A            N/A      False  20221129 09:31:06
              PSU1_TEMP1            0          N/A       N/A             N/A            N/A      False  20221129 09:31:07
              PSU2_TEMP1           40          N/A       N/A             N/A            N/A      False  20221129 09:31:07
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin# pddf_psuutil mfrinfo
PSU    Status    Manufacturer ID    Model     Serial              Fan Airflow Direction
-----  --------  -----------------  --------  ------------------  -----------------------
PSU1   NOT OK                       N/A       N/A
PSU2   OK        3Y POWER           YM-2651Y  SA070V581905000496  EXHAUST
root@sonic:/home/admin#
root@sonic:/home/admin# pddf_psuutil seninfo
PSU    Status      Output Voltage (V)    Output Current (A)    Output Power (W)    Temperature1 (C)    Fan1 Speed (RPM)
-----  --------  --------------------  --------------------  ------------------  ------------------  ------------------
PSU1   NOT OK                    0.00                  0.00                0.00                0.00                   0
PSU2   OK                       12.14                 11.09              135.00               34.00               25792
root@sonic:/home/admin# pddf_thermalutil gettemp
Temp Sensor               Label           Value
------------------------  --------------  -------
FB_temp(0x4C)             lm75-i2c-54-4c  temp1	 +31.5 C (high = +80.0 C)
MB_RearMAC_temp(0x48)     lm75-i2c-55-48  temp1	 +36.0 C (high = +80.0 C)
MB_FrontMAC_temp(0x49)    lm75-i2c-55-49  temp1	 +34.0 C (high = +80.0 C)
MB_LeftCenter_temp(0x4A)  lm75-i2c-55-4a  temp1	 +34.5 C (high = +80.0 C)
CB_temp(0x4B)             lm75-i2c-55-4b  temp1	 +35.0 C (high = +80.0 C)
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin# show environment
lm75-i2c-55-4a
Adapter: i2c-2-mux (chan_id 6)
MB_LeftCenter_temp:  +34.5 C  (high = +80.0 C, hyst = +75.0 C)

lm75-i2c-55-49
Adapter: i2c-2-mux (chan_id 6)
MB_FrontMAC_temp:  +34.0 C  (high = +80.0 C, hyst = +75.0 C)

fan_ctrl-i2c-54-66
Adapter: i2c-2-mux (chan_id 5)
Fantray1 Front: 10000 RPM
Fantray1 Rear:  8400 RPM
Fantray2 Front: 10000 RPM
Fantray2 Rear:  8400 RPM
Fantray3 Front: 10000 RPM
Fantray3 Rear:  8400 RPM
Fantray4 Front: 10000 RPM
Fantray4 Rear:  8400 RPM
Fantray5 Front: 10100 RPM
Fantray5 Rear:  8500 RPM
Fantray6 Front: 10100 RPM
Fantray6 Rear:  8600 RPM

lm75-i2c-55-4b
Adapter: i2c-2-mux (chan_id 6)
CB_temp:      +34.5 C  (high = +80.0 C, hyst = +75.0 C)

pch_haswell-virtual-0
Adapter: Virtual device
temp1:        +40.5 C

lm75-i2c-55-48
Adapter: i2c-2-mux (chan_id 6)
MB_RearMAC_temp:  +36.0 C  (high = +80.0 C, hyst = +75.0 C)

lm75-i2c-54-4c
Adapter: i2c-2-mux (chan_id 5)
FB_temp:      +31.0 C  (high = +80.0 C, hyst = +75.0 C)

psu_pmbus-i2c-50-5b
Adapter: i2c-2-mux (chan_id 1)
PSU 1 Voltage:       0.00 V
PSU 1 Fan:            0 RPM
PSU 1 Temperature:   +0.0 C
PSU 1 Power:         0.00 W
PSU 1 Current:       0.00 A

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +45.0 C  (high = +82.0 C, crit = +104.0 C)
Core 0:        +45.0 C  (high = +82.0 C, crit = +104.0 C)
Core 1:        +45.0 C  (high = +82.0 C, crit = +104.0 C)
Core 2:        +45.0 C  (high = +82.0 C, crit = +104.0 C)
Core 3:        +45.0 C  (high = +82.0 C, crit = +104.0 C)

psu_pmbus-i2c-49-58
Adapter: i2c-2-mux (chan_id 0)
PSU 2 Voltage:      12.17 V
PSU 2 Fan:         25696 RPM
PSU 2 Temperature:  +34.0 C
PSU 2 Power:       134.00 W
PSU 2 Current:      11.09 A

root@sonic:/home/admin#
root@sonic:/home/admin#

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

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

Description for the changelog

Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.

Link to config_db schema for YANG module changes

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

…read functions in a PSU driver on the basis of byte, word or block read, 2) Enhancing PDDF parsing script support for CPU and PCH temperature reading, 3) Adding missing methods in PDDF common APIs
@FuzailBrcm
Copy link
Contributor Author

@jostar-yang @geans-pin @adyeung
Please review these changes

@lgtm-com
Copy link

lgtm-com bot commented Nov 29, 2022

This pull request introduces 1 alert when merging e689a77 into c16b8db - view on LGTM.com

new alerts:

  • 1 for Variable defined multiple times

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

@jostar-yang
Copy link
Contributor

Can you add "self.fans_psu_index+1" to get_position_in_parent() on pddf_fan.py for psu-fan case?

@FuzailBrcm
Copy link
Contributor Author

Can you add "self.fans_psu_index+1" to get_position_in_parent() on pddf_fan.py for psu-fan case?

That would be wrong. fan_index represents the actual index of the fan be it in fan_drawer or PSU.

@lguohan lguohan merged commit abc8ed8 into sonic-net:master Dec 17, 2022
qnos pushed a commit to qnos/sonic-buildimage that referenced this pull request Nov 12, 2023
- Consolidating multiple read functions in a PSU driver on the basis of byte, word or block read,
- Enhancing PDDF parsing script support for CPU and PCH temperature reading,
- Adding missing methods in PDDF common APIs

Why I did it
- PSU driver changes are to optimize the code and increase the code coverage
- PDDF parser script enhancements to accommodate the CPU and PCH temp reading using hwmon device path
- Some of the new APIs were missing from the PDDF common platform classes

How I did it
Added code changes and verified them on AS7816 adn AS7726 platforms.
MuLinForest pushed a commit to MuLinForest/sonic-buildimage that referenced this pull request Aug 6, 2024
…platform feature

sonic-net#14361

Why I did it
Base on Adding PDDF common framework enhancements. sonic-net#12863 to modify pddf-device.json and platform API.
Add code to pass pytest.

How I did it
Add needed code to sonic_platform and driver.

How to verify it
sonic-cli cmd:
show platform {fan, temperature, firmware status, syseeprom, psustatus}
sfputil cmd:
show {presence, eeprom, lpmode}
Verify function by sonic-mgmt tools:
Test file path: /tests/platform_tests/api/
 Test items: test_chassis.py, test_component.py, test_fan_drawer.py, test_psu.py, test_thermal.py, test_sfp.py
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