-
Notifications
You must be signed in to change notification settings - Fork 812
Replace py-swsssdk with swsscommon #5926
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
Replace py-swsssdk with swsscommon #5926
Conversation
This PR depends on another PR to merge first: |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -114,7 +114,7 @@ def get_ifindex(duthost, port): | |||
|
|||
def get_port_index(duthost, port): | |||
py_version = 'python' if '201911' in duthost.os_version else 'python3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Add code to check if the sonic_py_common.port_util class exist.
@@ -1,6 +1,6 @@ | |||
#!/usr/bin/python | |||
|
|||
import swsssdk | |||
from swsscommon import swsscommon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code change may break on old device, I will test with 2018 image on by devbox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Manually test on 201911 and latest master branch. this script and related UT does not run on 201811 version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sonic-mgmt master branch will not be used to test 201811 and older branch images. If this is the truth, then it is good enough, and no need to improve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix is necessary because SonicDBConfig.load_sonic_global_db_config() added on 2021, so on 2019 swsscommon exist but we still need use swsssdk.
try: | ||
import swsssdk | ||
except ImportError: | ||
from swsscommon import swsscommon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Description of PR
Replace sonic-py-swsssdk with sonic-swss-common.
Type of change
Back port request
Approach
What is the motivation for this PR?
deprecate sonic-py-swsssdk and switch to sonic-swss-common.
How did you do it?
Replace sonic-py-swsssdk with sonic-swss-common.
How did you verify/test it?
Pass all UT.
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation