sonic-platform-daemons
sonic-platform-daemons copied to clipboard
Add new fields to status/dom_sensor/pm tables in STATE_DB for CMIS/C-CMIS
Add new fields to status/dom_sensor/pm tables in STATE_DB for CMIS/C-CMIS
Description
- Add all the fields that are supported by c_cmis get_transceiver_bulk_status API but not currently present to dom_sensor table.
- Add new fields (provided by cmis.py:get_transceiver_status() API and c_cmis.py:get_transceiver_status() API ) to status table(TRANSCEIVER_STATUS). following SW fields(non-eeprom-fetched) are already present in today's status table:
status = 1*255VCHAR ; code of the module status (plug in, plug out)
error = 1*255VCHAR ; module error (N/A or a string consisting of error descriptions joined by "|", like "error1 | error2" )
following HW fields (eeprom-fetched) are added per this HLD (this is just snippet, refer to HLD for complete list):
module_state = 1*255VCHAR ; current module state (ModuleLowPwr, ModulePwrUp, ModuleReady, ModulePwrDn, Fault)
module_fault_cause = 1*255VCHAR ; reason of entering the module fault state
datapath_firmware_fault = BOOLEAN ; datapath (DSP) firmware fault
module_firmware_fault = BOOLEAN ; module firmware fault
module_state_changed = BOOLEAN ; module state changed
datapath_hostlane1 = 1*255VCHAR ; data path state indicator on host lane 1
......
rxsigpowerhighwarning_flag = BOOLEAN ; rxsigpower high warning flag
rxsigpowerlowwarning_flag = BOOLEAN ; rxsigpower low warning flag
- Add pm related fields to a newly created table TRANSCEIVER_PM in STATE_DB. (DB schema is defined in this HLD
- Add corresponding DB update/delete handling along the xcvrd flow.
- Add/modify test cases on test_xcvrd.py to cover newly added code.
Here's the entire DB schema of status tbl and dom_sensor tbl, according to the new HLD from PR https://github.com/sonic-net/SONiC/pull/1076
Motivation and Context
How Has This Been Tested?
Verified on CMIS/C-CMIS optics, interfaces come up fine, and new fields show up in DB
UT output for dom_sensor table: dom_sensor_tbl_ut_output.txt
UT output for status table: status_tbl_ut_output.txt
UT output for status table in xcvrd restart case: xcvrd_restart_test.txt
UT output for pm table: pm_table_output.txt
UT output for pm table in xcvrd restart case: xcvrd_restart_test_pm_tbl.txt
UT result for test_xcvrd.py: ut_w_coverage.txt
Additional Information (Optional)
Note Please don't merge this PR until the dependency PR https://github.com/sonic-net/sonic-platform-common/pull/315 gets merged.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: longhuan-cisco (172255fc8ad49c4fd0f6bf542896a58d9d8b9404, 6e7e83895a74af8c39e8e45bb5f56afb9ff953d4, ed0a9f18f21751e83d8e213cb7da0dbc1fc5993a)
@prgeor please review (couldn't add to reviewers list directly, thus add here)
Can you please also test restarting xcvrd to ensure that the table gets deleted and updated accordingly
Yea Attached restart test log in description.
@prgeor @mihirpat1 I took care of the existing comments, can you please review?
Added pm table related change, to use this PR to track changes for all three tables: status/dom_sensor/pm. (Since they all touch the similar flow in xcvrd, and some is dependent on another, it would be good to combine them together.) @prgeor @mihirpat1 Could you please take another look?
This pull request introduces 1 alert when merging 4e308504c934f046100c3fa11c7141db59c5be02 into adcd69beb637aaf109573582a96bdeca82c8d1f0 - view on LGTM.com
new alerts:
- 1 for Mismatch in multiple assignment
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 :gear: that powers LGTM.com. For more information, please check out our post on the GitHub blog.
@yxieca please cherry-pick to 202205
@longhuan-cisco this change cannot be cherry-picked to 202205 cleanly. Please raise separate PR. Thanks!
@StormLiangMS please help cherry-pick to 202211
@prgeor I suppose you want to have this one in 202211 other than 202111