def __init__(self):
        self._sfp_list = []

        ChassisBase.__init__(self)
        for index in range(0, NUM_THERMAL):
            thermal = Thermal(index)
            self._thermal_list.append(thermal)
        self.fanled = FanLed()
        for index in range(0, NUM_FANDRAWER):
            fan_drawer = FanDrawer(index)
            for i in range(0, NUM_FANSPERDRAWER):
                fan_index = NUM_FANSPERDRAWER * index + i
                fan = Fan(fan_index)
                fan.fanled = self.fanled
                fan_drawer._fan_list.append(fan)
                self._fan_list.append(fan)
                self.fanled._fan_list.append(fan)
            self._fan_drawer_list.append(fan_drawer)
        self.fanled.update_status()
        self.psuled = PsuLed()
        for index in range(0, NUM_PSU):
            psu = Psu(index)
            psu.psuled = self.psuled
            self._psu_list.append(psu)
            self.psuled._psu_list.append(psu)
        self.psuled.update_status()
        for index in range(0, NUM_SFP):
            if (index < 32):
                sfp = Sfp(index, 'QSFP')
            else:
                sfp = Sfp(index, 'SFP')
            self._sfp_list.append(sfp)
        for index in range(0, NUM_COMPONENT):
            component = Component(index)
            self._component_list.append(component)
示例#2
0
    def __init__(self, thermal_index):
        self.index = thermal_index + 1
        self.is_psu_thermal = False
        self.dependency = None

        if self.index < 9:
            i2c_path = self.I2C_DIR + self.I2C_DEV_MAPPING[self.index - 1][0]
            hwmon_temp_index = self.I2C_DEV_MAPPING[self.index - 1][1]
            hwmon_temp_suffix = "max"
            hwmon_node = os.listdir(i2c_path)[0]
            self.HWMON_DIR = i2c_path + hwmon_node + '/'

            if self.index == 4:
                hwmon_temp_suffix = "crit"

            if self.index > 4:
                self.is_psu_thermal = True
                self.dependency = Psu(self.index / 7)
        else:
            dev_path = "/sys/devices/platform/coretemp.0/hwmon/"
            hwmon_temp_index = self.index - 7
            hwmon_temp_suffix = "crit"
            hwmon_node = os.listdir(dev_path)[0]
            self.HWMON_DIR = dev_path + hwmon_node + '/'

        self.thermal_temperature_file = self.HWMON_DIR \
            + "temp{}_input".format(hwmon_temp_index)
        self.thermal_high_threshold_file = self.HWMON_DIR \
            + "temp{}_{}".format(hwmon_temp_index, hwmon_temp_suffix)
        self.thermal_low_threshold_file = self.HWMON_DIR \
            + "temp{}_min".format(hwmon_temp_index)
示例#3
0
    def __init__(self):
        ChassisBase.__init__(self)

        self._eeprom = Eeprom()

        for index in range(Sfp.port_start(), Sfp.port_end() + 1):
            sfp_node = Sfp(index)
            self._sfp_list.append(sfp_node)

        for i in range(1, Psu.get_num_psus() + 1):
            psu = Psu(i)
            self._psu_list.append(psu)
示例#4
0
    def __init__(self):
        ChassisBase.__init__(self)
        SFP_PORT_END = Sfp.port_end()
        PORTS_IN_BLOCK = (SFP_PORT_END + 1)
        MAX_PSU = Psu.get_num_psus()

        self._eeprom = Eeprom()

        for index in range(0, PORTS_IN_BLOCK):
            sfp_node = Sfp(index)
            self._sfp_list.append(sfp_node)

        for i in range(1, MAX_PSU + 1):
            psu = Psu(i)
            self._psu_list.append(psu)
示例#5
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)
示例#6
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")
示例#7
0
    def __init__(self):
        ChassisBase.__init__(self)

        # Initialize EEPROM
        self._eeprom = Eeprom()
        self._eeprom_data = self._eeprom.get_eeprom_data()

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

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

        # Initialize SFP
        for index in range(self.__num_of_sfps):
            sfp = QSfp(index)  #only qsfp on platform D6332
            self._sfp_list.append(sfp)

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

        # Initialize COMPONENT
        for index in range(self.__num_of_components):
            component = Component(index)
            self._component_list.append(component)

        # Initialize WATCHDOG
        self._watchdog = Watchdog()
示例#8
0
    def __init__(self):

        ChassisBase.__init__(self)
        self.status_led_reg = "sys_status_led"
        self.supported_led_color = [
            'green', 'blinking green', 'amber', 'blinking amber'
        ]
        # Initialize EEPROM
        self._eeprom = Eeprom()
        for i in range(MAX_S6100_MODULE):
            module = Module(i)
            self._module_list.append(module)
            self._sfp_list.extend(module._sfp_list)

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

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

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

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

        self._watchdog = Watchdog()
        self._transceiver_presence = self._get_transceiver_presence()
