Skip to content

Commit 260cf2d

Browse files
authored
[xcvrd] change firmware information fields name inside MUX_CABLE_INFO table for Y cable (sonic-net#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 [email protected] 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 <[email protected]>
1 parent cfa600f commit 260cf2d

File tree

2 files changed

+46
-42
lines changed

2 files changed

+46
-42
lines changed

sonic-xcvrd/tests/test_xcvrd.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -252,26 +252,26 @@ def test_init_port_sfp_status_tbl(self):
252252
'commit_slot2_nic': 'False',
253253
'empty_slot1_nic': 'True',
254254
'empty_slot2_nic': 'False',
255-
'build_slot1_tor1': 'MS',
256-
'build_slot2_tor1': 'MS',
257-
'version_slot1_tor1': '1.7',
258-
'version_slot2_tor1': '1.7',
259-
'run_slot1_tor1': 'True',
260-
'run_slot2_tor1': 'False',
261-
'commit_slot1_tor1': 'True',
262-
'commit_slot2_tor1': 'False',
263-
'empty_slot1_tor1': 'True',
264-
'empty_slot2_tor1': 'False',
265-
'build_slot1_tor2': 'MS',
266-
'build_slot2_tor2': 'MS',
267-
'version_slot1_tor2': '1.7',
268-
'version_slot2_tor2': '1.7',
269-
'run_slot1_tor2': 'True',
270-
'run_slot2_tor2': 'False',
271-
'commit_slot1_tor2': 'True',
272-
'commit_slot2_tor2': 'False',
273-
'empty_slot1_tor2': 'True',
274-
'empty_slot2_tor2': 'False'}))
255+
'build_slot1_tor_self': 'MS',
256+
'build_slot2_tor_self': 'MS',
257+
'version_slot1_tor_self': '1.7',
258+
'version_slot2_tor_self': '1.7',
259+
'run_slot1_tor_self': 'True',
260+
'run_slot2_tor_self': 'False',
261+
'commit_slot1_tor_self': 'True',
262+
'commit_slot2_tor_self': 'False',
263+
'empty_slot1_tor_self': 'True',
264+
'empty_slot2_tor_self': 'False',
265+
'build_slot1_tor_peer': 'MS',
266+
'build_slot2_tor_peer': 'MS',
267+
'version_slot1_tor_peer': '1.7',
268+
'version_slot2_tor_peer': '1.7',
269+
'run_slot1_tor_peer': 'True',
270+
'run_slot2_tor_peer': 'False',
271+
'commit_slot1_tor_peer': 'True',
272+
'commit_slot2_tor_peer': 'False',
273+
'empty_slot1_tor_peer': 'True',
274+
'empty_slot2_tor_peer': 'False'}))
275275
def test_post_port_mux_info_to_db(self):
276276
logical_port_name = "Ethernet0"
277277
mux_tbl = Table("STATE_DB", y_cable_helper.MUX_CABLE_INFO_TABLE)

sonic-xcvrd/xcvrd/xcvrd_utilities/y_cable_helper.py

+26-22
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,12 @@ def get_muxcable_info(physical_port, logical_port_name):
714714
mux_info_dict["link_status_nic"] = "down"
715715

716716
get_firmware_dict(physical_port, 0, "nic", mux_info_dict)
717-
get_firmware_dict(physical_port, 1, "tor1", mux_info_dict)
718-
get_firmware_dict(physical_port, 2, "tor2", mux_info_dict)
717+
if read_side == 1:
718+
get_firmware_dict(physical_port, 1, "tor_self", mux_info_dict)
719+
get_firmware_dict(physical_port, 2, "tor_peer", mux_info_dict)
720+
else:
721+
get_firmware_dict(physical_port, 1, "tor_peer", mux_info_dict)
722+
get_firmware_dict(physical_port, 2, "tor_self", mux_info_dict)
719723

720724
res = y_cable.get_internal_voltage_temp(physical_port)
721725

