From 260cf2dedb74880a44713b2b37cae6595caeb445 Mon Sep 17 00:00:00 2001 From: vdahiya12 <67608553+vdahiya12@users.noreply.github.com> Date: Mon, 22 Mar 2021 12:26:45 -0700 Subject: [PATCH] [xcvrd] change firmware information fields name inside MUX_CABLE_INFO table for Y cable (#165) This PR fixes the naming convention for firmware related fields for Y cable. In particular all the fields are now named as tor_self and tor_peer in place of tor1 and tor 2 Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com Description This PR fixes the naming convention for firmware related fields for Y cable. In particular all the fields are now named as tor_self and tor_peer in place of tor1 and tor 2 Motivation and Context Required by telemetry team as part of their initial schema Signed-off-by: vaibhav-dahiya --- sonic-xcvrd/tests/test_xcvrd.py | 40 ++++++++-------- .../xcvrd/xcvrd_utilities/y_cable_helper.py | 48 ++++++++++--------- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/sonic-xcvrd/tests/test_xcvrd.py b/sonic-xcvrd/tests/test_xcvrd.py index a560de82da22..36140a14c5f5 100644 --- a/sonic-xcvrd/tests/test_xcvrd.py +++ b/sonic-xcvrd/tests/test_xcvrd.py @@ -252,26 +252,26 @@ def test_init_port_sfp_status_tbl(self): 'commit_slot2_nic': 'False', 'empty_slot1_nic': 'True', 'empty_slot2_nic': 'False', - 'build_slot1_tor1': 'MS', - 'build_slot2_tor1': 'MS', - 'version_slot1_tor1': '1.7', - 'version_slot2_tor1': '1.7', - 'run_slot1_tor1': 'True', - 'run_slot2_tor1': 'False', - 'commit_slot1_tor1': 'True', - 'commit_slot2_tor1': 'False', - 'empty_slot1_tor1': 'True', - 'empty_slot2_tor1': 'False', - 'build_slot1_tor2': 'MS', - 'build_slot2_tor2': 'MS', - 'version_slot1_tor2': '1.7', - 'version_slot2_tor2': '1.7', - 'run_slot1_tor2': 'True', - 'run_slot2_tor2': 'False', - 'commit_slot1_tor2': 'True', - 'commit_slot2_tor2': 'False', - 'empty_slot1_tor2': 'True', - 'empty_slot2_tor2': 'False'})) + 'build_slot1_tor_self': 'MS', + 'build_slot2_tor_self': 'MS', + 'version_slot1_tor_self': '1.7', + 'version_slot2_tor_self': '1.7', + 'run_slot1_tor_self': 'True', + 'run_slot2_tor_self': 'False', + 'commit_slot1_tor_self': 'True', + 'commit_slot2_tor_self': 'False', + 'empty_slot1_tor_self': 'True', + 'empty_slot2_tor_self': 'False', + 'build_slot1_tor_peer': 'MS', + 'build_slot2_tor_peer': 'MS', + 'version_slot1_tor_peer': '1.7', + 'version_slot2_tor_peer': '1.7', + 'run_slot1_tor_peer': 'True', + 'run_slot2_tor_peer': 'False', + 'commit_slot1_tor_peer': 'True', + 'commit_slot2_tor_peer': 'False', + 'empty_slot1_tor_peer': 'True', + 'empty_slot2_tor_peer': 'False'})) def test_post_port_mux_info_to_db(self): logical_port_name = "Ethernet0" mux_tbl = Table("STATE_DB", y_cable_helper.MUX_CABLE_INFO_TABLE) diff --git a/sonic-xcvrd/xcvrd/xcvrd_utilities/y_cable_helper.py b/sonic-xcvrd/xcvrd/xcvrd_utilities/y_cable_helper.py index 1953aa40f498..bd55bb64f30c 100644 --- a/sonic-xcvrd/xcvrd/xcvrd_utilities/y_cable_helper.py +++ b/sonic-xcvrd/xcvrd/xcvrd_utilities/y_cable_helper.py @@ -714,8 +714,12 @@ def get_muxcable_info(physical_port, logical_port_name): mux_info_dict["link_status_nic"] = "down" get_firmware_dict(physical_port, 0, "nic", mux_info_dict) - get_firmware_dict(physical_port, 1, "tor1", mux_info_dict) - get_firmware_dict(physical_port, 2, "tor2", mux_info_dict) + if read_side == 1: + get_firmware_dict(physical_port, 1, "tor_self", mux_info_dict) + get_firmware_dict(physical_port, 2, "tor_peer", mux_info_dict) + else: + get_firmware_dict(physical_port, 1, "tor_peer", mux_info_dict) + get_firmware_dict(physical_port, 2, "tor_self", mux_info_dict) res = y_cable.get_internal_voltage_temp(physical_port) @@ -885,26 +889,26 @@ def post_port_mux_info_to_db(logical_port_name, table): ('commit_slot2_nic', str(mux_info_dict["commit_slot2_nic"])), ('empty_slot1_nic', str(mux_info_dict["empty_slot1_nic"])), ('empty_slot2_nic', str(mux_info_dict["empty_slot2_nic"])), - ('build_slot1_tor1', str(mux_info_dict["build_slot1_tor1"])), - ('build_slot2_tor1', str(mux_info_dict["build_slot2_tor1"])), - ('version_slot1_tor1', str(mux_info_dict["version_slot1_tor1"])), - ('version_slot2_tor1', str(mux_info_dict["version_slot2_tor1"])), - ('run_slot1_tor1', str(mux_info_dict["run_slot1_tor1"])), - ('run_slot2_tor1', str(mux_info_dict["run_slot2_tor1"])), - ('commit_slot1_tor1', str(mux_info_dict["commit_slot1_tor1"])), - ('commit_slot2_tor1', str(mux_info_dict["commit_slot2_tor1"])), - ('empty_slot1_tor1', str(mux_info_dict["empty_slot1_tor1"])), - ('empty_slot2_tor1', str(mux_info_dict["empty_slot2_tor1"])), - ('build_slot1_tor2', str(mux_info_dict["build_slot1_tor2"])), - ('build_slot2_tor2', str(mux_info_dict["build_slot2_tor2"])), - ('version_slot1_tor2', str(mux_info_dict["version_slot1_tor2"])), - ('version_slot2_tor2', str(mux_info_dict["version_slot2_tor2"])), - ('run_slot1_tor2', str(mux_info_dict["run_slot1_tor2"])), - ('run_slot2_tor2', str(mux_info_dict["run_slot2_tor2"])), - ('commit_slot1_tor2', str(mux_info_dict["commit_slot1_tor2"])), - ('commit_slot2_tor2', str(mux_info_dict["commit_slot2_tor2"])), - ('empty_slot1_tor2', str(mux_info_dict["empty_slot1_tor2"])), - ('empty_slot2_tor2', str(mux_info_dict["empty_slot2_tor2"])) + ('build_slot1_tor_self', str(mux_info_dict["build_slot1_tor_self"])), + ('build_slot2_tor_self', str(mux_info_dict["build_slot2_tor_self"])), + ('version_slot1_tor_self', str(mux_info_dict["version_slot1_tor_self"])), + ('version_slot2_tor_self', str(mux_info_dict["version_slot2_tor_self"])), + ('run_slot1_tor_self', str(mux_info_dict["run_slot1_tor_self"])), + ('run_slot2_tor_self', str(mux_info_dict["run_slot2_tor_self"])), + ('commit_slot1_tor_self', str(mux_info_dict["commit_slot1_tor_self"])), + ('commit_slot2_tor_self', str(mux_info_dict["commit_slot2_tor_self"])), + ('empty_slot1_tor_self', str(mux_info_dict["empty_slot1_tor_self"])), + ('empty_slot2_tor_self', str(mux_info_dict["empty_slot2_tor_self"])), + ('build_slot1_tor_peer', str(mux_info_dict["build_slot1_tor_peer"])), + ('build_slot2_tor_peer', str(mux_info_dict["build_slot2_tor_peer"])), + ('version_slot1_tor_peer', str(mux_info_dict["version_slot1_tor_peer"])), + ('version_slot2_tor_peer', str(mux_info_dict["version_slot2_tor_peer"])), + ('run_slot1_tor_peer', str(mux_info_dict["run_slot1_tor_peer"])), + ('run_slot2_tori_peer', str(mux_info_dict["run_slot2_tor_peer"])), + ('commit_slot1_tor_peer', str(mux_info_dict["commit_slot1_tor_peer"])), + ('commit_slot2_tor_peer', str(mux_info_dict["commit_slot2_tor_peer"])), + ('empty_slot1_tor_peer', str(mux_info_dict["empty_slot1_tor_peer"])), + ('empty_slot2_tor_peer', str(mux_info_dict["empty_slot2_tor_peer"])) ]) table.set(logical_port_name, fvs) else: