示例#1
0
    def __init__(self, inventory):
        ChassisBase.__init__(self)
        self._prefdl = readPrefdl()
        self._inventory = inventory
        for fan in self._inventory.getFans():
            self._fan_list.append(Fan(fan))
        for psu in self._inventory.getPsus():
            self._psu_list.append(Psu(psu))
        for sfp in self._inventory.getXcvrs().values():
            self._sfp_list.append(Sfp(sfp))
        self._watchdog = Watchdog(self._inventory.getWatchdog())

        self._interrupt_dict, self._presence_dict = \
           self._get_interrupts_for_components()
示例#2
0
文件: chassis.py 项目: orNvidia/sonic
    def __init__(self, platform):
        ChassisBase.__init__(self)
        self._platform = platform
        self._eeprom = Eeprom(readPrefdl())
        self._inventory = platform.getInventory()
        if isinstance(platform, Supervisor):
            chassis = platform.getChassis()
            for supervisor in chassis.iterSupervisors(presentOnly=False):
                if supervisor is not None:
                    self._module_list.append(SupervisorModule(supervisor))
            chassis.loadFabrics()
            for fabric in chassis.iterFabrics(presentOnly=False):
                self._module_list.append(FabricModule(fabric))
            chassis.loadLinecards()
            for fabric in chassis.iterLinecards(presentOnly=False):
                self._module_list.append(LinecardModule(fabric))

        if self._inventory.getFanSlots():
            for slot in self._inventory.getFanSlots():
                self._fan_drawer_list.append(FanDrawer(self, slot))
        else:
            # TODO: Remove this block of code once FanDrawer is implemented everywhere
            for fan in self._inventory.getFans():
                self._fan_list.append(Fan(None, fan))
            for fan in self._fan_list:
                self._fan_drawer_list.append(FanDrawerLegacy(fan))
        for slot in self._inventory.getPsuSlots():
            self._psu_list.append(Psu(slot))

        self._sfp_list = []
        xcvrsRange = self._inventory.getXcvrsRange()
        if xcvrsRange:
            self._sfp_list = [None] * len(xcvrsRange)
            for index, slot in self._inventory.getXcvrSlots().items():
                self._sfp_list[index - 1] = Sfp(index, slot)

        for thermal in self._inventory.getTemps():
            self._thermal_list.append(Thermal(thermal))

        watchdogs = self._inventory.getWatchdogs()
        if watchdogs:
            self._watchdog = Watchdog(watchdogs[0])

        self._interrupt_dict, self._presence_dict = \
           self._get_interrupts_for_components()
示例#3
0
文件: chassis.py 项目: vboykox/sonic
    def __init__(self, inventory):
        ChassisBase.__init__(self)
        self._prefdl = readPrefdl()
        self._inventory = inventory
        for fan in self._inventory.getFans():
            self._fan_list.append(Fan(fan))
        for psu in self._inventory.getPsus():
            self._psu_list.append(Psu(psu))
        self._sfp_list = []
        if inventory and inventory.portEnd:
            self._sfp_list = [None] * (inventory.portEnd + 1)
            for index, sfp in self._inventory.getXcvrs().items():
                self._sfp_list[index] = Sfp(index, sfp)
        for thermal in self._inventory.getTemps():
            self._thermal_list.append(Thermal(thermal))
        self._watchdog = Watchdog(self._inventory.getWatchdog())

        self._interrupt_dict, self._presence_dict = \
           self._get_interrupts_for_components()
示例#4
0
    def __init__(self, platform):
        ChassisBase.__init__(self)
        self._platform = platform
        self._prefdl = readPrefdl()
        # Because of syseepromd, self._eeprom has to be populated correctly or
        # not at all
        #self._eeprom = Eeprom(self._prefdl)
        self._inventory = platform.getInventory()
        if isinstance(platform, Supervisor):
            chassis = platform.getChassis()
            for supervisor in chassis.iterSupervisors(presentOnly=False):
                if supervisor is not None:
                    self._module_list.append(SupervisorModule(supervisor))
            chassis.loadFabrics()
            for fabric in chassis.iterFabrics(presentOnly=False):
                self._module_list.append(FabricModule(fabric))
            chassis.loadLinecards()
            for fabric in chassis.iterLinecards(presentOnly=False):
                self._module_list.append(LinecardModule(fabric))

        if self._inventory.getFanSlots():
            for slot in self._inventory.getFanSlots():
                self._fan_drawer_list.append(FanDrawer(self, slot))
        else:
            # TODO: Remove this block of code once FanDrawer is implemented everywhere
            for fan in self._inventory.getFans():
                self._fan_list.append(Fan(None, fan))
            for fan in self._fan_list:
                self._fan_drawer_list.append(FanDrawerLegacy(fan))
        for slot in self._inventory.getPsuSlots():
            self._psu_list.append(Psu(slot))
        self._sfp_list = []
        if self._inventory and self._inventory.portEnd:
            self._sfp_list = [None] * (self._inventory.portEnd)
            for index, sfp in self._inventory.getXcvrs().items():
                self._sfp_list[index - 1] = Sfp(index, sfp)
        for thermal in self._inventory.getTemps():
            self._thermal_list.append(Thermal(thermal))
        self._watchdog = Watchdog(self._inventory.getWatchdog())

        self._interrupt_dict, self._presence_dict = \
           self._get_interrupts_for_components()