9696 },
9797 },
9898
99- {"fin" : None , "fn" : "module_temp_populate" , "poll" : 20 , "ts" : 0 ,
100- "arg" : { "module1" : {"fin" : "/sys/module/sx_core/asic0/module0/" },
101- "module2" : {"fin" : "/sys/module/sx_core/asic0/module1/" },
102- "module3" : {"fin" : "/sys/module/sx_core/asic0/module2/" },
103- "module4" : {"fin" : "/sys/module/sx_core/asic0/module3/" },
104- "module5" : {"fin" : "/sys/module/sx_core/asic0/module4/" },
105- "module6" : {"fin" : "/sys/module/sx_core/asic0/module5/" },
106- "module7" : {"fin" : "/sys/module/sx_core/asic0/module6/" },
107- "module8" : {"fin" : "/sys/module/sx_core/asic0/module7/" },
108- "module9" : {"fin" : "/sys/module/sx_core/asic0/module8/" },
109- "module10" : {"fin" : "/sys/module/sx_core/asic0/module9/" },
110- "module11" : {"fin" : "/sys/module/sx_core/asic0/module10/" },
111- "module12" : {"fin" : "/sys/module/sx_core/asic0/module11/" },
112- "module13" : {"fin" : "/sys/module/sx_core/asic0/module12/" },
113- "module14" : {"fin" : "/sys/module/sx_core/asic0/module13/" },
114- "module15" : {"fin" : "/sys/module/sx_core/asic0/module14/" },
115- "module16" : {"fin" : "/sys/module/sx_core/asic0/module15/" },
116- "module17" : {"fin" : "/sys/module/sx_core/asic0/module16/" },
117- "module18" : {"fin" : "/sys/module/sx_core/asic0/module17/" },
118- "module19" : {"fin" : "/sys/module/sx_core/asic0/module18/" },
119- "module20" : {"fin" : "/sys/module/sx_core/asic0/module19/" },
120- "module21" : {"fin" : "/sys/module/sx_core/asic0/module20/" },
121- "module22" : {"fin" : "/sys/module/sx_core/asic0/module21/" },
122- "module23" : {"fin" : "/sys/module/sx_core/asic0/module22/" },
123- "module24" : {"fin" : "/sys/module/sx_core/asic0/module23/" },
124- "module25" : {"fin" : "/sys/module/sx_core/asic0/module24/" },
125- "module26" : {"fin" : "/sys/module/sx_core/asic0/module25/" },
126- "module27" : {"fin" : "/sys/module/sx_core/asic0/module26/" },
127- "module28" : {"fin" : "/sys/module/sx_core/asic0/module27/" },
128- "module29" : {"fin" : "/sys/module/sx_core/asic0/module28/" },
129- "module30" : {"fin" : "/sys/module/sx_core/asic0/module29/" },
130- "module31" : {"fin" : "/sys/module/sx_core/asic0/module30/" },
131- "module32" : {"fin" : "/sys/module/sx_core/asic0/module31/" },
132- "module33" : {"fin" : "/sys/module/sx_core/asic0/module32/" },
133- "module34" : {"fin" : "/sys/module/sx_core/asic0/module33/" },
134- "module35" : {"fin" : "/sys/module/sx_core/asic0/module34/" },
135- "module36" : {"fin" : "/sys/module/sx_core/asic0/module35/" } }
99+ {"fin" : None , "fn" : "module_temp_populate" , "poll" : 4 , "ts" : 0 ,
100+ "arg" : {"fin" : "/sys/module/sx_core/asic0/module{}/" , "fout_idx_offset" : 1 , "module_count" : 36 }
136101 },
137102 {"fin" : None ,
138103 "fn" : "redfish_get_sensor" , "arg" : ["/redfish/v1/Chassis/MGX_BMC_0/Sensors/BMC_TEMP" , "bmc" , 1000 ], "poll" : 30 , "ts" : 0 }
178143 "asic2" : {"fin" : "/sys/module/sx_core/asic1/" }
179144 }
180145 },
181-
182- {"fin" : None , "fn" : "module_temp_populate" , "poll" : 20 , "ts" : 0 ,
183- "arg" : { "module1" : {"fin" : "/sys/module/sx_core/asic0/module0/" },
184- "module2" : {"fin" : "/sys/module/sx_core/asic0/module1/" },
185- "module3" : {"fin" : "/sys/module/sx_core/asic0/module2/" },
186- "module4" : {"fin" : "/sys/module/sx_core/asic0/module3/" },
187- "module5" : {"fin" : "/sys/module/sx_core/asic0/module4/" },
188- "module6" : {"fin" : "/sys/module/sx_core/asic0/module5/" },
189- "module7" : {"fin" : "/sys/module/sx_core/asic0/module6/" },
190- "module8" : {"fin" : "/sys/module/sx_core/asic0/module7/" },
191- "module9" : {"fin" : "/sys/module/sx_core/asic0/module8/" },
192- "module10" : {"fin" : "/sys/module/sx_core/asic0/module9/" },
193- "module11" : {"fin" : "/sys/module/sx_core/asic0/module10/" },
194- "module12" : {"fin" : "/sys/module/sx_core/asic0/module11/" },
195- "module13" : {"fin" : "/sys/module/sx_core/asic0/module12/" },
196- "module14" : {"fin" : "/sys/module/sx_core/asic0/module13/" },
197- "module15" : {"fin" : "/sys/module/sx_core/asic0/module14/" },
198- "module16" : {"fin" : "/sys/module/sx_core/asic0/module15/" },
199- "module17" : {"fin" : "/sys/module/sx_core/asic0/module16/" },
200- "module18" : {"fin" : "/sys/module/sx_core/asic0/module17/" },
201- "module19" : {"fin" : "/sys/module/sx_core/asic0/module18/" },
202- "module20" : {"fin" : "/sys/module/sx_core/asic0/module19/" },
203- "module21" : {"fin" : "/sys/module/sx_core/asic0/module20/" },
204- "module22" : {"fin" : "/sys/module/sx_core/asic0/module21/" },
205- "module23" : {"fin" : "/sys/module/sx_core/asic0/module22/" },
206- "module24" : {"fin" : "/sys/module/sx_core/asic0/module23/" },
207- "module25" : {"fin" : "/sys/module/sx_core/asic0/module24/" },
208- "module26" : {"fin" : "/sys/module/sx_core/asic0/module25/" },
209- "module27" : {"fin" : "/sys/module/sx_core/asic0/module26/" },
210- "module28" : {"fin" : "/sys/module/sx_core/asic0/module27/" },
211- "module29" : {"fin" : "/sys/module/sx_core/asic0/module28/" },
212- "module30" : {"fin" : "/sys/module/sx_core/asic0/module29/" },
213- "module31" : {"fin" : "/sys/module/sx_core/asic0/module30/" },
214- "module32" : {"fin" : "/sys/module/sx_core/asic0/module31/" },
215- "module33" : {"fin" : "/sys/module/sx_core/asic0/module32/" },
216- "module34" : {"fin" : "/sys/module/sx_core/asic0/module33/" },
217- "module35" : {"fin" : "/sys/module/sx_core/asic0/module34/" },
218- "module36" : {"fin" : "/sys/module/sx_core/asic0/module35/" } }
146+ {"fin" : None , "fn" : "module_temp_populate" , "poll" : 4 , "ts" : 0 ,
147+ "arg" : {"fin" : "/sys/module/sx_core/asic0/module{}/" , "fout_idx_offset" : 1 , "module_count" : 36 }
219148 },
220149 {"fin" : None ,
221150 "fn" : "redfish_get_sensor" , "arg" : ["/redfish/v1/Chassis/MGX_BMC_0/Sensors/BMC_TEMP" , "bmc" , 1000 ], "poll" : 30 , "ts" : 0 }
226155 "asic1" : {"fin" : "/sys/module/sx_core/asic0/" }
227156 }
228157 },
229-
230158 {"fin" : None , "fn" : "module_temp_populate" , "poll" : 20 , "ts" : 0 ,
231- "arg" : { "module1" : {"fin" : "/sys/module/sx_core/asic0/module0/" },
232- "module2" : {"fin" : "/sys/module/sx_core/asic0/module1/" },
233- "module3" : {"fin" : "/sys/module/sx_core/asic0/module2/" },
234- "module4" : {"fin" : "/sys/module/sx_core/asic0/module3/" },
235- "module5" : {"fin" : "/sys/module/sx_core/asic0/module4/" },
236- "module6" : {"fin" : "/sys/module/sx_core/asic0/module5/" },
237- "module7" : {"fin" : "/sys/module/sx_core/asic0/module6/" },
238- "module8" : {"fin" : "/sys/module/sx_core/asic0/module7/" },
239- "module9" : {"fin" : "/sys/module/sx_core/asic0/module8/" },
240- "module10" : {"fin" : "/sys/module/sx_core/asic0/module9/" },
241- "module11" : {"fin" : "/sys/module/sx_core/asic0/module10/" },
242- "module12" : {"fin" : "/sys/module/sx_core/asic0/module11/" },
243- "module13" : {"fin" : "/sys/module/sx_core/asic0/module12/" },
244- "module14" : {"fin" : "/sys/module/sx_core/asic0/module13/" },
245- "module15" : {"fin" : "/sys/module/sx_core/asic0/module14/" },
246- "module16" : {"fin" : "/sys/module/sx_core/asic0/module15/" },
247- "module17" : {"fin" : "/sys/module/sx_core/asic0/module16/" },
248- "module18" : {"fin" : "/sys/module/sx_core/asic0/module17/" },
249- "module19" : {"fin" : "/sys/module/sx_core/asic0/module18/" },
250- "module20" : {"fin" : "/sys/module/sx_core/asic0/module19/" },
251- "module21" : {"fin" : "/sys/module/sx_core/asic0/module20/" },
252- "module22" : {"fin" : "/sys/module/sx_core/asic0/module21/" },
253- "module23" : {"fin" : "/sys/module/sx_core/asic0/module22/" },
254- "module24" : {"fin" : "/sys/module/sx_core/asic0/module23/" },
255- "module25" : {"fin" : "/sys/module/sx_core/asic0/module24/" },
256- "module26" : {"fin" : "/sys/module/sx_core/asic0/module25/" },
257- "module27" : {"fin" : "/sys/module/sx_core/asic0/module26/" },
258- "module28" : {"fin" : "/sys/module/sx_core/asic0/module27/" },
259- "module29" : {"fin" : "/sys/module/sx_core/asic0/module28/" },
260- "module30" : {"fin" : "/sys/module/sx_core/asic0/module29/" },
261- "module31" : {"fin" : "/sys/module/sx_core/asic0/module30/" },
262- "module32" : {"fin" : "/sys/module/sx_core/asic0/module31/" },
263- "module33" : {"fin" : "/sys/module/sx_core/asic0/module32/" },
264- "module34" : {"fin" : "/sys/module/sx_core/asic0/module33/" },
265- "module35" : {"fin" : "/sys/module/sx_core/asic0/module34/" },
266- "module36" : {"fin" : "/sys/module/sx_core/asic0/module35/" },
267- "module37" : {"fin" : "/sys/module/sx_core/asic0/module36/" },
268- "module38" : {"fin" : "/sys/module/sx_core/asic0/module37/" },
269- "module39" : {"fin" : "/sys/module/sx_core/asic0/module38/" },
270- "module40" : {"fin" : "/sys/module/sx_core/asic0/module39/" },
271- "module41" : {"fin" : "/sys/module/sx_core/asic0/module40/" },
272- "module42" : {"fin" : "/sys/module/sx_core/asic0/module41/" },
273- "module43" : {"fin" : "/sys/module/sx_core/asic0/module42/" },
274- "module44" : {"fin" : "/sys/module/sx_core/asic0/module43/" },
275- "module45" : {"fin" : "/sys/module/sx_core/asic0/module44/" },
276- "module46" : {"fin" : "/sys/module/sx_core/asic0/module45/" },
277- "module47" : {"fin" : "/sys/module/sx_core/asic0/module46/" },
278- "module48" : {"fin" : "/sys/module/sx_core/asic0/module47/" },
279- "module49" : {"fin" : "/sys/module/sx_core/asic0/module48/" },
280- "module50" : {"fin" : "/sys/module/sx_core/asic0/module49/" },
281- "module51" : {"fin" : "/sys/module/sx_core/asic0/module50/" },
282- "module52" : {"fin" : "/sys/module/sx_core/asic0/module51/" },
283- "module53" : {"fin" : "/sys/module/sx_core/asic0/module52/" },
284- "module54" : {"fin" : "/sys/module/sx_core/asic0/module53/" },
285- "module55" : {"fin" : "/sys/module/sx_core/asic0/module54/" },
286- "module56" : {"fin" : "/sys/module/sx_core/asic0/module55/" },
287- "module57" : {"fin" : "/sys/module/sx_core/asic0/module56/" },
288- "module58" : {"fin" : "/sys/module/sx_core/asic0/module57/" },
289- "module59" : {"fin" : "/sys/module/sx_core/asic0/module58/" },
290- "module60" : {"fin" : "/sys/module/sx_core/asic0/module59/" },
291- "module61" : {"fin" : "/sys/module/sx_core/asic0/module60/" },
292- "module62" : {"fin" : "/sys/module/sx_core/asic0/module61/" },
293- "module63" : {"fin" : "/sys/module/sx_core/asic0/module62/" },
294- "module64" : {"fin" : "/sys/module/sx_core/asic0/module63/" },
295- "module65" : {"fin" : "/sys/module/sx_core/asic0/module64/" },
296- "module66" : {"fin" : "/sys/module/sx_core/asic0/module65/" } }
297- }
159+ "arg" : {"fin" : "/sys/module/sx_core/asic0/module{}/" , "fout_idx_offset" : 1 , "module_count" : 66 }
160+ }
298161 ],
299- "def" : [
162+ "def" : [
300163 {"fin" : "/var/run/hw-management/config/thermal_enforced_full_spped" ,
301164 "fn" : "run_cmd" ,
302165 "arg" : ["if [[ -f /var/run/hw-management/config/thermal_enforced_full_spped && "
@@ -601,14 +464,16 @@ def asic_temp_populate(arg_list, arg):
601464# ----------------------------------------------------------------------
602465def module_temp_populate (arg_list , _dummy ):
603466 ''
604- total_module_count = 0
605- for module_name , module_attr in arg_list .items ():
606- total_module_count += 1
607- f_dst_name = "/var/run/hw-management/thermal/{}_temp_input" .format (module_name )
467+ fin = arg_list ["fin" ]
468+ module_count = arg_list ["module_count" ]
469+ offset = arg_list ["fout_idx_offset" ]
470+ host_management_mode = None
471+ for idx in range (module_count ):
472+ f_dst_name = "/var/run/hw-management/thermal/module{}_temp_input" .format (idx + offset )
608473 if os .path .islink (f_dst_name ):
609474 continue
610475
611- f_src_path = module_attr [ " fin" ]
476+ f_src_path = fin . format ( idx )
612477 module_present = 0
613478
614479 # Check if module is present
@@ -628,7 +493,10 @@ def module_temp_populate(arg_list, _dummy):
628493
629494 if module_present :
630495 # If control mode is FW, skip temperature reading (independent mode)
631- if is_module_host_management_mode (f_src_path ):
496+ if host_management_mode is None :
497+ host_management_mode = is_module_host_management_mode (f_src_path )
498+
499+ if host_management_mode :
632500 continue
633501
634502 f_src_input = os .path .join (f_src_path , "temperature/input" )
@@ -672,7 +540,7 @@ def module_temp_populate(arg_list, _dummy):
672540 f .write ("{}\n " .format (value ))
673541
674542 with open ("/var/run/hw-management/config/module_counter" , 'w+' , encoding = "utf-8" ) as f :
675- f .write ("{}\n " .format (total_module_count ))
543+ f .write ("{}\n " .format (module_count ))
676544 return
677545
678546# ----------------------------------------------------------------------
0 commit comments