sonic-net / sonic-platform-daemons

Platform module daemons for SONiC
Other
25 stars 159 forks source link

Enable periodic polling of TRANSCEIVER_FIRMWARE_INFO table in DomInfoUpdateTask #443

Closed mihirpat1 closed 8 months ago

mihirpat1 commented 9 months ago

MSFT ADO - 26801871

Description

We need to enable periodic update of TRANSCEIVER_FIRMWARE_INFO table so that the active_firmware and inactive_firmware fields are periodically updated in the redis-db. Periodic polling of firmware version will enable XCVRD to update firmware version for all breakout ports of a physical port after performing firmware upgrade using any one of the breakout port.

Also, a new CLI (config interface transceiver dom PORT_NAME enable/disable) has been created to allow user enable/disable DOM monitoring. XCVRD needs to handle this CLI so that periodic polling through DomInfoUpdateTask thread is enabled/disabled for a particular port. The new CLI will set dom_polling field in PORT|\<logical_port> table of CONFIG_DB. The possible values of this field are enabled and disabled Please refer to https://github.com/sonic-net/sonic-utilities/pull/3187 for further details.

Note for DOM config CLI execution on breakout ports While handling the first subport of a physical port, DomInfoUpdateTask thread will read data from EEPROM and update firmware_info_cache. All other subports of the physical ports will have the data retrieved from firmware_info_cache in that iteration. Hence, we need to ensure that user always disables DOM monitoring through the CLI only for the first subport (even though, the user is accessing CDB commands using subport > 1).

DOM monitoring should be disabled before executing sfputil show fwversion PORT_NAME to ensure that DomInfoUpdateTask thread does not send a CDB command parallelly to retrieve the FW version.

Motivation and Context

How Has This Been Tested?

Following are the testcases which were tested and passed successfully

1   Device with non-breakout ports
1.1 Disable DOM monitoring for port
1.2 Enable DOM monitoring for port
2   Device with breakout ports
2.1 Disable DOM monitoring for subport 1
2.2 Enable DOM monitoring for subport 1
2.3 Disable DOM monitoring for subport 2
2.4 Enable DOM monitoring for subport 2
3   Multi-asic device - The CLI handler in xcvrd was not tested since all the available multi-asic devices currently support 202205 image and the TRANSCEIVER_FIRMWARE_INFO table is supported 202305 image onwards.
4   Firmware upgrade
5   Help options for DOM CLI
sonic:/home/admin# config interface transceiver dom --help
Usage: config interface transceiver dom [OPTIONS] <interface_name>
                                        (enable|disable)

  Enable/disable DOM monitoring for SFP transceiver module

Options:
  -?, -h, --help  Show this message and exit.

Additional Information (Optional)

prgeor commented 9 months ago

@keboliu can you review

mihirpat1 commented 8 months ago

@StormLiangMS - I have created the below PR for 202305 cherry-pick. It will be great if you can help in merging it. https://github.com/sonic-net/sonic-platform-daemons/pull/445

MSFT ADO - 26801871

mssonicbld commented 8 months ago

Cherry-pick PR to 202311: https://github.com/sonic-net/sonic-platform-daemons/pull/448