[Mellanox]Fix issue #2720 Not able to read out values of voltage/temp/power on some cables #2957
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
- What I did
Fix issue #2720 Not able to read out values of voltage/temp/power on some cables, which is due to dom reading error on Mellanox switches. Fix it by reading dom via ethtool rather than sysfs and limit all the modifications within Mellanox-specific code.
- How I did it
A new class based on SfpUtilBase and a new method _read_eeprom_specific_bytes_via_ethtool have been introduced in order to change the way the eeprom DOM data is read. Typically the best practice to do this kind of thing is to limit the modification within the function which executes reading operations only and keep other stuff (especially the interface) untouched. However, this can hardly be achieved since the original reading function takes the file object as an input parameter to represent the port. It is done by having the file object pointed to /var/run/hwmanagement files, which will not be maintained in the future.
As a result, the following reading interface has to be introduced with an explicit port number/name as an input parameter in order to get rid of the dependency on those files:
_read_eeprom_specific_bytes_via_ethtool
Since the interface changed, all methods that call the interface should also be overwritten in order to call the new interface, including:
_read_eeprom_devid
get_transceiver_info_dict
get_transceiver_dom_info_dict
Only interface used to read eeprom DOM has been replaced and the main logic has not been changed except the following mentioned:
- How to verify it
1.execute the following command on both SFP and QSFP ports
sudo sfputil show eeprom -d -p Ethernetxxx
sudo sfputil show eeprom -p Ethernetxxx
2.make sure that TRANSCEIVER_INFO and TRANSCEIVER_DOM_SENSOR table in STADE_DB exist for all ports and contain correct data.
- Description for the changelog
Fix issue #2720 Not able to read out values of voltage/temp/power on some cables, which is due to dom reading error.
- A picture of a cute animal (not mandatory but encouraged)