示例#9
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.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 = 'SFP' if index in _sfp_port else 'QSFP'
            sfp_node = Sfp(index, port_type, eeprom_path)
            self._sfp_list.append(sfp_node)

        self._eeprom = Eeprom()
        self._watchdog = Watchdog()
        for i in range(MAX_Z9332F_FANTRAY):
            fandrawer = FanDrawer(i)
            self._fan_drawer_list.append(fandrawer)
            self._fan_list.extend(fandrawer._fan_list)

        self._num_sfps = self.PORT_END
        self._num_fans = MAX_Z9332F_FANTRAY * MAX_Z9332F_FAN
        self._psu_list = [Psu(i) for i in range(MAX_Z9332F_PSU)]
        self._thermal_list = [Thermal(i) for i in range(MAX_Z9332F_THERMAL)]
        self._component_list = [
            Component(i) for i in range(MAX_Z9332F_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'

        self._watchdog = Watchdog()
示例#10
0
    def __init__(self):

        ChassisBase.__init__(self)
        # Initialize EEPROM
        self._eeprom = Eeprom()
        for i in range(MAX_S6100_MODULE):
            module = Module(i)
            self._module_list.append(module)
            self._sfp_list.extend(module._sfp_list)

        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)

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

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

        self._watchdog = Watchdog()
        self._transceiver_presence = self._get_transceiver_presence()
示例#11
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()
示例#12
0
    def test_psu_fan_set_speed(self):
        psu = Psu(0)
        fan = PsuFan(0, 1, psu)
        subprocess.check_call = MagicMock()
        mock_file_content = {
            fan.psu_i2c_bus_path: 'bus',
            fan.psu_i2c_addr_path: 'addr',
            fan.psu_i2c_command_path: 'command'
        }

        def mock_read_str_from_file(file_path,
                                    default='',
                                    raise_exception=False):
            return mock_file_content[file_path]

        utils.read_str_from_file = mock_read_str_from_file
        fan.set_speed(60)
        assert subprocess.check_call.call_count == 0
        fan.get_presence = MagicMock(return_value=True)
        assert fan.set_speed(60)
        subprocess.check_call.assert_called_with(
            "i2cset -f -y {0} {1} {2} {3} wp".format('bus', 'addr', 'command',
                                                     hex(60)),
            shell=True,
            universal_newlines=True)
        subprocess.check_call = MagicMock(
            side_effect=subprocess.CalledProcessError('', ''))
        assert not fan.set_speed(60)
        subprocess.check_call = MagicMock()
        utils.read_str_from_file = MagicMock(side_effect=RuntimeError(''))
        assert not fan.set_speed(60)
示例#13
0
    def __init__(self):
        # Initialize EEPROM and watchdog
        self._eeprom = Eeprom()
        self._watchdog = Watchdog()

        #Initialize FAN object
        for index in range(0, NUM_FAN_TRAY):
            fan = Fan(index)
            self._fan_list.append(fan)

        # Initialize PSU and PSU_fan object
        for index in range(0, NUM_PSU):
            psu = Psu(index)
            self._psu_list.append(psu)
            fan = Fan(index, True)
            self._fan_list.append(fan)

        # Initialize SFP/QSFP object
        for index in range(0, NUM_PORTS):
            if index < QSFP_START:
                sfp = Sfp(index)
            else:
                sfp = QSfp(index)
            self._sfp_list.append(sfp)

        # Initialize Thermal object
        for index in range(0, NUM_THERMAL):
            thermal = Thermal(index)
            self._thermal_list.append(thermal)

        # Initialize Component object
        for index in range(0, NUM_COMPONENT):
            component = Component(index)
            self._component_list.append(component)
示例#14
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'
示例#15
0
 def initialize_psu(self):
     from sonic_platform.psu import Psu
     # Initialize PSU list
     self.psu_module = Psu
     for index in range(MLNX_NUM_PSU):
         psu = Psu(index, self.sku_name)
         self._psu_list.append(psu)
示例#16
0
    def __init__(self):

        ChassisBase.__init__(self)
        # Initialize EEPROM
        self.sys_eeprom = Eeprom()
        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)

        self._populate_port_i2c_mapping()

        # sfp.py will read eeprom contents and retrive the eeprom data.
        # It will also provide support sfp controls like reset and setting
        # low power mode.
        # We pass the eeprom path and sfp control path from chassis.py
        # So that sfp.py implementation can be generic to all platforms
        eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/i2c-{1}/{1}-0050/eeprom"
        sfp_ctrl_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-003e/"
        for index in range(0, self.PORTS_IN_BLOCK):
            eeprom_path = eeprom_base.format(self.EEPROM_I2C_MAPPING[index][0],
                                             self.EEPROM_I2C_MAPPING[index][1])
            sfp_control = sfp_ctrl_base.format(self.PORT_I2C_MAPPING[index])
            sfp_node = Sfp(index, 'QSFP', eeprom_path, sfp_control, index)
            self._sfp_list.append(sfp_node)
