def __init__(self, fantray_index):

        FanDrawerBase.__init__(self)
        # FanTray is 1-based in DellEMC platforms
        self.fantrayindex = fantray_index + 1
        for i in range(Z9264F_FANS_PER_FANTRAY):
            self._fan_list.append(Fan(fantray_index, i))
示例#2
0
    def __init__(self):
        ChassisBase.__init__(self)
        # sfp.py will read eeprom contents and retrive the eeprom data.
        # We pass the eeprom path from chassis.py
        self.PORT_START = 1
        self.PORT_END = 34 
        self.PORTS_IN_BLOCK = (self.PORT_END + 1)
        _sfp_port = range(33, self.PORT_END + 1)
        eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"

        for index in range(self.PORT_START, self.PORTS_IN_BLOCK):
            port_num = index + 1
            eeprom_path = eeprom_base.format(port_num)
            if index not in _sfp_port:
                sfp_node = Sfp(index, 'QSFP', eeprom_path)
            else:
                sfp_node = Sfp(index, 'SFP', eeprom_path)
            self._sfp_list.append(sfp_node)

        self._eeprom = Eeprom()
        self._watchdog = Watchdog()
        self._num_sfps = self.PORT_END
        self._num_fans = MAX_S5232F_FANTRAY * MAX_S5232F_FAN
        self._fan_list = [Fan(i, j) for i in range(MAX_S5232F_FANTRAY) \
                            for j in range(MAX_S5232F_FAN)]
        self._psu_list = [Psu(i) for i in range(MAX_S5232F_PSU)]
        self._thermal_list = [Thermal(i) for i in range(MAX_S5232F_THERMAL)]
        self._component_list = [Component(i) for i in range(MAX_S5232F_COMPONENT)]

        for port_num in range(self.PORT_START, self.PORTS_IN_BLOCK):
            # sfp get uses zero-indexing, but port numbers start from 1
            presence = self.get_sfp(port_num).get_presence()
            self._global_port_pres_dict[port_num] = '1' if presence else '0'
示例#3
0
    def __init__(self):
        super(Chassis, self).__init__()

        for fantray_index in range(0, NUM_FAN_TRAY):
            for fan_index in range(0, NUM_FAN):
                fan = Fan(fantray_index, fan_index)
                self._fan_list.append(fan)
        for index in range(0, NUM_PSU):
            psu = Psu(index)
            self._psu_list.append(psu)
        for index in range(0, NUM_THERMAL):
            thermal = Thermal(index)
            self._thermal_list.append(thermal)

        self.PORT_START = SFP_PORT_START
        self.QSFP_PORT_START = QSFP_PORT_START
        self.PORT_END = QSFP_PORT_END
        for index in range(0, NUM_SFP):
            if index in range(self.QSFP_PORT_START, self.QSPORT_END + 1):
                sfp_module = Sfp(index, 'QSFP')
            else:
                sfp_module = Sfp(index, 'SFP')
            self._sfp_list.append(sfp_module)
        self._component_name_list = COMPONENT_NAME_LIST
        self._watchdog = Watchdog()
        self._eeprom = Tlv()
        logger.log_info("Chassis loaded successfully")
示例#4
0
    def __init__(self, psu_index):
        PsuBase.__init__(self)
        # PSU is 1-based in DellEMC platforms
        self.index = psu_index + 1
        self.psu_presence_reg = "psu{}_prs".format(psu_index)
        self.psu_status_reg = "powersupply_status"
        self.is_driver_initialized = False

        if self.index == 1:
            ltc_dir = self.I2C_DIR + "i2c-11/11-0042/hwmon/"
        else:
            ltc_dir = self.I2C_DIR + "i2c-11/11-0040/hwmon/"

        try:
            hwmon_node = os.listdir(ltc_dir)[0]
        except OSError:
            hwmon_node = "hwmon*"
        else:
            self.is_driver_initialized = True

        self.HWMON_DIR = ltc_dir + hwmon_node + '/'

        self.psu_voltage_reg = self.HWMON_DIR + "in1_input"
        self.psu_current_reg = self.HWMON_DIR + "curr1_input"
        self.psu_power_reg = self.HWMON_DIR + "power1_input"

        self.eeprom = Eeprom(is_psu=True, psu_index=self.index)

        self._fan_list.append(Fan(psu_index=self.index, psu_fan=True, dependency=self))
        for i in range(1, MAX_S6000_THERMALS_PER_PSU+1):
            self._thermal_list.append(Thermal(psu_index=self.index, thermal_index=i,
                                              psu_thermal=True, dependency=self))
