Skip to content

Commit 872f0a3

Browse files
authored
[Y-Cable] refactor get_firmware_version to comply with all vendors (sonic-net#182)
Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com This PR refactors the get_firmware_version output to return the following fields for each target. { "version_active": "", "version_inactive": "", "version_next": "", } Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
1 parent cc162d6 commit 872f0a3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sonic_y_cable/y_cable.py

+12
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,10 @@ def get_firmware_version(physical_port, target):
12241224
build_slot2 = chr(rev_build_lsb_slot2) + chr(rev_build_msb_slot2)
12251225
version_slot2 = str(rev_major_slot2) + "." + str(rev_minor_slot2)
12261226

1227+
'''TODO: the fields with slot number as suffix are redundant and must
1228+
be removed eventually since they are covered by the fields which
1229+
have version as prefix. '''
1230+
12271231
result["build_slot1"] = build_slot1
12281232
result["version_slot1"] = version_slot1
12291233
result["build_slot2"] = build_slot2
@@ -1235,6 +1239,14 @@ def get_firmware_version(physical_port, target):
12351239
result["empty_slot1"] = True if slot_status & 0x04 else False
12361240
result["empty_slot2"] = True if slot_status & 0x40 else False
12371241

1242+
version_build_slot1 = version_slot1 + build_slot1
1243+
version_build_slot2 = version_slot2 + build_slot2
1244+
1245+
result["version_active"] = version_build_slot1 if slot_status & 0x01 else version_build_slot2
1246+
result["version_inactive"] = version_build_slot2 if slot_status & 0x01 else version_build_slot1
1247+
result["version_next"] = version_build_slot1 if slot_status & 0x02 else version_build_slot2
1248+
1249+
12381250
return result
12391251

12401252

0 commit comments

Comments
 (0)