-
Notifications
You must be signed in to change notification settings - Fork 195
Description
Problem
The current code cannot differentiate pre-emphasis between copper cables and optical modules.
Symptoms
When a port supports both copper cables and optical modules, and the pre-emphasis values for the optical module and copper cable are different. The code cannot differentiate pre-emphasis between copper cables and optical modules.
Root Cause
The code does not have a design to differentiate between copper cables and optical modules.
Proposed Solution
Add a new variable to store whether it is a copper cable or an optical module and the device media_settings.json add fiber and copper to diff pre-emphasis.
if len(media_compliance_code) != 0:
media_key += '-' + media_compliance_code
sfp = xcvrd.platform_chassis.get_sfp(physical_port)
api = sfp.get_xcvr_api()
if xcvrd.is_cmis_api(api):
if media_compliance_code == "passive_copper_media_interface":
if media_len != 0:
media_key += '-' + str(media_len) + 'M'
else:
if media_len != 0:
media_key += '-' + str(media_len) + 'M'
else:
media_key += '-' + '*'
media_type_ex = "fiber"
try:
if (type(media_len) != int) and (type(media_len) != float):
media_len = None
for key, value in transceiver_dict[physical_port].items():
if type(value) != str:
continue
if value.lower().find("copper") >=0:
media_type_ex = "copper"
break
except Exception as e:
helper_logger.log_error("Invalid value for port {}: {}".format(physical_port, str(e)))
helper_logger.log_error("media_type {}".format(media_type_ex))
lane_speed_key = get_lane_speed_key(physical_port, port_speed, lane_count)
# return (vendor_key, media_key, lane_speed_key)
media_settings = get_media_settings(key, media_dict)
if media_settings is not None:
return media_settings
# Try to match 'default' key if it does not match any keys
elif DEFAULT_KEY in media_dict:
return get_media_settings_for_speed(media_dict[DEFAULT_KEY], lane_speed_key)
elif len(default_dict) != 0:
return default_dict
else:
if "copper" in key[MEDIA_TYE_KEY]:
media_dict = media_dict["copper"]
else:
media_dict = media_dict["fiber"]
helper_logger.log_notice("media_settings lane speed {}".format(lane_speed_key))
helper_logger.log_notice("port {} media_dict {}".format(physical_port, media_dict))
return get_media_settings_for_speed(media_dict, lane_speed_key)
else:
if len(default_dict) != 0:
return default_dict
return {}