示例#5
0
 def __init__(self, psu_index):
     global psu_list
     PsuBase.__init__(self)
     # PSU is 1-based on Mellanox platform
     self.index = psu_index + 1
     psu_list.append(self.index)
     self.psu_path = "/var/run/hw-management/thermal/"
     self.psu_oper_status = "psu{}_pwr_status".format(self.index)
     self.psu_presence = "psu{}_status".format(self.index)
     if os.path.exists(os.path.join(self.psu_path, self.psu_presence)):
         self.presence_file_exists = True
     else:
         self.presence_file_exists = False
     fan = Fan(psu_index, psu_index, True)
     if fan.get_presence():
         self._fan = fan
示例#6
0
    def __init__(self):
        ChassisBase.__init__(self)
        self.config_data = {}
        for fant_index in range(0, NUM_FAN_TRAY):
            for fan_index in range(0, NUM_FAN):
                fan = Fan(fant_index, fan_index)
                self._fan_list.append(fan)
        for index in range(0, NUM_PSU):
            psu = Psu(index)
            self._psu_list.append(psu)
        for index in range(0, NUM_THERMAL):
            thermal = Thermal(index)
            self._thermal_list.append(thermal)
        # sfp index start from 1
        self._sfp_list.append(None)
        for index in range(1, NUM_SFP + 1):
            sfp = Sfp(index)
            self._sfp_list.append(sfp)
        for index in range(0, NUM_COMPONENT):
            component = Component(index)
            self._component_list.append(component)
        self._reboot_cause_path = HOST_REBOOT_CAUSE_PATH if self.__is_host(
        ) else PMON_REBOOT_CAUSE_PATH

        self._eeprom = Tlv()
示例#7
0
    def __init__(self):
        ChassisBase.__init__(self)
        self.__num_of_fans = 8
        self.__num_of_psus = 2
        self.__num_of_sfps = 56
        self.__start_of_qsfp = 48
        self.__num_of_thermals = 5

        # Initialize EEPROM
        self._eeprom = Eeprom()

        # Initialize FAN
        for index in range(1, self.__num_of_fans + 1):
            fan = Fan(index, False, 0)
            self._fan_list.append(fan)

        # Initialize PSU
        for index in range(1, self.__num_of_psus + 1):
            psu = Psu(index)
            self._psu_list.append(psu)

        # Initialize SFP
        for index in range(0, self.__num_of_sfps):
            if index < self.__start_of_qsfp:
                sfp = Sfp(index)
            else:
                sfp = QSfp(index)
            self._sfp_list.append(sfp)

        # Initialize THERMAL
        for index in range(0, self.__num_of_thermals):
            thermal = Thermal(index)
            self._thermal_list.append(thermal)
