Skip to content

Commit 0e31af1

Browse files
committed
Addressed review comments
1 parent 491e21f commit 0e31af1

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

sonic-xcvrd/tests/test_xcvrd.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -452,17 +452,17 @@ def test_CmisManagerTask_get_configured_freq(self, mock_table_helper):
452452
cfg_port_tbl.get = MagicMock(return_value=(True, (('laser_freq', 193100),)))
453453
mock_table_helper.get_cfg_port_tbl = MagicMock(return_value=cfg_port_tbl)
454454
task.xcvr_table_helper.get_cfg_port_tbl = mock_table_helper.get_cfg_port_tbl
455-
assert task.get_configured_laser_freq('Ethernet0') == 193100
455+
assert task.get_configured_laser_freq_from_db('Ethernet0') == 193100
456456

457457
@patch('xcvrd.xcvrd.XcvrTableHelper')
458-
def test_CmisManagerTask_get_configured_tx_power(self, mock_table_helper):
458+
def test_CmisManagerTask_get_configured_tx_power_from_db(self, mock_table_helper):
459459
port_mapping = PortMapping()
460460
task = CmisManagerTask(DEFAULT_NAMESPACE, port_mapping)
461461
cfg_port_tbl = MagicMock()
462462
cfg_port_tbl.get = MagicMock(return_value=(True, (('tx_power', -10),)))
463463
mock_table_helper.get_cfg_port_tbl = MagicMock(return_value=cfg_port_tbl)
464464
task.xcvr_table_helper.get_cfg_port_tbl = mock_table_helper.get_cfg_port_tbl
465-
assert task.get_configured_tx_power('Ethernet0') == -10
465+
assert task.get_configured_tx_power_from_db('Ethernet0') == -10
466466

467467
@patch('xcvrd.xcvrd.platform_chassis')
468468
@patch('xcvrd.xcvrd_utilities.port_mapping.subscribe_port_update_event', MagicMock(return_value=(None, None)))
@@ -575,8 +575,8 @@ def test_CmisManagerTask_task_worker(self, mock_chassis):
575575

576576
task.get_host_tx_status = MagicMock(return_value='true')
577577
task.get_port_admin_status = MagicMock(return_value='up')
578-
task.get_configured_tx_power = MagicMock(return_value=-13)
579-
task.get_configured_laser_freq = MagicMock(return_value=193100)
578+
task.get_configured_tx_power_from_db = MagicMock(return_value=-13)
579+
task.get_configured_laser_freq_from_db = MagicMock(return_value=193100)
580580
task.configure_tx_output_power = MagicMock(return_value=1)
581581
task.configure_laser_frequency = MagicMock(return_value=1)
582582

sonic-xcvrd/xcvrd/xcvrd.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ def check_datapath_state(self, api, channel, states):
12071207

12081208
return done
12091209

1210-
def get_configured_laser_freq(self, lport):
1210+
def get_configured_laser_freq_from_db(self, lport):
12111211
"""
12121212
Return the Tx power configured by user in CONFIG_DB's PORT table
12131213
"""
@@ -1220,7 +1220,7 @@ def get_configured_laser_freq(self, lport):
12201220
freq = dict(port_info)['laser_freq']
12211221
return int(freq)
12221222

1223-
def get_configured_tx_power(self, lport):
1223+
def get_configured_tx_power_from_db(self, lport):
12241224
"""
12251225
Return the Tx power configured by user in CONFIG_DB's PORT table
12261226
"""
@@ -1362,13 +1362,12 @@ def task_worker(self):
13621362

13631363
if api.is_coherent_module():
13641364
if 'tx_power' not in self.port_dict[lport]:
1365-
self.port_dict[lport]['tx_power'] = self.get_configured_tx_power(lport)
1365+
self.port_dict[lport]['tx_power'] = self.get_configured_tx_power_from_db(lport)
13661366
if 'laser_freq' not in self.port_dict[lport]:
1367-
self.port_dict[lport]['laser_freq'] = self.get_configured_laser_freq(lport)
1367+
self.port_dict[lport]['laser_freq'] = self.get_configured_laser_freq_from_db(lport)
13681368
except AttributeError:
13691369
# Skip if these essential routines are not available
13701370
self.port_dict[lport]['cmis_state'] = self.CMIS_STATE_READY
1371-
assert 1 == 0
13721371
continue
13731372

13741373
# CMIS expiration and retries

0 commit comments

Comments
 (0)