示例#17
0
    def __init__(self):

        ChassisBase.__init__(self)
        # Initialize EEPROM
        self.sys_eeprom = Eeprom()
        for i in range(MAX_S6100_MODULE):
            module = Module(i)
            self._module_list.append(module)

        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)

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

        # Initialize component list
        self._component_name_list.append(COMPONENT_BIOS)
        self._component_name_list.append(SWITCH_CPLD)
        self._component_name_list.append(SMF_FPGA)
示例#18
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 = 66
        PORTS_IN_BLOCK = (self.PORT_END + 1)
        _sfp_port = range(65, self.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()

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

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

        for port_num in range(self.PORT_START, (self.PORT_END + 1)):
            presence = self.get_sfp(port_num).get_presence()
            if presence:
                self._global_port_pres_dict[port_num] = '1'
            else:
                self._global_port_pres_dict[port_num] = '0'
示例#19
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)
示例#20
0
    def __init__(self):
        ChassisBase.__init__(self)

        self.data = {'valid': 0, 'last': 0}
        self.sfp_presence = {}

        if os.path.isdir(CONTAINER_PLATFORM_PATH):
            platform_path = CONTAINER_PLATFORM_PATH
        else:
            platform = device_info.get_platform()
            if platform is None:
                raise
            platform_path = os.path.join(HOST_DEVICE_PATH, platform)

        port_config_file = "/".join(
            [platform_path, "V682-48y8c", "port_config.ini"])
        try:
            f = open(port_config_file)
        except:
            raise
        for line in f:
            line.strip()
            if re.search('^#', line) is not None:
                Port_cfg = collections.namedtuple('Port_cfg', line.split()[1:])
                break
        f.close()
        f = open(port_config_file)
        _port_cfgs = [
            Port_cfg(*tuple((line.strip().split()))) for line in f
            if re.search('^#', line) is None
        ]
        f.close()

        # Initialize EEPROM
        self._eeprom = Eeprom()

        # Initialize FAN
        for i in range(NUM_FAN_TRAY):
            fandrawer = FanDrawer(i + 1)
            self._fan_drawer_list.append(fandrawer)
            self._fan_list.extend(fandrawer._fan_list)

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

        # Initialize THERMAL
        for index in range(0, NUM_THERMAL):
            thermal = Thermal(index)
            self._thermal_list.append(thermal)

        # Initialize SFP
        for port_cfg in _port_cfgs:
            sfp = Sfp(int(port_cfg.index),
                      'SFP' if int(port_cfg.index) < 48 else 'QSFP')
            self._sfp_list.append(sfp)
            self.sfp_presence[int(port_cfg.index)] = False
示例#21
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)
示例#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
    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'
示例#24
0
    def __initialize_psu(self):
        from sonic_platform.psu import Psu

        psu_config_path = self._api_common.get_config_path(self.PSU_CONFIG)
        self.psu_config = self._api_common.load_json_file(
            psu_config_path)["psus"]

        if self.psu_config:
            for index in range(0, len(self.psu_config)):
                psu = Psu(index, config=self.psu_config[index])
                self._psu_list.append(psu)
示例#25
0
    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()
示例#26
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()
示例#27
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()
示例#28
0
    def __init__(self):

        ChassisBase.__init__(self)
        # Initialize EEPROM
        self.sys_eeprom = Eeprom()
        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)
示例#29
0
    def __initialize_psu(self):
        from sonic_platform.psu import Psu

        psu_config_path = os.path.join(self._api_config, self.PSU_CONFIG)
        psu_config = self._api_common.load_json_file(psu_config_path)

        if psu_config:
            psu_index = 0
            for index in range(0, psu_config['psu_num']):
                psu = Psu(psu_index, conf=psu_config)
                psu_index += 1
                self._psu_list.append(psu)
示例#30
0
    def __init__(self):
        ChassisBase.__init__(self)
        self.status_led_reg = "system_led"
        self.supported_led_color = [
            'green', 'blinking green', 'amber', 'blinking amber'
        ]
        # Initialize SFP list
        self.PORT_START = 0
        self.PORT_END = 31
        EEPROM_OFFSET = 20
        PORTS_IN_BLOCK = (self.PORT_END + 1)

        # sfp.py will read eeprom contents and retrive the eeprom data.
        # It will also provide support sfp controls like reset and setting
        # low power mode.
        # We pass the eeprom path and sfp control path from chassis.py
        # So that sfp.py implementation can be generic to all platforms
        eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"
        self.sfp_control = "/sys/devices/platform/dell-s6000-cpld.0/"

        for index in range(0, PORTS_IN_BLOCK):
            eeprom_path = eeprom_base.format(index + EEPROM_OFFSET)
            sfp_node = Sfp(index, 'QSFP', eeprom_path, self.sfp_control, index)
            self._sfp_list.append(sfp_node)

        # Get Transceiver status
        self.modprs_register = self._get_transceiver_status()

        with open("/sys/class/dmi/id/product_name", "r") as fd:
            board_type = fd.read()

        if 'S6000-ON' in board_type:
            self._eeprom = Eeprom()
        else:
            self._eeprom = EepromS6000()

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

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

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

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