示例#8
0
    def __init__(self):
        ChassisBase.__init__(self)
        # sfp.py will read eeprom contents and retrive the eeprom data.
        # We pass the eeprom path from chassis.py
        self.PORT_START = 1
        self.PORT_END = 56
        self.PORTS_IN_BLOCK = (self.PORT_END + 1)
        _sfp_port = range(49, self.PORTS_IN_BLOCK)
        eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"
        for index in range(self.PORT_START, self.PORTS_IN_BLOCK):
            eeprom_path = eeprom_base.format(self._port_to_i2c_mapping[index])
            port_type = 'QSFP' if index in _sfp_port else 'SFP'
            sfp_node = Sfp(index, port_type, eeprom_path)
            self._sfp_list.append(sfp_node)

        self._eeprom = Eeprom()
        self._watchdog = Watchdog()
        self._num_sfps = self.PORT_END
        self._num_fans = MAX_S5248F_FANTRAY * MAX_S5248F_FAN
        self._fan_list = [Fan(i, j) for i in range(MAX_S5248F_FANTRAY) \
                            for j in range(MAX_S5248F_FAN)]
        for i in range(MAX_S5248F_FANTRAY):
            fandrawer = FanDrawer(i)
            self._fan_drawer_list.append(fandrawer)
            self._fan_list.extend(fandrawer._fan_list)

        self._psu_list = [Psu(i) for i in range(MAX_S5248F_PSU)]
        self._thermal_list = [Thermal(i) for i in range(MAX_S5248F_THERMAL)]
        self._component_list = [
            Component(i) for i in range(MAX_S5248F_COMPONENT)
        ]
        for port_num in range(self.PORT_START, self.PORTS_IN_BLOCK):
            # sfp get uses zero-indexing, but port numbers start from 1
            presence = self.get_sfp(port_num - 1).get_presence()
            self._global_port_pres_dict[port_num] = '1' if presence else '0'
示例#9
0
    def __init__(self, psu_index):
        # PSU is 1-based in DellEMC platforms
        self.index = psu_index + 1
        self.psu_presence_reg = "psu{}_prs".format(psu_index)
        self.psu_status_reg = "powersupply_status"
        self.is_driver_initialized = False

        if self.index == 1:
            ltc_dir = self.I2C_DIR + "i2c-11/11-0042/hwmon/"
        else:
            ltc_dir = self.I2C_DIR + "i2c-11/11-0040/hwmon/"

        try:
            hwmon_node = os.listdir(ltc_dir)[0]
        except OSError:
            hwmon_node = "hwmon*"
        else:
            self.is_driver_initialized = True

        self.HWMON_DIR = ltc_dir + hwmon_node + '/'

        self.psu_voltage_reg = self.HWMON_DIR + "in1_input"
        self.psu_current_reg = self.HWMON_DIR + "curr1_input"
        self.psu_power_reg = self.HWMON_DIR + "power1_input"

        self.eeprom = Eeprom(is_psu=True, psu_index=self.index)

        # Overriding _fan_list class variable defined in PsuBase, to
        # make it unique per Psu object
        self._fan_list = []

        self._fan_list.append(Fan(self.index, psu_fan=True, dependency=self))
示例#10
0
    def __init__(self, psu_index, platform):
        global psu_list
        PsuBase.__init__(self)
        # PSU is 1-based on Mellanox platform
        self.index = psu_index + 1
        psu_list.append(self.index)
        self.psu_path = "/var/run/hw-management/"
        psu_oper_status = "thermal/psu{}_pwr_status".format(self.index)
        #psu_oper_status should always be present for all platforms
        self.psu_oper_status = os.path.join(self.psu_path, psu_oper_status)
        self._name = "PSU{}".format(psu_index + 1)

        if platform in platform_dict_psu:
            filemap = psu_profile_list[platform_dict_psu[platform]]
        else:
            filemap = psu_profile_list[0]

        self.psu_data = DEVICE_DATA[platform]['psus']

        if not self.psu_data['hot_swappable']:
            self.always_present = True
            self.psu_voltage = None
            self.psu_current = None
            self.psu_power = None
            self.psu_presence = None
            self.psu_temp = None
            self.psu_temp_threshold = None
        else:
            self.always_present = False
            psu_voltage = filemap[PSU_VOLTAGE].format(self.index)
            psu_voltage = os.path.join(self.psu_path, psu_voltage)
            self.psu_voltage = psu_voltage

            psu_current = filemap[PSU_CURRENT].format(self.index)
            psu_current = os.path.join(self.psu_path, psu_current)
            self.psu_current = psu_current

            psu_power = filemap[PSU_POWER].format(self.index)
            psu_power = os.path.join(self.psu_path, psu_power)
            self.psu_power = psu_power

            psu_presence = "thermal/psu{}_status".format(self.index)
            psu_presence = os.path.join(self.psu_path, psu_presence)
            self.psu_presence = psu_presence

            self.psu_temp = os.path.join(
                self.psu_path, 'thermal/psu{}_temp'.format(self.index))
            self.psu_temp_threshold = os.path.join(
                self.psu_path, 'thermal/psu{}_temp_max'.format(self.index))

        # unplugable PSU has no FAN
        if self.psu_data['hot_swappable']:
            fan = Fan(psu_index, None, True)
            self._fan_list.append(fan)

        if self.psu_data['led_num'] == 1:
            self.led = ComponentFaultyIndicator(Psu.get_shared_led())
        else:  # 2010/2100
            self.led = PsuLed(self.index)
