Skip to content

Commit

Permalink
code rearrangement
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelWangSmci authored and prgeor committed Jul 7, 2023
1 parent 95c39b8 commit cbb2cf1
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1336,23 +1336,25 @@ def configure_laser_frequency(self, api, lport, freq, grid=75):
return api.set_laser_freq(freq, grid)

def post_port_active_apsel_to_db(self, api, lport, host_lanes_mask):
asic_index = self.port_mapping.get_asic_id_for_logical_port(lport)
intf_tbl = self.xcvr_table_helper.get_intf_tbl(asic_index)

try:
act_apsel = api.get_active_apsel_hostlane()
tuple_list = []
for lane in range(self.CMIS_MAX_HOST_LANES):
if ((1 << lane) & host_lanes_mask) == 0:
continue
tuple_list.append(('active_apsel_hostlane{}'.format(lane + 1),
str(act_apsel['ActiveAppSelLane{}'.format(lane + 1)])))
fvs = swsscommon.FieldValuePairs(tuple_list)
intf_tbl.set(lport, fvs)
self.log_notice("{}: updated TRANSCEIVER_INFO_TABLE {}".format(lport, tuple_list))

except NotImplementedError:
helper_logger.log_error("This functionality is currently not implemented")
helper_logger.log_error("Required feature is not implemented")
return

tuple_list = []
for lane in range(self.CMIS_MAX_HOST_LANES):
if ((1 << lane) & host_lanes_mask) == 0:
continue
act_apsel_lane = act_apsel.get('ActiveAppSelLane{}'.format(lane + 1), 'N/A')
tuple_list.append(('active_apsel_hostlane{}'.format(lane + 1),
str(act_apsel_lane)))

asic_index = self.port_mapping.get_asic_id_for_logical_port(lport)
intf_tbl = self.xcvr_table_helper.get_intf_tbl(asic_index)
fvs = swsscommon.FieldValuePairs(tuple_list)
intf_tbl.set(lport, fvs)
self.log_notice("{}: updated TRANSCEIVER_INFO_TABLE {}".format(lport, tuple_list))

def wait_for_port_config_done(self, namespace):
# Connect to APPL_DB and subscribe to PORT table notifications
Expand Down

0 comments on commit cbb2cf1

Please sign in to comment.