sonic-utilities
sonic-utilities copied to clipboard
sfputil CLI broken on master/202305 for multi-asic platforms
Description
On 202305 multi-asic platforms, sfpuil CLI (basically any sub-command under sfputil) always bails out for below error:
# sfputil show presence
Error reading port info (:- validateNamespace: Initialize global DB config using API SonicDBConfig::initializeGlobalConfig)
Looks like, this is related to PR [portconfig]: Remove try exception during config_db initialization. by SuvarnaMeenakshi · Pull Request #10960 · sonic-net/sonic-buildimage Basically this PR removed the initialization of global DB config from portconfig.py lib and expects application code to do it, however here the application (sfputil/sfputilhelper) didn’t get updated accordingly to do the initialization, thus error happened Error reading port info (:- validateNamespace: Initialize global DB config using API
And I tried reverting this PR’s change on 202305 setup, then issue was gone.
And this issue is specific to platforms with multi-asic/namespace. For single-asic platforms, there’s no global DB config (/run/redis/sonic-db/database_global.json), no need to initialize. PR #10960 (merged on late 2022) is included in master and 202305 branches, but not included in 202205 branch, that’s why issue not seen on 202205 image.
202205: https://github.com/sonic-net/sonic-buildimage/blob/202205/src/sonic-config-engine/portconfig.py#L77 202305: https://github.com/sonic-net/sonic-buildimage/blob/202305/src/sonic-config-engine/portconfig.py#L75
Steps to reproduce the issue
Do any sfputil CLI (e.g. sfputil show presence
)
Describe the results you received
# sfputil show presence
Error reading port info (:- validateNamespace: Initialize global DB config using API SonicDBConfig::initializeGlobalConfig)
Describe the results you expected
Actual contents of sfputil commands. e.g. sfputil show presence
should show the presence status for each ports
Additional information you deem important (e.g. issue happens only occasionally)
Output of show version
(paste your output here)