示例#11
0
    def __init__(self):
        ChassisBase.__init__(self)
        self.system_led_supported_color = ['off', 'amber', 'green', 'amber_blink', 'green_blink']
        # Port numbers for SFP List Initialization
        self.COPPER_PORT_START = COPPER_PORT_START
        self.COPPER_PORT_END = COPPER_PORT_END
        self.SFP_PORT_START = SFP_PORT_START
        self.SFP_PORT_END = SFP_PORT_END
        self.PORT_END = PORT_END

        # for non-sfp ports create dummy objects for copper / non-sfp ports
        for index in range(self.COPPER_PORT_START, self.COPPER_PORT_END+1):
            sfp_node = Sfp(index, 'COPPER', 'N/A', 'N/A')
            self._sfp_list.append(sfp_node)

        # Verify optoe2 driver SFP eeprom devices were enumerated and exist
        # then create the sfp nodes
        eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"
        mux_dev = sorted(glob.glob("/sys/class/i2c-adapter/i2c-0/i2c-[0-9]"))
        y = 0
        for index in range(self.SFP_PORT_START, self.SFP_PORT_END+1):
            mux_dev_num = mux_dev[y]
            port_i2c_map = mux_dev_num[-1]
            y = y + 1
            port_eeprom_path = eeprom_path.format(port_i2c_map)
            if not os.path.exists(port_eeprom_path):
                sonic_logger.log_info("path %s didnt exist" % port_eeprom_path)
            sfp_node = Sfp(index, 'SFP', port_eeprom_path, port_i2c_map)
            self._sfp_list.append(sfp_node)
        self.sfp_event_initialized = False

        # Instantiate system eeprom object
        self._eeprom = Eeprom()

        # Construct lists fans, power supplies, thermals & components
        drawer_num = MAX_7215_FAN_DRAWERS
        fan_num_per_drawer = MAX_7215_FANS_PER_DRAWER
        drawer_ctor = RealDrawer
        fan_index = 0
        for drawer_index in range(drawer_num):
            drawer = drawer_ctor(drawer_index)
            self._fan_drawer_list.append(drawer)
            for index in range(fan_num_per_drawer):
                fan = Fan(fan_index, drawer)
                fan_index += 1
                drawer._fan_list.append(fan)
                self._fan_list.append(fan)

        for i in range(MAX_7215_PSU):
            psu = Psu(i)
            self._psu_list.append(psu)

        for i in range(MAX_7215_THERMAL):
            thermal = Thermal(i)
            self._thermal_list.append(thermal)

        for i in range(MAX_7215_COMPONENT):
            component = Component(i)
            self._component_list.append(component)
示例#12
0
    def __init__(self, fantray_index):

        FanDrawerBase.__init__(self)
        # FanTray is 1-based in DellEMC platforms
        self.fantray_led_reg = "fan{}_led".format(fantray_index)
        self.fantrayindex = fantray_index + 1
        for i in range(N3248TE_FANS_PER_FANTRAY):
            self._fan_list.append(Fan(fantray_index, i))
