sonic-telemetry
sonic-telemetry copied to clipboard
Pfcwd path fix
Changes made to virtual_db.go to fix the Pfcwd redis data path. I fixed the table name, updated the count used to get port number accordingly, and added if statment to filter out smaller keys like PFC_WD|Global.
Based on the current code in the Sonic-telemetry repo, the original expected path for the PFC_WD keys was PFC_WD_TABLE: https://github.com/Azure/sonic-telemetry/blob/master/sonic_data_client/virtual_db.go#L133. This change was made back when warm boot support was added to SONiC-swss-common, the table name for Pfcwd was changed from PFC_WD_TABLE to PFC_WD. So this changed caused the COUNTERS/Ethernet*/Pfcwd command to look for the ports listed with the PFC_WD_TABLE key which always returned nothing given that it no longer exists. Changing the length then caused line 147 (https://github.com/Azure/sonic-telemetry/blob/master/sonic_data_client/virtual_db.go#L147) to fail to get the proper port number from the keys because the removing the first 14 characters parsed to et## instead of the intended ##.