@@ -885,26 +889,26 @@ def post_port_mux_info_to_db(logical_port_name, table):
885889
('commit_slot2_nic', str(mux_info_dict["commit_slot2_nic"])),
886890
('empty_slot1_nic', str(mux_info_dict["empty_slot1_nic"])),
887891
('empty_slot2_nic', str(mux_info_dict["empty_slot2_nic"])),
888-
('build_slot1_tor1', str(mux_info_dict["build_slot1_tor1"])),
889-
('build_slot2_tor1', str(mux_info_dict["build_slot2_tor1"])),
890-
('version_slot1_tor1', str(mux_info_dict["version_slot1_tor1"])),
891-
('version_slot2_tor1', str(mux_info_dict["version_slot2_tor1"])),
892-
('run_slot1_tor1', str(mux_info_dict["run_slot1_tor1"])),
893-
('run_slot2_tor1', str(mux_info_dict["run_slot2_tor1"])),
894-
('commit_slot1_tor1', str(mux_info_dict["commit_slot1_tor1"])),
895-
('commit_slot2_tor1', str(mux_info_dict["commit_slot2_tor1"])),
896-
('empty_slot1_tor1', str(mux_info_dict["empty_slot1_tor1"])),
897-
('empty_slot2_tor1', str(mux_info_dict["empty_slot2_tor1"])),
898-
('build_slot1_tor2', str(mux_info_dict["build_slot1_tor2"])),
899-
('build_slot2_tor2', str(mux_info_dict["build_slot2_tor2"])),
900-
('version_slot1_tor2', str(mux_info_dict["version_slot1_tor2"])),
901-
('version_slot2_tor2', str(mux_info_dict["version_slot2_tor2"])),
902-
('run_slot1_tor2', str(mux_info_dict["run_slot1_tor2"])),
903-
('run_slot2_tor2', str(mux_info_dict["run_slot2_tor2"])),
904-
('commit_slot1_tor2', str(mux_info_dict["commit_slot1_tor2"])),
905-
('commit_slot2_tor2', str(mux_info_dict["commit_slot2_tor2"])),
906-
('empty_slot1_tor2', str(mux_info_dict["empty_slot1_tor2"])),
907-
('empty_slot2_tor2', str(mux_info_dict["empty_slot2_tor2"]))
892+
('build_slot1_tor_self', str(mux_info_dict["build_slot1_tor_self"])),
893+
('build_slot2_tor_self', str(mux_info_dict["build_slot2_tor_self"])),
894+
('version_slot1_tor_self', str(mux_info_dict["version_slot1_tor_self"])),
895+
('version_slot2_tor_self', str(mux_info_dict["version_slot2_tor_self"])),
896+
('run_slot1_tor_self', str(mux_info_dict["run_slot1_tor_self"])),
897+
('run_slot2_tor_self', str(mux_info_dict["run_slot2_tor_self"])),
898+
('commit_slot1_tor_self', str(mux_info_dict["commit_slot1_tor_self"])),
899+
('commit_slot2_tor_self', str(mux_info_dict["commit_slot2_tor_self"])),
900+
('empty_slot1_tor_self', str(mux_info_dict["empty_slot1_tor_self"])),
901+
('empty_slot2_tor_self', str(mux_info_dict["empty_slot2_tor_self"])),
902+
('build_slot1_tor_peer', str(mux_info_dict["build_slot1_tor_peer"])),
903+
('build_slot2_tor_peer', str(mux_info_dict["build_slot2_tor_peer"])),
904+
('version_slot1_tor_peer', str(mux_info_dict["version_slot1_tor_peer"])),
905+
('version_slot2_tor_peer', str(mux_info_dict["version_slot2_tor_peer"])),
906+
('run_slot1_tor_peer', str(mux_info_dict["run_slot1_tor_peer"])),
907+
('run_slot2_tori_peer', str(mux_info_dict["run_slot2_tor_peer"])),
908+
('commit_slot1_tor_peer', str(mux_info_dict["commit_slot1_tor_peer"])),
909+
('commit_slot2_tor_peer', str(mux_info_dict["commit_slot2_tor_peer"])),
910+
('empty_slot1_tor_peer', str(mux_info_dict["empty_slot1_tor_peer"])),
911+
('empty_slot2_tor_peer', str(mux_info_dict["empty_slot2_tor_peer"]))
908912
])
909913
table.set(logical_port_name, fvs)
910914
else:

0 commit comments

Comments
 (0)