1- #
2- # module_base.py
3- #
4- # Base class for implementing a platform-specific class with which
5- # to interact with a module (as used in a modular chassis) SONiC.
6- #
1+ """
2+ module_base.py
3+
4+ Base class for implementing a platform-specific class with which
5+ to interact with a module (as used in a modular chassis) SONiC.
6+ """
77
88import sys
99from . import device_base
1212class ModuleBase (device_base .DeviceBase ):
1313 """
1414 Base class for interfacing with a module (supervisor module, line card
15- module, etc. (applicable for a modular chassis)
15+ module, etc. (applicable for a modular chassis)
1616 """
1717 # Device type definition. Note, this is a constant.
1818 DEVICE_TYPE = "module"
@@ -50,31 +50,25 @@ class ModuleBase(device_base.DeviceBase):
5050 # Module reboot type to reboot FPGA complex
5151 MODULE_REBOOT_FPGA_COMPLEX = "FPGA"
5252
53- # List of ComponentBase-derived objects representing all components
54- # available on the module
55- _component_list = None
56-
57- # List of FanBase-derived objects representing all fans
58- # available on the module
59- _fan_list = None
60-
61- # List of PsuBase-derived objects representing all power supply units
62- # available on the module
63- _psu_list = None
64-
65- # List of ThermalBase-derived objects representing all thermals
66- # available on the module
67- _thermal_list = None
68-
69- # List of SfpBase-derived objects representing all sfps
70- # available on the module
71- _sfp_list = None
72-
7353 def __init__ (self ):
54+ # List of ComponentBase-derived objects representing all components
55+ # available on the module
7456 self ._component_list = []
57+
58+ # List of FanBase-derived objects representing all fans
59+ # available on the module
7560 self ._fan_list = []
61+
62+ # List of PsuBase-derived objects representing all power supply units
63+ # available on the module
7664 self ._psu_list = []
65+
66+ # List of ThermalBase-derived objects representing all thermals
67+ # available on the module
7768 self ._thermal_list = []
69+
70+ # List of SfpBase-derived objects representing all sfps
71+ # available on the module
7872 self ._sfp_list = []
7973
8074 def get_base_mac (self ):
@@ -89,15 +83,15 @@ def get_base_mac(self):
8983
9084 def get_system_eeprom_info (self ):
9185 """
92- Retrieves the full content of system EEPROM information for the module
86+ Retrieves the full content of system EEPROM information for the module
9387
9488 Returns:
9589 A dictionary where keys are the type code defined in
9690 OCP ONIE TlvInfo EEPROM format and values are their corresponding
9791 values.
98- Ex. { ‘ 0x21’:’ AG9064’, ‘ 0x22’:’ V1.0’, ‘ 0x23’:’ AG9064-0109867821’ ,
99- ‘ 0x24’:’ 001c0f000fcd0a’, ‘ 0x25’:’ 02/03/2018 16:22:00’ ,
100- ‘ 0x26’:’01’, ‘ 0x27’:’ REV01’, ‘ 0x28’:’ AG9064-C2358-16G’ }
92+ Ex. { ' 0x21': ' AG9064', ' 0x22': ' V1.0', ' 0x23': ' AG9064-0109867821' ,
93+ ' 0x24': ' 001c0f000fcd0a', ' 0x25': ' 02/03/2018 16:22:00' ,
94+ ' 0x26': '01', ' 0x27': ' REV01', ' 0x28': ' AG9064-C2358-16G' }
10195 """
10296 raise NotImplementedError
10397
@@ -254,11 +248,11 @@ def get_num_fans(self):
254248
255249 def get_all_fans (self ):
256250 """
257- Retrieves all fan modules available on this module
251+ Retrieves all fan modules available on this module
258252
259253 Returns:
260254 A list of objects derived from FanBase representing all fan
261- modules available on this module
255+ modules available on this module
262256 """
263257 return self ._fan_list
264258
@@ -290,21 +284,21 @@ def get_fan(self, index):
290284
291285 def get_num_psus (self ):
292286 """
293- Retrieves the number of power supply units available on this module
287+ Retrieves the number of power supply units available on this module
294288
295289 Returns:
296290 An integer, the number of power supply units available on this
297- module
291+ module
298292 """
299293 return len (self ._psu_list )
300294
301295 def get_all_psus (self ):
302296 """
303- Retrieves all power supply units available on this module
297+ Retrieves all power supply units available on this module
304298
305299 Returns:
306300 A list of objects derived from PsuBase representing all power
307- supply units available on this module
301+ supply units available on this module
308302 """
309303 return self ._psu_list
310304
@@ -336,20 +330,20 @@ def get_psu(self, index):
336330
337331 def get_num_thermals (self ):
338332 """
339- Retrieves the number of thermals available on this module
333+ Retrieves the number of thermals available on this module
340334
341335 Returns:
342- An integer, the number of thermals available on this module
336+ An integer, the number of thermals available on this module
343337 """
344338 return len (self ._thermal_list )
345339
346340 def get_all_thermals (self ):
347341 """
348- Retrieves all thermals available on this module
342+ Retrieves all thermals available on this module
349343
350344 Returns:
351345 A list of objects derived from ThermalBase representing all thermals
352- available on this module
346+ available on this module
353347 """
354348 return self ._thermal_list
355349
@@ -380,20 +374,20 @@ def get_thermal(self, index):
380374
381375 def get_num_sfps (self ):
382376 """
383- Retrieves the number of sfps available on this module
377+ Retrieves the number of sfps available on this module
384378
385379 Returns:
386- An integer, the number of sfps available on this module
380+ An integer, the number of sfps available on this module
387381 """
388382 return len (self ._sfp_list )
389383
390384 def get_all_sfps (self ):
391385 """
392- Retrieves all sfps available on this module
386+ Retrieves all sfps available on this module
393387
394388 Returns:
395- A list of objects derived from PsuBase representing all sfps
396- available on this module
389+ A list of objects derived from PsuBase representing all sfps
390+ available on this module
397391 """
398392 return self ._sfp_list
399393
@@ -431,7 +425,7 @@ def get_change_event(self, timeout=0):
431425 - True if call successful, False if not;
432426 - A nested dictionary where key is a device type,
433427 value is a dictionary with key:value pairs in the format of
434- {'device_id':'device_event'},
428+ {'device_id':'device_event'},
435429 where device_id is the device ID for this device and
436430 device_event,
437431 status='1' represents device inserted,
0 commit comments