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()
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()
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)
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'
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()
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()
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 = 54 self.PORTS_IN_BLOCK = (self.PORT_END + 1) self.SFP_PORT_START = 49 self._sfp_port = range(self.SFP_PORT_START, 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 = '' if index in self._sfp_port: eeprom_path = eeprom_base.format( self._sfpp_port_to_i2c_mapping[index]) if (index < 53): port_type = 'SFP' else: port_type = 'QSFP' sfp_node = Sfp(index, port_type, eeprom_path) self._sfp_list.append(sfp_node) self._eeprom = Eeprom() self._watchdog = Watchdog() self._num_sfps = 54 self._num_fans = MAX_N3248TE_FANTRAY * MAX_N3248TE_FAN for k in range(MAX_N3248TE_FANTRAY): fandrawer = FanDrawer(k) self._fan_drawer_list.append(fandrawer) self._fan_list.extend(fandrawer._fan_list) self._psu_list = [Psu(i) for i in range(MAX_N3248TE_PSU)] self._thermal_list = [Thermal(i) for i in range(MAX_N3248TE_THERMAL)] self._component_list = [ Component(i) for i in range(MAX_N3248TE_COMPONENT) ] for port_num in self._sfp_port: # 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' self._watchdog = Watchdog() self.status_led_reg = "system_led" self.locator_led_reg = "locator_led" self.LOCATOR_LED_ON = "blink_blue" self.LOCATOR_LED_OFF = self.STATUS_LED_COLOR_OFF
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 _sfp_port = list(range(33, PORTS_IN_BLOCK)) i2c_bus_for_port = 2 i2c_mux_to_populate = 603 i2c_mux_address = 70 i2c_mux_is_good = False eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" mux_channel = "/sys/class/i2c-adapter/i2c-{0}/{0}-00{1}/channel-0" for index in range(PORT_START, PORTS_IN_BLOCK): eeprom_path = "" if index % 8 == 1: # 8 buses per i2c mux i2c_mux_is_good = True if os.path.exists( mux_channel.format(i2c_mux_to_populate, i2c_mux_address)) else False i2c_mux_to_populate += 1 i2c_mux_address += 1 if i2c_mux_is_good: eeprom_path = eeprom_base.format(i2c_bus_for_port) i2c_bus_for_port += 1 port_type = 'QSFP_DD' if index not 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 = PORT_END self._num_fans = MAX_Z9432F_FANTRAY * MAX_Z9432F_FAN for i in range(MAX_Z9432F_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_Z9432F_PSU)] self._thermal_list = [Thermal(i) for i in range(MAX_Z9432F_THERMAL)] self._component_list = [ Component(i) for i in range(MAX_Z9432F_COMPONENT) ] for port_num in range(PORT_START, PORTS_IN_BLOCK): presence = self.get_sfp(port_num).get_presence() self._global_port_pres_dict[port_num] = '1' if presence else '0' self._watchdog = Watchdog()
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'
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()
def get_watchdog(self): """ Retreives hardware watchdog device on this chassis Returns: An object derived from WatchdogBase representing the hardware watchdog device """ if self._watchdog is None: from sonic_platform.watchdog import Watchdog self._watchdog = Watchdog() return self._watchdog
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() self._watchdog = Watchdog()
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) #SFP ports sfp_port = 11 for index in range(64, 66): eeprom_path = "/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom".format( sfp_port) sfp_control = "" sfp_node = Sfp(index, 'SFP', eeprom_path, sfp_control, index) self._sfp_list.append(sfp_node) sfp_port = sfp_port + 1 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) bios_ver = self.get_component(0).get_firmware_version() bios_minor_ver = bios_ver.split("-")[-1] if bios_minor_ver.isdigit() and (int(bios_minor_ver) >= 9): self._watchdog = WatchdogTCO() else: self._watchdog = Watchdog() self._transceiver_presence = self._get_transceiver_presence()
def __init__(self): ChassisBase.__init__(self) # logger.set_min_log_priority_info() # Chassis specific slot numbering self.is_chassis_modular = nokia_common.is_chassis_modular() self.cpm_instance = nokia_common._get_cpm_slot() self.my_instance = nokia_common._get_my_slot() self.is_cpm = nokia_common.is_cpm() # Create a GRPC channel self.chassis_stub = None self.fan_stub = None self.thermal_stub = None self.psu_stub = None self.firmware_stub = None # Get maximum power consumed by each module like cards, fan-trays etc self._get_modules_consumed_power() # Module list self.get_module_list() # PSU list self._get_psu_list() # FAN list self._get_fantray_list() # Thermal list self.get_thermal_list() # Component List self._get_component_list() # SFP self.sfp_module_initialized = False self.sfp_event_initialized = False # Watchdog if self._watchdog is None: self._watchdog = Watchdog("dog") logger.log_info('HW Watchdog initialized') # system eeprom self._eeprom = Eeprom()
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 = list(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() self._watchdog = Watchdog() for i in range(MAX_Z9264F_COMPONENT): component = Component(i) self._component_list.append(component) for i in range(MAX_Z9264F_PSU): psu = Psu(i) self._psu_list.append(psu) for i in range(MAX_Z9264F_FANTRAY): for j in range(MAX_Z9264F_FAN): fan = Fan(i, j) self._fan_list.append(fan) 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'
def get_watchdog(self): """ Retreives hardware watchdog device on this chassis Returns: An object derived from WatchdogBase representing the hardware watchdog device """ try: if self._watchdog is None: from sonic_platform.watchdog import Watchdog # Create the watchdog Instance self._watchdog = Watchdog() except Exception as e: syslog.syslog(syslog.LOG_ERR, "Fail to load watchdog due to {}".format(e)) return self._watchdog
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) for index in range(0, NUM_THERMAL): thermal = Thermal(index) self._thermal_list.append(thermal) for index in range(0, NUM_SFP): sfp = Sfp(index) self._sfp_list.append(sfp) ChassisBase.__init__(self) self._component_name_list = COMPONENT_NAME_LIST self._watchdog = Watchdog() self._eeprom = Tlv()
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) for index in range(0, NUM_THERMAL): thermal = Thermal(index) self._thermal_list.append(thermal) for index in range(0, NUM_SFP): sfp = Sfp(index) self._sfp_list.append(sfp) ChassisBase.__init__(self) self._reboot_cause_path = HOST_REBOOT_CAUSE_PATH if self.__is_host( ) else PMON_REBOOT_CAUSE_PATH self._component_name_list = COMPONENT_NAME_LIST self._watchdog = Watchdog() self._eeprom = Tlv()
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) for index in range(0, NUM_SFP): sfp = Sfp(index) self._sfp_list.append(sfp) for index in range(0, NUM_COMPONENT): component = Component(index) self._component_list.append(component) self._watchdog = Watchdog() self._eeprom = Tlv()
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): fandrawer = FanDrawer(index) self._fan_drawer_list.append(fandrawer) self._fan_list.extend(fandrawer._fan_list) # 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): if index < self.__start_of_qsfp: sfp = Sfp(index) else: sfp = QSfp(index) 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()
def __initialize_watchdog(self): from sonic_platform.watchdog import Watchdog self._watchdog = Watchdog()