-
Notifications
You must be signed in to change notification settings - Fork 195
Description
Problem
The rate obtained by using the get_lane_speed_key interface for CMIS type optical modules is not the rate of a single lane.
Symptoms
When using CMIS type optical modules, it was found that the single lanes speed obtained through get_lane_speed_key was inaccurate. After adding debugging information, the log obtained is as follows:
`{'vendor_key': 'LUXSHARE-ICT -LPZDD002-SD-R ', 'media_key': 'QSFP-DD-passive_copper_media_interface-1.0M', 'lane_speed_key': 'speed:400G'}
{'vendor_key': 'BIZLINK -C45593-A557-D10 ', 'media_key': 'QSFP-DD-passive_copper_media_interface-1.0M', 'lane_speed_key': 'speed:400G'}`
Root Cause
if xcvrd.is_cmis_api(api):
appl_adv_dict = api.get_application_advertisement()
app_id = xcvrd.get_cmis_application_desired(api, lane_count, port_speed)
if app_id and app_id in appl_adv_dict:
host_electrical_interface_id = appl_adv_dict[app_id].get('host_electrical_interface_id')
if host_electrical_interface_id:
lane_speed_key = LANE_SPEED_KEY_PREFIX + host_electrical_interface_id.split()[0]`
The rate obtained by the above code is not for a single lane, and no exception handling has been implemented.
Proposed Solution
Add exception handling and calculation of the rate for each individual lane.
`
if xcvrd.is_cmis_api(api):
appl_adv_dict = api.get_application_advertisement()
app_id = xcvrd.get_cmis_application_desired(api, lane_count, port_speed)
if app_id and app_id in appl_adv_dict:
host_electrical_interface_id = appl_adv_dict[app_id].get('host_electrical_interface_id')
if host_electrical_interface_id:
lane_speed_key = LANE_SPEED_KEY_PREFIX + host_electrical_interface_id.split()[0]
if lane_speed_key is None or str(port_speed//1000) in lane_speed_key:
lane_speed_key = '{}{}G'.format(LANE_SPEED_KEY_PREFIX, port_speed // lane_count // 1000)`