def __init__(self): super(Chassis, self).__init__() # Initialize SKU name self.sku_name = self._get_sku_name() # Initialize PSU list for index in range(MLNX_NUM_PSU): psu = Psu(index, self.sku_name) self._psu_list.append(psu) # Initialize watchdog self._watchdog = get_watchdog() # Initialize FAN list multi_rotor_in_drawer = False num_of_fan, num_of_drawer = self._extract_num_of_fans_and_fan_drawers() multi_rotor_in_drawer = num_of_fan > num_of_drawer for index in range(num_of_fan): if multi_rotor_in_drawer: fan = Fan(index, index / 2) else: fan = Fan(index, index) self._fan_list.append(fan) # Initialize SFP list port_position_tuple = self._get_port_position_tuple_by_sku_name() self.PORT_START = port_position_tuple[0] self.QSFP_PORT_START = port_position_tuple[1] self.PORT_END = port_position_tuple[2] self.PORTS_IN_BLOCK = port_position_tuple[3] for index in range(self.PORT_START, self.PORT_END + 1): if index in range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1): sfp_module = SFP(index, 'QSFP') else: sfp_module = SFP(index, 'SFP') self._sfp_list.append(sfp_module) # Initialize thermals initialize_thermals(self.sku_name, self._thermal_list, self._psu_list) # Initialize EEPROM self.eeprom = Eeprom() # Initialize component list self._component_name_list.append(COMPONENT_BIOS) self._component_name_list.append(COMPONENT_FIRMWARE) self._component_name_list.append(COMPONENT_CPLD1) self._component_name_list.append(COMPONENT_CPLD2) # Initialize sfp-change-listening stuff self._init_sfp_change_event()
def __init__(self): ChassisBase.__init__(self) # Initialize PSU list for index in range(MLNX_NUM_PSU): psu = Psu(index) self._psu_list.append(psu) # Initialize watchdog self._watchdog = get_watchdog() # Initialize FAN list multi_rotor_in_drawer = False num_of_fan, num_of_drawer = self._extract_num_of_fans_and_fan_drawers() multi_rotor_in_drawer = num_of_fan > num_of_drawer for index in range(num_of_fan): if multi_rotor_in_drawer: fan = Fan(index, index / 2) else: fan = Fan(index, index) self._fan_list.append(fan)
def __init__(self): ChassisBase.__init__(self) # Initialize PSU list for index in range(MLNX_NUM_PSU): psu = Psu(index) self._psu_list.append(psu) # Initialize watchdog self._watchdog = get_watchdog() # Initialize FAN list multi_rotor_in_drawer = False num_of_fan, num_of_drawer = self._extract_num_of_fans_and_fan_drawers() multi_rotor_in_drawer = num_of_fan > num_of_drawer for index in range(num_of_fan): if multi_rotor_in_drawer: fan = Fan(index, index/2) else: fan = Fan(index, index) self._fan_list.append(fan)
def get_watchdog(self): """ Retrieves hardware watchdog device on this chassis Returns: An object derived from WatchdogBase representing the hardware watchdog device Note: We overload this method to ensure that watchdog is only initialized when it is referenced. Currently, only one daemon can open the watchdog. To initialize watchdog in the constructor causes multiple daemon try opening watchdog when loading and constructing a chassis object and fail. By doing so we can eliminate that risk. """ try: if self._watchdog is None: from sonic_platform.watchdog import get_watchdog self._watchdog = get_watchdog() except Exception as e: logger.log_info("Fail to load watchdog due to {}".format(repr(e))) return self._watchdog
def __init__(self): ChassisBase.__init__(self) # Initialize PSU list for index in range(MLNX_NUM_PSU): psu = Psu(index) self._psu_list.append(psu) # Initialize watchdog self._watchdog = get_watchdog() # Initialize FAN list multi_rotor_in_drawer = False num_of_fan, num_of_drawer = self._extract_num_of_fans_and_fan_drawers() multi_rotor_in_drawer = num_of_fan > num_of_drawer for index in range(num_of_fan): if multi_rotor_in_drawer: fan = Fan(index, index / 2) else: fan = Fan(index, index) self._fan_list.append(fan) # Initialize SFP list port_position_tuple = self._get_port_position_tuple_by_sku_name() self.PORT_START = port_position_tuple[0] self.QSFP_PORT_START = port_position_tuple[1] self.PORT_END = port_position_tuple[2] self.PORTS_IN_BLOCK = port_position_tuple[3] for index in range(self.PORT_START, self.PORT_END + 1): if index in range(QSFP_PORT_START, self.PORTS_IN_BLOCK + 1): sfp_module = SFP(index, 'QSFP') else: sfp_module = SFP(index, 'SFP') self._psu_list.append(sfp_module)