From f81409023ef5e8666063858b8d5a8b2625929beb Mon Sep 17 00:00:00 2001 From: mihirpat1 <112018033+mihirpat1@users.noreply.github.com> Date: Thu, 25 Apr 2024 10:28:32 -0700 Subject: [PATCH] Display target firmware version through CLI (#3274) Signed-off-by: Mihir Patel --- scripts/sfpshow | 3 +++ tests/mock_tables/asic1/state_db.json | 8 +++++++- tests/mock_tables/state_db.json | 8 +++++++- tests/sfp_test.py | 18 ++++++++++++++++++ utilities_common/sfp_helper.py | 8 +++++++- 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/scripts/sfpshow b/scripts/sfpshow index 85e8d8a1f1..8312344513 100755 --- a/scripts/sfpshow +++ b/scripts/sfpshow @@ -335,6 +335,9 @@ class SFPShow(object): output += covert_application_advertisement_to_output_string(indent, sfp_info_dict) elif key == 'active_firmware' or key == 'inactive_firmware': output += '{}{}: {}\n'.format(indent, data_map[key], sfp_firmware_info_dict[key] if key in sfp_firmware_info_dict else 'N/A') + elif key.startswith(('e1_', 'e2_')): + if key in sfp_firmware_info_dict: + output += '{}{}: {}\n'.format(indent, data_map[key], sfp_firmware_info_dict[key]) else: output += '{}{}: {}\n'.format(indent, data_map[key], sfp_info_dict[key]) diff --git a/tests/mock_tables/asic1/state_db.json b/tests/mock_tables/asic1/state_db.json index 195b8e87f3..dd76cb7f50 100644 --- a/tests/mock_tables/asic1/state_db.json +++ b/tests/mock_tables/asic1/state_db.json @@ -70,7 +70,13 @@ }, "TRANSCEIVER_FIRMWARE_INFO|Ethernet64": { "active_firmware": "X.X", - "inactive_firmware": "X.X" + "inactive_firmware": "X.X", + "e1_active_firmware" : "X.X", + "e1_inactive_firmware" : "Y.Y", + "e1_server_firmware" : "A.B.C.D", + "e2_active_firmware" : "X.X", + "e2_inactive_firmware" : "Y.Y", + "e2_server_firmware" : "A.B.C.D" }, "CHASSIS_INFO|chassis 1": { "psu_num": "2" diff --git a/tests/mock_tables/state_db.json b/tests/mock_tables/state_db.json index f90d3f9e68..55dc67fbef 100644 --- a/tests/mock_tables/state_db.json +++ b/tests/mock_tables/state_db.json @@ -692,7 +692,13 @@ }, "TRANSCEIVER_FIRMWARE_INFO|Ethernet64": { "active_firmware": "X.X", - "inactive_firmware": "X.X" + "inactive_firmware": "X.X", + "e1_active_firmware" : "X.X", + "e1_inactive_firmware" : "Y.Y", + "e1_server_firmware" : "A.B.C.D", + "e2_active_firmware" : "X.X", + "e2_inactive_firmware" : "Y.Y", + "e2_server_firmware" : "A.B.C.D" }, "TRANSCEIVER_INFO|Ethernet72": { "active_apsel_hostlane4": "N/A", diff --git a/tests/sfp_test.py b/tests/sfp_test.py index 22eda401e5..02bce83f5a 100644 --- a/tests/sfp_test.py +++ b/tests/sfp_test.py @@ -600,6 +600,12 @@ 100GAUI-2 C2M (Annex 135G) - Host Assign (0x55) - 400ZR, DWDM, amplified - Media Assign (0x1) CMIS Rev: 4.1 Connector: LC + E1 Active Firmware: X.X + E1 Inactive Firmware: Y.Y + E1 Server Firmware: A.B.C.D + E2 Active Firmware: X.X + E2 Inactive Firmware: Y.Y + E2 Server Firmware: A.B.C.D Encoding: N/A Extended Identifier: Power Class 8 (20.0W Max) Extended RateSelect Compliance: N/A @@ -690,6 +696,12 @@ 100GAUI-2 C2M (Annex 135G) - Host Assign (0x55) - 400ZR, DWDM, amplified - Media Assign (0x1) CMIS Rev: 4.1 Connector: LC + E1 Active Firmware: X.X + E1 Inactive Firmware: Y.Y + E1 Server Firmware: A.B.C.D + E2 Active Firmware: X.X + E2 Inactive Firmware: Y.Y + E2 Server Firmware: A.B.C.D Encoding: N/A Extended Identifier: Power Class 8 (20.0W Max) Extended RateSelect Compliance: N/A @@ -780,6 +792,12 @@ 100GAUI-2 C2M (Annex 135G) - Host Assign (0x55) - 400ZR, DWDM, amplified - Media Assign (0x1) CMIS Rev: 4.1 Connector: LC + E1 Active Firmware: X.X + E1 Inactive Firmware: Y.Y + E1 Server Firmware: A.B.C.D + E2 Active Firmware: X.X + E2 Inactive Firmware: Y.Y + E2 Server Firmware: A.B.C.D Encoding: N/A Extended Identifier: Power Class 8 (20.0W Max) Extended RateSelect Compliance: N/A diff --git a/utilities_common/sfp_helper.py b/utilities_common/sfp_helper.py index 4a6ad65b57..e38e764c9c 100644 --- a/utilities_common/sfp_helper.py +++ b/utilities_common/sfp_helper.py @@ -38,7 +38,13 @@ 'supported_max_tx_power': 'Supported Max TX Power', 'supported_min_tx_power': 'Supported Min TX Power', 'supported_max_laser_freq': 'Supported Max Laser Frequency', - 'supported_min_laser_freq': 'Supported Min Laser Frequency' + 'supported_min_laser_freq': 'Supported Min Laser Frequency', + 'e1_active_firmware': 'E1 Active Firmware', + 'e1_inactive_firmware': 'E1 Inactive Firmware', + 'e1_server_firmware': 'E1 Server Firmware', + 'e2_active_firmware': 'E2 Active Firmware', + 'e2_inactive_firmware': 'E2 Inactive Firmware', + 'e2_server_firmware': 'E2 Server Firmware' } CMIS_DATA_MAP = {**QSFP_DATA_MAP, **QSFP_CMIS_DELTA_DATA_MAP}