Skip to content

Commit 3d3bc1a

Browse files
xinyulinprgeor
andauthored
[Credo][Ycable] Fix for displaying 'N/A' firmware version when NIC endpoint is power off (sonic-net#366)
* [Credo][Ycable] Resolve the issue of being unable to obtain the firmware version of the self-side when the NIC end is power off Signed-off-by: Xinyu <xinyu0123@gmail.com> * [Credo][Ycable] call get_read_side() to handle exceptions Signed-off-by: Xinyu <xinyu0123@gmail.com> * [Credo][Ycable] Replace the hard-coded value with a constant variable for readability Signed-off-by: Xinyu <xinyu0123@gmail.com> --------- Signed-off-by: Xinyu <xinyu0123@gmail.com> Co-authored-by: Prince George <45705344+prgeor@users.noreply.github.com>
1 parent 0dafb55 commit 3d3bc1a

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

sonic_y_cable/credo/y_cable_credo.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,12 @@ def get_firmware_version(self, target):
14611461
14621462
"""
14631463
if self.platform_chassis is not None:
1464+
read_side = self.get_read_side()
1465+
1466+
if read_side == YCable.EEPROM_ERROR:
1467+
self.log_error('Fail to get read side in get_firmware_version()')
1468+
return None
1469+
14641470
with self.rlock.acquire_timeout(RLocker.ACQUIRE_LOCK_TIMEOUT) as lock_status:
14651471
if lock_status:
14661472
vsc_req_form = [None] * (YCable.VSC_CMD_ATTRIBUTE_LENGTH)
@@ -1469,8 +1475,12 @@ def get_firmware_version(self, target):
14691475
status = self.send_vsc(vsc_req_form)
14701476

14711477
if status != YCable.MCU_EC_NO_ERROR:
1472-
self.log_error('Get firmware version error (error code:0x%04X)' % (status))
1473-
return None
1478+
''' should at least return local side fw version if nic is offline'''
1479+
if status == YCable.MCU_EC_FWUPD_UART_TIMEOUT and (read_side == target):
1480+
pass
1481+
else:
1482+
self.log_error('Get firmware version error (error code:0x%04X)' % (status))
1483+
return None
14741484

14751485
data = bytearray(YCable.FIRMWARE_INFO_PAYLOAD_SIZE)
14761486
for byte_idx in range(0, YCable.FIRMWARE_INFO_PAYLOAD_SIZE):

0 commit comments

Comments
 (0)