-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add get_transceiver_status and get_transceiver_pm to API interface #315
Add get_transceiver_status and get_transceiver_pm to API interface #315
Conversation
@prgeor please review. This is dependency of sonic-net/sonic-platform-daemons#304 |
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.
I think you will also need to modify testing script to improve code coverage since it's less than 80% currently.
trans_status['rxsigpowerhighwarning_flag'] = self.vdm_dict['Rx Signal Power [dBm]'][1][7] | ||
trans_status['rxsigpowerlowwarning_flag'] = self.vdm_dict['Rx Signal Power [dBm]'][1][8] | ||
try: | ||
trans_status['rxsigpowerhighalarm_flag'] = self.vdm_dict['Rx Signal Power [dBm]'][1][5] |
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.
Just curious - Are we seeing KeyError exception for ZR since I didn't find this being populated in the UT.
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.
yes.
And I saw similar key error handling in c_cmis.py:get_transceiver_threshold_info() for self.vdm_dict['Rx Signal Power [dBm]']
Added testcase in test_ccmis.py to cover the case of 'Rx Signal Power [dBm]' not present. |
@prgeor @mihirpat1 I took care of the existing comments, can you please review? |
Add get_transceiver_pm API interface
Added pm table related change, to use this PR to track changes for both status and pm. |
trans_status['rxsigpowerlowalarm_flag'] = self.vdm_dict['Rx Signal Power [dBm]'][1][6] | ||
trans_status['rxsigpowerhighwarning_flag'] = self.vdm_dict['Rx Signal Power [dBm]'][1][7] | ||
trans_status['rxsigpowerlowwarning_flag'] = self.vdm_dict['Rx Signal Power [dBm]'][1][8] | ||
except KeyError: |
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.
@longhuan-cisco how do we know if there is a key error?
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.
Added a debug log here in the case of key error.
@@ -133,6 +133,23 @@ def get_transceiver_threshold_info(self): | |||
""" | |||
raise NotImplementedError | |||
|
|||
def get_transceiver_status(self): | |||
""" | |||
Retrieves transceiver status of this SFP |
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.
can you provide more details in the API description what does status mean
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.
sure, added.
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.
we have an existing API "get_transceiver_bulk_status", should we consider combining the new function with this existing one? Otherwise, I would suggest reconsidering the name of the new API for differentiation.
|
||
def get_transceiver_pm(self): | ||
""" | ||
Retrieves PM for this xcvr |
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.
could you add more details in this API what does PM mean and where its applicable?
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.
sure, added.
This pull request introduces 1 alert when merging 5261da7 into ce9aacb - view on LGTM.com new alerts:
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. |
trans_status['rxsigpowerhighwarning_flag'] = self.vdm_dict['Rx Signal Power [dBm]'][1][7] | ||
trans_status['rxsigpowerlowwarning_flag'] = self.vdm_dict['Rx Signal Power [dBm]'][1][8] | ||
except KeyError: | ||
helper_logger.log_debug('Rx Signal Power [dBm] not present in VDM') |
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.
will the 'debug' level log print out in the running time?
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.
Can we print more generic key error that can print any Key error name?
cfo_avg = FLOAT ; carrier frequency offset avg | ||
cfo_min = FLOAT ; carrier frequency offset min | ||
cfo_max = FLOAT ; carrier frequency offset max | ||
soproc_avg = FLOAT ; state of polarization rate of change avg |
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.
@longhuan-cisco 'evm_min/avg/max' is missing
…onic-net#315) * Add get_transceiver_status to API interface * Add test_ccmis support * Add get_transceiver_pm API interface * Add debug log and more description for interface * Remove unnecessary pass
PR sonic-net/sonic-platform-daemons#304 has a dependency on this PR, it has already been included in 202211, this PR shall also be cherry-picked to 202211, otherwise, 202211 will be broken. @prgeor @longhuan-cisco @StormLiangMS |
Add get_transceiver_status and get_transceiver_pm to API interface
Description
Motivation and Context
How Has This Been Tested?
Plz refer to parent PR for UT.
Additional Information (Optional)