示例#13
0
    def __init__(self, fantray_index):

        FanDrawerBase.__init__(self)
        # FanTray is 1-based in DellEMC platforms
        self.fantrayindex = fantray_index + 1
        for i in range(Z9332F_FANS_PER_FANTRAY):
            self._fan_list.append(Fan(fantray_index, i))
        self.fru = IpmiFru(self.FAN_FRU_MAPPING[self.fantrayindex])
示例#14
0
    def __init__(self, fantray_index):
        FanDrawerBase.__init__(self)
        # FanTray is 1-based in DellEMC platforms
        self.index = fantray_index + 1
        self.presence_reg = "fan{}_fault".format(2 * self.index - 1)
        self.serialno_reg = "fan{}_serialno".format(2 * self.index - 1)

        self._fan_list.append(Fan(self.index, dependency=self))
示例#15
0
    def __init__(self):
        super(Chassis, self).__init__()

        # 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(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 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)
示例#16
0
    def __init__(self, psu_index, sku):
        global psu_list
        PsuBase.__init__(self)
        # PSU is 1-based on Mellanox platform
        self.index = psu_index + 1
        psu_list.append(self.index)
        self.psu_path = "/var/run/hw-management/"
        psu_oper_status = "thermal/psu{}_pwr_status".format(self.index)
        #psu_oper_status should always be present for all SKUs
        self.psu_oper_status = os.path.join(self.psu_path, psu_oper_status)
        self._name = "PSU{}".format(psu_index + 1)

        if sku in hwsku_dict_psu:
            filemap = psu_profile_list[hwsku_dict_psu[sku]]
        else:
            filemap = psu_profile_list[0]

        if sku in hwsku_dict_with_unplugable_psu:
            self.always_presence = True
            self.psu_voltage = None
            self.psu_current = None
            self.psu_power = None
            self.psu_presence = None
            self.psu_temp = None
            self.psu_temp_threshold = None
        else:
            self.always_presence = False
            psu_voltage = filemap[PSU_VOLTAGE].format(self.index)
            psu_voltage = os.path.join(self.psu_path, psu_voltage)
            self.psu_voltage = psu_voltage

            psu_current = filemap[PSU_CURRENT].format(self.index)
            psu_current = os.path.join(self.psu_path, psu_current)
            self.psu_current = psu_current

            psu_power = filemap[PSU_POWER].format(self.index)
            psu_power = os.path.join(self.psu_path, psu_power)
            self.psu_power = psu_power

            psu_presence = "thermal/psu{}_status".format(self.index)
            psu_presence = os.path.join(self.psu_path, psu_presence)
            self.psu_presence = psu_presence

            self.psu_temp = os.path.join(
                self.psu_path, 'thermal/psu{}_temp'.format(self.index))
            self.psu_temp_threshold = os.path.join(
                self.psu_path, 'thermal/psu{}_temp_max'.format(self.index))

        # unplugable PSU has no FAN
        if sku not in hwsku_dict_with_unplugable_psu:
            fan = Fan(False, psu_index, psu_index, True)
            self._fan_list.append(fan)

        self.psu_green_led_path = "led_psu_green"
        self.psu_red_led_path = "led_psu_red"
        self.psu_orange_led_path = "led_psu_orange"
        self.psu_led_cap_path = "led_psu_capability"
示例#17
0
    def get_fan(self):
        """
        Retrieves object representing the fan module contained in this PSU
        Returns:
            An object dervied from FanBase representing the fan module
            contained in this PSU
        """
        fan_speed_path = FAN_E1031_SPEED_PATH.format(str(self.index + 3))
        try:
            with open(fan_speed_path) as fan_speed_file:
                fan_speed_rpm = int(fan_speed_file.read())
        except IOError:
            fan_speed = 0

        fan_speed = float(fan_speed_rpm) / FAN_MAX_RPM * 100
        fan = Fan(0)
        fan.fan_speed = int(fan_speed) if int(fan_speed) <= 100 else 100
        return fan
