Merged
兼容CSR没配精细化告警事件 #211
huangdingAdd on Apr 2
兼容CSR没配精细化告警事件 #211
Merged
Merged fromaliens_to_mars/pcie_devicemainintoopenUBMC/pcie_devicemain
Total: 5 files changed+45-4
| @@ -1,5 +1,8 @@ | |||
| 1 | # Changelog | 1 | # Changelog |
| 2 | All notable changes to this project will be documented in this file. | 2 | All notable changes to this project will be documented in this file. |
| 3 | +## [1.100.1] - 2026-4-2 | ||
| 4 | +兼容CSR没配精细化告警事件 | ||
| 5 | + | ||
| 3 | ## [1.90.24] - 2026-3-20 | 6 | ## [1.90.24] - 2026-3-20 |
| 4 | 设备树接口变化,业务层适配,否则无法正确归类卡为PCIeCard或OCPCard | 7 | 设备树接口变化,业务层适配,否则无法正确归类卡为PCIeCard或OCPCard |
| 5 | 8 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | { | 1 | { |
| 2 | "name": "pcie_device", | 2 | "name": "pcie_device", |
| 3 | - "version": "1.90.24", | 3 | + "version": "1.100.1", |
| 4 | "type": "application", | 4 | "type": "application", |
| 5 | "deployConfig": "hardware.service", | 5 | "deployConfig": "hardware.service", |
| 6 | "author": "Huawei", | 6 | "author": "Huawei", |
| @@ -449,6 +449,7 @@ local function update_solid_config_status(monitor, unit_config, config_uid, conf | |||
| 449 | if (config_status == def.TOPO_STATUS.INCOMPLETE_CONNECTION or | 449 | if (config_status == def.TOPO_STATUS.INCOMPLETE_CONNECTION or |
| 450 | config_status == def.TOPO_STATUS.UNIT_NOT_EXIT) and | 450 | config_status == def.TOPO_STATUS.UNIT_NOT_EXIT) and |
| 451 | monitor.solid_config[key_str].lack_ports[conn_port_id] and | 451 | monitor.solid_config[key_str].lack_ports[conn_port_id] and |
| 452 | + conn:get_prop(def.PROP_PORT_LINK_INFO[2]) ~= "" and | ||
| 452 | -- UB规则例外场景,如果这个port_id有UB卡,可以不插 | 453 | -- UB规则例外场景,如果这个port_id有UB卡,可以不插 |
| 453 | not monitor.ub_rule_cable_monitor_plugin:is_match_ub_rule_refine_alarm(config_uid, | 454 | not monitor.ub_rule_cable_monitor_plugin:is_match_ub_rule_refine_alarm(config_uid, |
| 454 | slot_type, slot_number, conn_port_id) then | 455 | slot_type, slot_number, conn_port_id) then |
| @@ -516,11 +517,11 @@ local function update_config_status(unit_config, monitor) | |||
| 516 | ::continue:: | 517 | ::continue:: |
| 517 | end | 518 | end |
| 518 | 519 | ||
| 519 | - print_config(unit_config, status, monitor_bcu_index, silk_text) | ||
| 520 | if refine_alarm_status == def.REFINE_ALARM_STATUS.CONN_ALARM then | 520 | if refine_alarm_status == def.REFINE_ALARM_STATUS.CONN_ALARM then |
| 521 | -- 精细化告警场景不触发unit_config上的线缆告警 | 521 | -- 精细化告警场景不触发unit_config上的线缆告警 |
| 522 | status = def.TOPO_STATUS.INITIAL_STATE | 522 | status = def.TOPO_STATUS.INITIAL_STATE |
| 523 | end | 523 | end |
| 524 | + print_config(unit_config, status, monitor_bcu_index, silk_text) | ||
| 524 | -- 默认使用Port1Status承载检测状态 | 525 | -- 默认使用Port1Status承载检测状态 |
| 525 | unit_config:set_prop(def.PROP_PORT_LINK_INFO[1], silk_text) | 526 | unit_config:set_prop(def.PROP_PORT_LINK_INFO[1], silk_text) |
| 526 | unit_config:set_prop(def.PROP_PORT_STATUS[1], | 527 | unit_config:set_prop(def.PROP_PORT_STATUS[1], |
| @@ -727,8 +728,14 @@ function c_topo_monitor:main() | |||
| 727 | -- 读取TOPO发现信息并设置到业务端口上 | 728 | -- 读取TOPO发现信息并设置到业务端口上 |
| 728 | topo_info = self.topo_reader:read_topo_info() | 729 | topo_info = self.topo_reader:read_topo_info() |
| 729 | if not topo_info or not next(topo_info) then | 730 | if not topo_info or not next(topo_info) then |
| 730 | - log:error('[BizTopoMonitor] Read topo info failed.') | 731 | + -- 防止刷屏,只在成功状态变化时打印一次 |
| 732 | + if not self.already_print_read_topo_info_failed then | ||
| 733 | + log:error('[BizTopoMonitor] Read topo info failed.') | ||
| 734 | + self.already_print_read_topo_info_failed = true | ||
| 735 | + end | ||
| 731 | goto next | 736 | goto next |
| 737 | + else | ||
| 738 | + self.already_print_read_topo_info_failed = false | ||
| 732 | end | 739 | end |
| 733 | process(self.biz_connectors, set_topo_info_to_biz_connector, topo_info, self) | 740 | process(self.biz_connectors, set_topo_info_to_biz_connector, topo_info, self) |
| 734 | self:update_solid_config() | 741 | self:update_solid_config() |
| @@ -145,8 +145,13 @@ end | |||
| 145 | function c_topo_reader:read_topo_info() | 145 | function c_topo_reader:read_topo_info() |
| 146 | local chip = self.biz_topo_node.mds_obj.RefSmcChip | 146 | local chip = self.biz_topo_node.mds_obj.RefSmcChip |
| 147 | if not chip then | 147 | if not chip then |
| 148 | - log:error('[BizTopoMonitor] Chip is nil.') | 148 | + if not self.has_print_chip_nil then |
| 149 | + log:error('[BizTopoMonitor] Chip is nil.') | ||
| 150 | + self.has_print_chip_nil = true | ||
| 151 | + end | ||
| 149 | return | 152 | return |
| 153 | + else | ||
| 154 | + self.has_print_chip_nil = false | ||
| 150 | end | 155 | end |
| 151 | self:init_support_zone() | 156 | self:init_support_zone() |
| 152 | 157 | ||
| @@ -1007,6 +1007,9 @@ function TestTopoMonitor:test_update_solid_config_status() | |||
| 1007 | }, | 1007 | }, |
| 1008 | set_prop = function(self, k, v) | 1008 | set_prop = function(self, k, v) |
| 1009 | ret = v | 1009 | ret = v |
| 1010 | + end, | ||
| 1011 | + get_prop = function() | ||
| 1012 | + return "IEU" | ||
| 1010 | end | 1013 | end |
| 1011 | } | 1014 | } |
| 1012 | } | 1015 | } |
| @@ -1069,6 +1072,10 @@ function TestTopoMonitor:test_uptree() | |||
| 1069 | end | 1072 | end |
| 1070 | c_topo_monitor.update_config_status = function() | 1073 | c_topo_monitor.update_config_status = function() |
| 1071 | end | 1074 | end |
| 1075 | + c_topo_monitor.ub_rule_cable_monitor_plugin = { | ||
| 1076 | + ub_rules_get_unnecessary_cable = function() | ||
| 1077 | + end | ||
| 1078 | + } | ||
| 1072 | 1079 | ||
| 1073 | c_topo_monitor.topo_reader = { | 1080 | c_topo_monitor.topo_reader = { |
| 1074 | read_topo_info = function() | 1081 | read_topo_info = function() |
| @@ -1107,6 +1114,16 @@ function TestTopoMonitor:test_uptree() | |||
| 1107 | c_topo_monitor.main(c_topo_monitor) | 1114 | c_topo_monitor.main(c_topo_monitor) |
| 1108 | end) | 1115 | end) |
| 1109 | 1116 | ||
| 1117 | + c_topo_monitor.topo_reader = { | ||
| 1118 | + read_topo_info = function() | ||
| 1119 | + return {} | ||
| 1120 | + end | ||
| 1121 | + } | ||
| 1122 | + | ||
| 1123 | + pcall(function() | ||
| 1124 | + c_topo_monitor.main(c_topo_monitor) | ||
| 1125 | + end) | ||
| 1126 | + | ||
| 1110 | cmn.skynet.sleep = sleep_bak | 1127 | cmn.skynet.sleep = sleep_bak |
| 1111 | cmn.skynet.fork_loop = fork_loop_bak | 1128 | cmn.skynet.fork_loop = fork_loop_bak |
| 1112 | c_topo_monitor.init_solid_config = init_solid_config_bak | 1129 | c_topo_monitor.init_solid_config = init_solid_config_bak |
| @@ -1145,4 +1162,13 @@ function TestTopoMonitor:test_update_uid_slot_list() | |||
| 1145 | lu.assertEquals(c_topo_monitor.uid_slot_list['IEU'][1], 'ContainerUID') | 1162 | lu.assertEquals(c_topo_monitor.uid_slot_list['IEU'][1], 'ContainerUID') |
| 1146 | c_topo_monitor.pcie_addr_info_list = {} | 1163 | c_topo_monitor.pcie_addr_info_list = {} |
| 1147 | end | 1164 | end |
| 1165 | + | ||
| 1166 | +function TestTopoMonitor:test_topo_read() | ||
| 1167 | + local reader = require "biz_topo.topo_reader" | ||
| 1168 | + reader.biz_topo_node = { | ||
| 1169 | + mds_obj = {} | ||
| 1170 | + } | ||
| 1171 | + reader:read_topo_info() | ||
| 1172 | + lu.assertEquals(reader.has_print_chip_nil, true) | ||
| 1173 | +end | ||
| 1148 | 1174 | ||