Updated STATE_DB tables for c-cmis pm#856
Conversation
Signed-off-by: nkanchi-nexthop <nkanchi@nexthop.ai>
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
df23e1d to
958f0b4
Compare
|
/azp run |
|
Commenter does not have sufficient privileges for PR 856 in repo sonic-net/sonic-platform-daemons |
1 similar comment
|
Commenter does not have sufficient privileges for PR 856 in repo sonic-net/sonic-platform-daemons |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks! ---Powered by SONiC BuildBot
|
| # Raw FEC counter fields from get_transceiver_pm() that are published to the | ||
| # TRANSCEIVER_PM_COUNTERS table instead of TRANSCEIVER_PM. This is a positive list: | ||
| # any field not named here (calculated ratios, optical metrics) stays in TRANSCEIVER_PM. | ||
| PM_COUNTER_FIELDS = frozenset({ |
There was a problem hiding this comment.
@nkanchi-nexthop there are streaming telemetry applications already using these counters from TRANSCEIVER_PM so this change will break those. To maintain backward compatibility, I would suggest to not remove these fields from old PM table
There was a problem hiding this comment.
Pull request overview
This PR updates the sonic-xcvrd transceiver daemon’s STATE_DB publishing to split transceiver PM output into two tables: derived/processed PM metrics remain in TRANSCEIVER_PM, while raw FEC counter fields from get_transceiver_pm() are routed into a new TRANSCEIVER_PM_COUNTERS table. This aligns the DB schema with newer C-CMIS PM counter exposure while keeping the existing PM table focused on calculated metrics.
Changes:
- Add
TRANSCEIVER_PM_COUNTERStable support inXcvrTableHelper(per-ASIC table handle + accessor). - Split PM publishing in
DomInfoUpdateTask.post_port_pm_info_to_db()into metrics vs. raw counters, and pass both table handles from the caller. - Extend unit test coverage to validate PM vs. PM_COUNTERS routing behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| sonic-xcvrd/xcvrd/xcvrd_utilities/xcvr_table_helper.py | Adds a new PM counters table constant/handle and a getter used by DOM publishing paths. |
| sonic-xcvrd/xcvrd/dom/dom_mgr.py | Splits PM dict publishing into two tables and updates call sites / removal cleanup list accordingly. |
| sonic-xcvrd/tests/test_xcvrd.py | Updates unit test to assert raw counter fields land in TRANSCEIVER_PM_COUNTERS while derived fields remain in TRANSCEIVER_PM. |
| TRANSCEIVER_PM_TABLE = 'TRANSCEIVER_PM' | ||
| TRANSCEIVER_PM_COUNTERS_TABLE = 'TRANSCEIVER_PM_COUNTERS' | ||
| TRANSCEIVER_CMIS_STATE_TIMESTAMPS_TABLE = 'TRANSCEIVER_CMIS_STATE_TIMESTAMPS' | ||
|
|
| self.status_sw_tbl = {} | ||
| self.cmis_state_timestamps_tbl = {} | ||
| self.pm_counters_tbl = {} |
| def post_port_pm_info_to_db(self, logical_port_name, port_mapping, pm_table, pm_counters_table, stop_event=threading.Event(), pm_info_cache=None): | ||
| for physical_port, physical_port_name in common.get_physical_port_name_dict(logical_port_name, port_mapping).items(): | ||
| if stop_event.is_set(): | ||
| break |
| self.xcvr_table_helper.get_status_flag_change_count_tbl(port_change_event.asic_id), | ||
| self.xcvr_table_helper.get_status_flag_set_time_tbl(port_change_event.asic_id), | ||
| self.xcvr_table_helper.get_status_flag_clear_time_tbl(port_change_event.asic_id), | ||
| self.xcvr_table_helper.get_pm_tbl(port_change_event.asic_id), | ||
| self.xcvr_table_helper.get_pm_counters_tbl(port_change_event.asic_id), |
| pm_counters_tbl = Table("STATE_DB", TRANSCEIVER_PM_COUNTERS_TABLE) | ||
| assert pm_tbl.get_size() == 0 | ||
| dom_info_update.post_port_pm_info_to_db(logical_port_name, port_mapping, pm_tbl, stop_event) | ||
| assert pm_counters_tbl.get_size() == 0 | ||
| dom_info_update.post_port_pm_info_to_db(logical_port_name, port_mapping, pm_tbl, pm_counters_tbl, stop_event) | ||
| # Non-counter fields (6 preFEC ratios) go to TRANSCEIVER_PM. |
Description
TRANSCEIVER_PM_COUNTERSSTATE_DB table and routes raw FEC counter fields (page 34h counters and page 3Ah counters) fromget_transceiver_pm()into it, while calculated ratios and metrics stay inTRANSCEIVER_PM.xcvr_table_helper.py.PM_COUNTER_FIELDSset inpost_port_pm_info_to_db(dom_mgr.py), updates the caller to pass both table handles, and adds cleanup of the new table on logical port removal.Motivation and Context
TRANSCEIVER_PMwas only accumulating derived analog PM metrics (BER ratios, optical power/OSNR/etc.) from page 34h counters. Adding raw counters into their own table gives consumers a distinction between processed diagnostics and raw counters. Also, the new table gives a location for the new host counters from C-CMIS 1.4 page 3Ah.How Has This Been Tested?
tests/test_xcvrd.py), focusing ontest_post_port_pm_info_to_db(asserts non-counter fields land inTRANSCEIVER_PMand counter fields land inTRANSCEIVER_PM_COUNTERS).