示例#18
0
 def __init__(self):
     self.config_data = {}
     for index in range(0, NUM_FAN):
         fan = Fan(index)
         self._fan_list.append(fan)
     for index in range(0, NUM_PSU):
         psu = Psu(index)
         self._psu_list.append(psu)
     ChassisBase.__init__(self)
示例#19
0
    def __init__(self):

        ChassisBase.__init__(self)
        # Initialize EEPROM
        self.sys_eeprom = Eeprom()
        for i in range(MAX_Z9100_FANTRAY):
            for j in range(MAX_Z9100_FAN):
                fan = Fan(i, j)
                self._fan_list.append(fan)
示例#20
0
    def __init__(self, psu_index, sku):
        global psu_list
        PsuBase.__init__(self)
        # PSU is 1-based on Mellanox platform
        self.index = psu_index + 1
        psu_list.append(self.index)
        self.psu_path = "/var/run/hw-management/"
        psu_oper_status = "thermal/psu{}_pwr_status".format(self.index)
        #psu_oper_status should always be present for all SKUs
        self.psu_oper_status = os.path.join(self.psu_path, psu_oper_status)
        self._name = "PSU{}".format(psu_index + 1)

        if sku in hwsku_dict_psu:
            filemap = psu_profile_list[hwsku_dict_psu[sku]]
        else:
            filemap = psu_profile_list[0]

        if sku in hwsku_dict_with_unplugable_psu:
            self.always_presence = True
            self.psu_voltage = None
            self.psu_current = None
            self.psu_power = None
            self.psu_presence = None
        else:
            self.always_presence = False
            psu_voltage = filemap[PSU_VOLTAGE].format(self.index)
            psu_voltage = os.path.join(self.psu_path, psu_voltage)
            self.psu_voltage = psu_voltage

            psu_current = filemap[PSU_CURRENT].format(self.index)
            psu_current = os.path.join(self.psu_path, psu_current)
            self.psu_current = psu_current

            psu_power = filemap[PSU_POWER].format(self.index)
            psu_power = os.path.join(self.psu_path, psu_power)
            self.psu_power = psu_power

            psu_presence = "thermal/psu{}_status".format(self.index)
            psu_presence = os.path.join(self.psu_path, psu_presence)
            self.psu_presence = psu_presence

        fan = Fan(sku, psu_index, psu_index, True)
        if fan.get_presence():
            self._fan_list.append(fan)
示例#21
0
    def __init__(self, index):
        PsuBase.__init__(self)
        fan = Fan(index, True)
        self._fan_list.append(fan)

        self.psu_index_mapping = {
            1: 39,
            2: 49,
        }
        self.psu_powerin_index_mapping = {
            1: 38,
            2: 48,
        }
        self.psu_currentout_index_mapping = {
            1: 36,
            2: 46,
        }
        self.psu_currentin_index_mapping = {
            1: 35,
            2: 45,
        }
        self.psu_voltageout_index_mapping = {
            1: 44,
            2: 54,
        }
        self.psu_voltagein_index_mapping = {
            1: 43,
            2: 53,
        }
        self.index = index
        self.psu_presence_attr = "power{}_present".format(
            self.psu_index_mapping[self.index])
        self.psu_status_attr = "curr{}_input".format(
            self.psu_currentout_index_mapping[self.index])
        self.psu_power_in_attr = "power{}_input".format(
            self.psu_powerin_index_mapping[self.index])
        self.psu_power_out_attr = "power{}_input".format(
            self.psu_index_mapping[self.index])
        self.psu_voltage_out_attr = "in{}_input".format(
            self.psu_voltageout_index_mapping[self.index])
        self.psu_current_out_attr = "curr{}_input".format(
            self.psu_currentout_index_mapping[self.index])
        self.psu_voltage_in_attr = "in{}_input".format(
            self.psu_voltagein_index_mapping[self.index])
        self.psu_current_in_attr = "curr{}_input".format(
            self.psu_currentin_index_mapping[self.index])
        self.psu_serial_attr = "power{}_sn".format(
            self.psu_index_mapping[self.index])
        self.psu_model_attr = "power{}_model".format(
            self.psu_index_mapping[self.index])
        self.psu_mfr_id_attr = "power{}_mfrid".format(
            self.psu_index_mapping[self.index])
        self.psu_capacity_attr = "power{}_pout_max".format(
            self.psu_index_mapping[self.index])
        self.psu_type_attr = "power{}_vin_type".format(
            self.psu_index_mapping[self.index])
