[sfputil] Refactor to utilize sonic-platform package#1421
[sfputil] Refactor to utilize sonic-platform package#1421jleveque merged 21 commits intosonic-net:masterfrom jleveque:sfputil_use_sonic_platform
Conversation
This comment has been minimized.
This comment has been minimized.
| except ImportError as e: | ||
| raise ImportError("%s - required module not found" % str(e)) | ||
| import click | ||
| import sonic_platform |
There was a problem hiding this comment.
@jleveque - We tested this file on a multi-asic and single asic box, except we had to change this line to
import sonic_platform.platform
In common code, we are seeing a lot of places where we have to make the same change as above for python3 to work. Is this the best way to fix this?
There was a problem hiding this comment.
I have heard other accounts of this. Why do you need to change it? What is the error you encounter with it like this?
There was a problem hiding this comment.
admin@Linecard2:$ /usr/bin/python3 Python 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sonic_platform >>> platform_chassis = sonic_platform.platform.Platform().get_chassis() Traceback (most recent call last): File "", line 1, in AttributeError: module 'sonic_platform' has no attribute 'platform' >>>
There was a problem hiding this comment.
I don't see this issue on Arista, Dell or Mellanox platforms. Can you see if there is a noticeable difference in the way your sonic-platform packages are structured?
Also, I just pushed a couple new commits. Can you please test the latest changes?
There was a problem hiding this comment.
@jleveque sorry for the delay. There was an issue in the packaging of our sonic-platform that we have now resolved and thus don't see the backtrace with the original contents.
Also, I have tested the latest main.py on multi-asic and single asic pizza box, and it works fine.
There was a problem hiding this comment.
Great to hear! And thanks for testing the changes!
|
Should we also change psuutil as well to use the new PMON 2.0 API's? |
I just merged those changes, actually: #1434 |
Refactor sfputil to use sonic-platform package in lieu of old, deprecated platform plugins. The sfputil utility is still useful, as sfpshow only reads and displays SFP data from State DB. However, we still need a utility to write to the transceivers (low power mode, reset, etc.), and the ability to read directly from the transceivers is helpful for debugging. - Complete refactor to use sonic-platform package - Refactor display functions to align with sfpshow utility - Bump version to 3.0 - Add unit tests
Refactor sfputil to use sonic-platform package in lieu of old, deprecated platform plugins. The sfputil utility is still useful, as sfpshow only reads and displays SFP data from State DB. However, we still need a utility to write to the transceivers (low power mode, reset, etc.), and the ability to read directly from the transceivers is helpful for debugging. - Complete refactor to use sonic-platform package - Refactor display functions to align with sfpshow utility - Bump version to 3.0 - Add unit tests
[portsorch] add buffer drop FC group [bitmap_vnet] Fix VNET route priority issue (sonic-net#1421) [vnet] Maintain the reference count of the nexthop when creating a vn… (sonic-net#1414) [intfsorch] Retrieve Port object before setting NAT zone on router interfaces. (sonic-net#1372)
What I did
Refactor sfputil to use sonic-platform package in lieu of old, deprecated platform plugins.
The sfputil utility is still useful, as sfpshow only reads and displays SFP data from State DB. However, we still need a utility to write to the transceivers (low power mode, reset, etc.), and the ability to read directly from the transceivers is helpful for debugging.
How I did it
How to verify it
Run all
sfputilcommands, ensure they work. Do the same on multiple platforms. Output should be the same as before.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)