- 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.
* Adding support for get/set low pwer mode for QSFPs in PDDF common APIs
* Adding support for get/set low pwer mode for QSFPs in PDDF common APIs - Review comments
Why I did it
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.
_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
Why I did it
Some platforms need to run few steps before the PDDF service is actually started.
* Adding pre_pddf_init script in the service file
* Raising exception for get_target_speed() for PSU-fan in PDDF (#8129)
- Why I did it
PDDF utils were python2 compliant and they needed to be migrated to Python3 (as per Bullseye)
PDDF common platform APIs file name changed as the name was already in use
Indentation issues
Dead/redundant code needed to be removed
- How I did it
Made files Python3 compliant
Indentation corrected
Redundant code removed
- How to verify it
AS7326 Accton platform uses PDDF. PDDF utils were run on this platform to verify.
#### Why I did it
- Python3 compatibility changes for PDDF eeprom class
- Adding API for temperature in PDDF psu class
- PEP8 standard changes and adding missing method in PDDF sfp class
#### How I did it
- Using python3 to invoke the sonic_platform module in PDDF based platform
- Running autopep8 tool to comply to PEP8 standards
- Made python2 to python3 changes
- Removed ord() func as python3 return int instead of str
- Had to change chr(..) to bytes([..]) function while using ctypes class methods
**- Why I did it**
PR https://github.com/Azure/sonic-platform-common/pull/102 modified the name of the SFF-8436 (QSFP) method to align the method name between all drivers, renaming it from `parse_qsfp_dom_capability` to `parse_dom_capability`. Once the submodule was updated, the callers using the old nomenclature broke. This PR updates all callers to use the new naming convention.
**- How I did it**
Update the name of the function globally for all calls into the SFF-8436 driver.
Note that the QSFP-DD driver still uses the old nomenclature and should be modified similarly. I will open a PR to handle this separately.
- Make PDDF code compliant with both Python 2 and Python 3
- Align code with PEP8 standards using autopep8
- Build and install both Python 2 and Python 3 PDDF packages
Submodule updates include the following commits:
* src/sonic-utilities 9dc58ea...f9eb739 (18):
> Remove unnecessary calls to str.encode() now that the package is Python 3; Fix deprecation warning (#1260)
> [generate_dump] Ignoring file/directory not found Errors (#1201)
> Fixed porstat rate and util issues (#1140)
> fix error: interface counters is mismatch after warm-reboot (#1099)
> Remove unnecessary calls to str.decode() now that the package is Python 3 (#1255)
> [acl-loader] Make list sorting compliant with Python 3 (#1257)
> Replace hard-coded fast-reboot with variable. And some typo corrections (#1254)
> [configlet][portconfig] Remove calls to dict.has_key() which is not available in Python 3 (#1247)
> Remove unnecessary conversions to list() and calls to dict.keys() (#1243)
> Clean up LGTM alerts (#1239)
> Add 'requests' as install dependency in setup.py (#1240)
> Convert to Python 3 (#1128)
> Fix mock SonicV2Connector in python3: use decode_responses mode so caller code will be the same as python2 (#1238)
> [tests] Do not trim from PATH if we did not append to it; Clean up/fix shebangs in scripts (#1233)
> Updates to bgp config and show commands with BGP_INTERNAL_NEIGHBOR table (#1224)
> [cli]: NAT show commands newline issue after migrated to Python3 (#1204)
> [doc]: Update Command-Reference.md (#1231)
> Added 'import sys' in feature.py file (#1232)
* src/sonic-py-swsssdk 9d9f0c6...1664be9 (2):
> Fix: no need to decode() after redis client scan, so it will work for both python2 and python3 (#96)
> FieldValueMap `contains`(`in`) will also work when migrated to libswsscommon(C++ with SWIG wrapper) (#94)
- Also fix Python 3-related issues:
- Use integer (floor) division in config_samples.py (sonic-config-engine)
- Replace print statement with print function in eeprom.py plugin for x86_64-kvm_x86_64-r0 platform
- Update all platform plugins to be compatible with both Python 2 and Python 3
- Remove shebangs from plugins files which are not intended to be executable
- Replace tabs with spaces in Python plugin files and fix alignment, because Python 3 is more strict
- Remove trailing whitespace from plugins files
This change introduces PDDF which is described here: https://github.com/Azure/SONiC/pull/536
Most of the platform bring up effort goes in developing the platform device drivers, SONiC platform APIs and validating them. Typically each platform vendor writes their own drivers and platform APIs which is very tailor made to that platform. This involves writing code, building, installing it on the target platform devices and testing. Many of the details of the platform are hard coded into these drivers, from the HW spec. They go through this cycle repetitively till everything works fine, and is validated before upstreaming the code.
PDDF aims to make this platform driver and platform APIs development process much simpler by providing a data driven development framework. This is enabled by:
JSON descriptor files for platform data
Generic data-driven drivers for various devices
Generic SONiC platform APIs
Vendor specific extensions for customisation and extensibility
Signed-off-by: Fuzail Khan <fuzail.khan@broadcom.com>