示例#22
0
    def __init__(self):
        ChassisBase.__init__(self)

        for i in range(MAX_S6100_FAN):
            fan = Fan(i)
            self._fan_list.append(fan)

        for i in range(MAX_S6100_PSU):
            psu = Psu(i)
            self._psu_list.append(psu)
示例#23
0
文件: psu.py 项目: netgp2020/test3
    def _initialize_psu_fan(self):
        from sonic_platform.fan import Fan

        num_fan = self._fan_conf['psu_fan'][self._psu_index]["num_of_fan"]
        for fan_index in range(0, num_fan):
            fan = Fan(fan_index,
                      is_psu_fan=True,
                      psu_index=self._psu_index,
                      conf=self._fan_conf)
            self._fan_list.append(fan)
示例#24
0
    def _psu_fan_parser(self, fans):
        if not isinstance(fans, list):
            raise TypeError("fan type error fans: {}".format(fans))

        for i, f in enumerate(fans):
            if not isinstance(f, dict):
                raise TypeError("fan type must be a dict")

            fanname = "{}-fan{}".format(self.name, i + 1)
            self._fan_list.append(Fan(fanname, config=f, is_psu_fan=True))
    def __init__(self):
        self.config_data = {}
        ChassisBase.__init__(self)
        self._eeprom = Tlv()
        self._api_helper = APIHelper()

        for fant_index in range(0, NUM_FAN_TRAY):
            for fan_index in range(0, NUM_FAN):
                fan = Fan(fant_index, fan_index)
                self._fan_list.append(fan)
示例#26
0
    def __init__(self):
        ChassisBase.__init__(self)
        # sfp.py will read eeprom contents and retrive the eeprom data.
        # We pass the eeprom path from chassis.py
        self.PORT_START = 1
        self.PORT_END = 28
        self.SFP28_PORT_END = 24

        PORTS_IN_BLOCK = (self.PORT_END + 1)
        _sfp_port = range(1, self.SFP28_PORT_END + 1)
        eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"

        for index in range(self.PORT_START, PORTS_IN_BLOCK):
            port_num = index + 1
            eeprom_path = eeprom_base.format(port_num)
            if index not in _sfp_port:
                sfp_node = Sfp(index, 'QSFP', eeprom_path)
            else:
                sfp_node = Sfp(index, 'SFP', eeprom_path)
            self._sfp_list.append(sfp_node)

        self._eeprom = Eeprom()
        self._watchdog = Watchdog()
        self._num_sfps = self.PORT_END
        self._num_fans = MAX_S5224F_FAN * MAX_S5224F_FANTRAY

        for i in range(MAX_S5224F_THERMAL):
            thermal = Thermal(i)
            self._thermal_list.append(thermal)

        for i in range(MAX_S5224F_COMPONENT):
            component = Component(i)
            self._component_list.append(component)

        for i in range(MAX_S5224F_PSU):
            psu = Psu(i)
            self._psu_list.append(psu)

        for i in range(MAX_S5224F_FANTRAY):
            for j in range(MAX_S5224F_FAN):
                fan = Fan(i,j)
                self._fan_list.append(fan)

        for i in range(MAX_S5224F_FANTRAY):
            fandrawer = FanDrawer(i)
            self._fan_drawer_list.append(fandrawer)
            self._fan_list.extend(fandrawer._fan_list)

        for port_num in range(self.PORT_START, (self.PORT_END + 1)):
            # sfp get uses zero-indexing, but port numbers start from 1
            presence = self.get_sfp(port_num-1).get_presence()
            if presence:
                self._global_port_pres_dict[port_num] = '1'
            else:
                self._global_port_pres_dict[port_num] = '0'
