Skip to content

Commit

Permalink
Strip null bytes from parsed eeprom data before writing to db (#20512)
Browse files Browse the repository at this point in the history
Why I did it
This was failing sonic-mgmt test test_syseepromd due to a setup error on account of null bytes being parsed from the S6000 eeprom.

This is due to differences in the way sonic-db-cli handles null values in the part number as parsed by the EEPROM in the 202012 image vs 202205+ image versions:

How I did it
Added logic to strip null bytes from parsed data before writing to database.

How to verify it
Run the aforementioned sonic-mgmt test before and after making the change in this PR -- note that test fails on setup without the change. See attached logs.
s6000_test_syseepromd_logs.txt

Flashed image with this change on an S6000 device and ran the above sonic-mgmt test:
  • Loading branch information
assrinivasan authored and mssonicbld committed Oct 25, 2024
1 parent cffe04f commit 6395ac0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def update_eeprom_db(self, e):
data = ":".join(["{:02x}".format(T) for T in e[offset:offset+f[1]]]).upper()
else:
data = e[offset:offset+f[1]].decode('ascii')
client.hset('EEPROM_INFO|{}'.format(f[0]), 'Value', data)
client.hset('EEPROM_INFO|{}'.format(f[0]), 'Value', data.strip('\x00'))
offset += f[1]

if not self._is_valid_block_checksum(e[blk_start:blk_end]):
Expand Down

0 comments on commit 6395ac0

Please sign in to comment.