diff --git a/show/muxcable.py b/show/muxcable.py index 6a94e7f7a..cf8403dfc 100644 --- a/show/muxcable.py +++ b/show/muxcable.py @@ -2177,7 +2177,7 @@ def get_grpc_cached_version_mux_direction_per_port(db, port): mux_info_full_dict[asic_index] = state_db[asic_index].get_all( state_db[asic_index].STATE_DB, 'MUX_CABLE_INFO|{}'.format(port)) trans_info_full_dict[asic_index] = state_db[asic_index].get_all( - state_db[asic_index].STATE_DB, 'TRANSCEIVER_STATUS|{}'.format(port)) + state_db[asic_index].STATE_DB, 'TRANSCEIVER_INFO|{}'.format(port)) or {} res_dir = {} res_dir = mux_info_full_dict[asic_index] @@ -2186,10 +2186,9 @@ def get_grpc_cached_version_mux_direction_per_port(db, port): mux_info_dict["grpc_connection_status"] = res_dir.get("grpc_connection_status", None) trans_dir = {} - trans_dir = trans_info_full_dict[asic_index] - - status = trans_dir.get("status", "0") - presence = "True" if status == "1" else "False" + trans_dir = trans_info_full_dict.get(asic_index, None) + + presence = "True" if trans_dir else "False" mux_info_dict["presence"] = presence diff --git a/tests/mock_tables/state_db.json b/tests/mock_tables/state_db.json index 85ca9797e..113009f1b 100644 --- a/tests/mock_tables/state_db.json +++ b/tests/mock_tables/state_db.json @@ -793,6 +793,23 @@ "status": "67", "error": "Blocking Error|High temperature" }, + "TRANSCEIVER_INFO|Ethernet4": { + "type": "SFP28 25G Pluggable Transceiver", + "hardware_rev": "X.X", + "serial": "0123456789", + "manufacturer": "XXXX", + "model": "XXX", + "connector": "LC", + "encoding": "N/A", + "ext_identifier": "Power Class 1 (0.5W Max)", + "ext_rateselect_compliance": "N/A", + "cable_type": "Length Cable Assembly(m)", + "cable_length": "0.0", + "nominal_bit_rate": "0", + "specification_compliance": "sm_media_interface", + "vendor_date": "2021-11-19", + "vendor_oui": "XX-XX-XX" + }, "TRANSCEIVER_STATUS|Ethernet4": { "status": "1", "error": "N/A", diff --git a/tests/muxcable_test.py b/tests/muxcable_test.py index 5d962a15b..d820598c1 100644 --- a/tests/muxcable_test.py +++ b/tests/muxcable_test.py @@ -390,7 +390,7 @@ show_muxcable_grpc_muxdirection_active_expected_all_output = """\ Port Direction Presence PeerDirection ConnectivityState --------- ----------- ---------- --------------- ------------------- -Ethernet0 active False active READY +Ethernet0 active True active READY """ show_muxcable_grpc_muxdirection_active_expected_all_output_json = """\ @@ -398,7 +398,7 @@ "HWMODE": { "Ethernet0": { "Direction": "active", - "Presence": "False", + "Presence": "True", "PeerDirection": "active", "ConnectivityState": "READY" }