示例#27
0
    def __init__(self):
        ChassisBase.__init__(self)
        self.__num_of_psus = 2
        self.__num_of_ports = 32
        self.__num_of_sfps = 0
        self.__num_of_fans = 5
        self.__num_of_thermals = 6

        # Initialize EEPROM
        self._eeprom = Eeprom()

        # Initialize watchdog
        #self._watchdog = Watchdog()

        # Initialize FAN
        for index in range(1, self.__num_of_fans + 1):
            fan = Fan(index)
            self._fan_list.append(fan)

        # Initialize thermal
        for index in range(1, self.__num_of_thermals + 1):
            thermal = Thermal(index)
            self._thermal_list.append(thermal)

        # Initialize PSU and PSU_FAN
        for index in range(1, self.__num_of_psus + 1):
            psu = Psu(index)
            self._psu_list.append(psu)
            fan = Fan(index, True)
            self._fan_list.append(fan)

        # Initialize SFP
        for index in range(0, self.__num_of_ports):
            if index in range(0, self.__num_of_sfps):
                sfp = Sfp(index, 'SFP')
            else:
                sfp = Sfp(index, 'QSFP')

            self._sfp_list.append(sfp)

        # Initialize TRANSCEIVER EVENT
        self.__xcvr_event = TransceiverEvent()
示例#28
0
 def __init__(self):
     self.config_data = {}
     for index in range(0, NUM_FAN):
         fan = Fan(index)
         self._fan_list.append(fan)
     for index in range(0, NUM_PSU):
         psu = Psu(index)
         self._psu_list.append(psu)
     ChassisBase.__init__(self)
     self._component_device = Device("component")
     self._component_name_list = self._component_device.get_name_list()
示例#29
0
 def __init__(self):
     self.config_data = {}
     for index in range(0, NUM_FAN):
         fan = Fan(index)
         self._fan_list.append(fan)
     for index in range(0, NUM_PSU):
         psu = Psu(index)
         self._psu_list.append(psu)
     ChassisBase.__init__(self)
     self._component_name_list = COMPONENT_NAME_LIST
     self._watchdog = Watchdog()
示例#30
0
    def __init__(self, fantray_index):
        FanDrawerBase.__init__(self)
        # FanTray is 1-based in DellEMC platforms
        self.index = fantray_index + 1
        self.eeprom = Eeprom(is_fantray=True, fantray_index=self.index)
        self.fantray_presence_reg = "fan_prs"
        self.fantray_led_reg = "fan{}_led".format(self.index - 1)
        self.supported_led_color = ['off', 'green', 'amber']

        for i in range(1, MAX_S6000_FANS_PER_FANTRAY + 1):
            self._fan_list.append(
                Fan(fantray_index=self.index, fan_index=i, dependency=self))
示例#31
0
 def __init__(self, psu_index):
     PsuBase.__init__(self)
     self.index = psu_index + 1 # PSU is 1-based in DellEMC platforms
     self.psu_presence_reg = "psu{}_prs".format(psu_index)
     self.psu_status = "psu{}_status".format(psu_index)
     self.eeprom = "/sys/bus/i2c/devices/{}-0056/eeprom".format(10+psu_index)
     self.psu_voltage_reg = 'in3_input'
     self.psu_current_reg = 'curr2_input'
     self.psu_power_reg = 'power2_input'
     self.dps_hwmon = "/sys/bus/i2c/devices/{}-005e/hwmon/".format(10 + psu_index)
     self.dps_hwmon_exist = os.path.exists(self.dps_hwmon)
     self._fan_list.append(Fan(fan_index=self.index, psu_fan=True, dependency=self))