-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syslog for transceiver high/low temperature alarm #465
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1683,6 +1683,7 @@ def task_worker(self): | |||||
transceiver_status_cache = {} | ||||||
pm_info_cache = {} | ||||||
sel, asic_context = port_event_helper.subscribe_port_config_change(self.namespaces) | ||||||
temperature_status = {} | ||||||
|
||||||
# Start loop to update dom info in DB periodically | ||||||
while not self.task_stopping_event.wait(DOM_INFO_UPDATE_PERIOD_SECS): | ||||||
|
@@ -1735,6 +1736,8 @@ def task_worker(self): | |||||
helper_logger.log_warning("Got exception {} while processing pm info for port {}, ignored".format(repr(e), logical_port_name)) | ||||||
continue | ||||||
|
||||||
self.check_transceiver_temperature(logical_port_name, self.xcvr_table_helper.get_dom_threshold_tbl(asic_index), dom_info_cache, temperature_status) | ||||||
|
||||||
helper_logger.log_info("Stop DOM monitoring loop") | ||||||
|
||||||
def run(self): | ||||||
|
@@ -1758,6 +1761,64 @@ def join(self): | |||||
if self.exc: | ||||||
raise self.exc | ||||||
|
||||||
def check_transceiver_temperature(self, logical_port_name, th_table, dom_info_cache, temperature_status): | ||||||
TEMP_NORMAL = 0 | ||||||
TEMP_HIGH_ALARM = 1 | ||||||
TEMP_LOW_ALARM = 2 | ||||||
TEMP_HIGH_WARNING = 3 | ||||||
TEMP_LOW_WARNING = 4 | ||||||
|
||||||
TEMP_ERROR_TO_DESCRIPTION_DICT = { | ||||||
TEMP_NORMAL: "normal", | ||||||
TEMP_HIGH_ALARM: "temperature high alarm", | ||||||
TEMP_LOW_ALARM: "temperature low alarm", | ||||||
TEMP_HIGH_WARNING: "temperature high warning", | ||||||
TEMP_LOW_WARNING: "temperature low warning" | ||||||
} | ||||||
|
||||||
for physical_port, physical_port_name in get_physical_port_name_dict(logical_port_name, self.port_mapping).items(): | ||||||
ori_temp_status = temperature_status.get(physical_port) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please rename this to |
||||||
if ori_temp_status is None: | ||||||
ori_temp_status = TEMP_NORMAL | ||||||
temperature_status[physical_port] = ori_temp_status | ||||||
new_temp_status = TEMP_NORMAL | ||||||
|
||||||
dom_info_dict = dom_info_cache.get(physical_port) | ||||||
presence, threshold = th_table.get(physical_port_name) | ||||||
if presence: | ||||||
dom_th_info_dict = dict(threshold) | ||||||
else: | ||||||
dom_th_info_dict = None | ||||||
if dom_info_dict is not None and dom_th_info_dict is not None: | ||||||
temperature = dom_info_dict.get("temperature") | ||||||
temphighalarm = dom_th_info_dict.get("temphighalarm") | ||||||
templowalarm = dom_th_info_dict.get("templowalarm") | ||||||
temphighwarning = dom_th_info_dict.get("temphighwarning") | ||||||
templowwarning = dom_th_info_dict.get("templowwarning") | ||||||
if temperature != 'N/A' and temphighalarm != 'N/A' and templowalarm != 'N/A' and \ | ||||||
temphighwarning != 'N/A' and templowwarning != 'N/A': | ||||||
if float(temperature) > float(temphighalarm): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chiourung Can you please update the PR description with the snippet from the C_CMIS spec showing the shutdown behavior of the module due to high temperature. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chiourung Does the module not shutdown if temperature) == temphighalarm? |
||||||
new_temp_status = TEMP_HIGH_ALARM | ||||||
elif float(temperature) > float(temphighwarning): | ||||||
new_temp_status = TEMP_HIGH_WARNING | ||||||
elif float(temperature) < float(templowalarm): | ||||||
new_temp_status = TEMP_LOW_ALARM | ||||||
elif float(temperature) < float(templowwarning): | ||||||
new_temp_status = TEMP_LOW_WARNING | ||||||
else: | ||||||
new_temp_status = TEMP_NORMAL | ||||||
Comment on lines
+1801
to
+1809
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chiourung Instead of Xcvrd doing the comparison, there are module flags for low/high warning thresholds in byte 9. Why not use those latched flag? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @prgeor These flags are COR (Clear on Read). Cannot be used to determine if the temperature is from alarm/warning to normal. The comparison of the temperature can be kept to record when the temperature is alarm / warning. |
||||||
|
||||||
if ori_temp_status != new_temp_status: | ||||||
temperature_status[physical_port] = new_temp_status | ||||||
helper_logger.log_notice("{}: temperature status change from {} to {}".format( | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
physical_port_name, | ||||||
TEMP_ERROR_TO_DESCRIPTION_DICT[ori_temp_status], | ||||||
TEMP_ERROR_TO_DESCRIPTION_DICT[new_temp_status])) | ||||||
elif new_temp_status > 0: | ||||||
helper_logger.log_notice("{}: {}".format(physical_port_name, TEMP_ERROR_TO_DESCRIPTION_DICT[new_temp_status])) | ||||||
else: | ||||||
temperature_status[physical_port] = TEMP_NORMAL | ||||||
|
||||||
def on_port_config_change(self, port_change_event): | ||||||
if port_change_event.event_type == port_event_helper.PortChangeEvent.PORT_REMOVE: | ||||||
self.on_remove_logical_port(port_change_event) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chiourung