def __init__(self): eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for x in range(0, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' for x in range(0, self._port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x + 1]) self._port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/kernel/sfp/eeprom_sfp_{0}" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) SfpUtilBase.__init__(self)
def __init__(self): # Enable optical SFP Tx if smbus_present == 0: os.system("i2cset -y -m 0x0f 0 0x41 0x5 0x00") else: bus = smbus.SMBus(0) DEVICE_ADDRESS = 0x41 DEVICEREG = 0x5 OPTIC_E = bus.read_byte_data(DEVICE_ADDRESS, DEVICEREG) OPTIC_E = OPTIC_E & 0xf0 bus.write_byte_data(DEVICE_ADDRESS, DEVICEREG, OPTIC_E) # Mux Ordering mux_dev = sorted(glob.glob("/sys/class/i2c-adapter/i2c-0/i2c-[0-9]")) # Enable optoe2 Driver eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" bus_path = "/sys/class/i2c-adapter/i2c-{0}/" y = 0 for x in range(self.port_start, self.port_end + 1): mux_dev_num = mux_dev[y] self.port_to_i2c_mapping[x] = mux_dev_num[-1] y = y + 1 port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) #print port_eeprom_path if not os.path.exists(port_eeprom_path): bus_dev_path = bus_path.format(self.port_to_i2c_mapping[x]) os.system("echo optoe2 0x50 > " + bus_dev_path + "/new_device") self.port_to_eeprom_mapping[x] = port_eeprom_path self._port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): # Override port_to_eeprom_mapping for class initialization eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x+1]) self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): # Override port_to_eeprom_mapping for class initialization if not os.path.exists("/sys/class/gpio/gpio50/"): os.system("echo 50 > /sys/class/gpio/gpiochip32/subsystem/export") if not os.path.exists("/sys/class/gpio/gpio52/"): os.system("echo 52 > /sys/class/gpio/gpiochip32/subsystem/export") os.system("echo out > /sys/class/gpio/gpio50/direction") os.system("echo out > /sys/class/gpio/gpio52/direction ") if not os.path.exists("/sys/bus/i2c/devices/0-0050"): os.system( "echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-0/new_device") eeprom_path = '/sys/bus/i2c/devices/0-0050/eeprom' for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path # Enable optical SFP Tx if smbus_present == 0: os.system("i2cset -y -m 0x0f 0 0x41 0x5 0x00") else: bus = smbus.SMBus(0) DEVICE_ADDRESS = 0x41 DEVICEREG = 0x5 OPTIC_E = bus.read_byte_data(DEVICE_ADDRESS, DEVICEREG) OPTIC_E = OPTIC_E & 0xf0 bus.write_byte_data(DEVICE_ADDRESS, DEVICEREG, OPTIC_E) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for x in range(self.port_start, self.port_end + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format(x + 1) self.init_global_port_presence() SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' for x in range(self._port_start, self._port_end + 1): port_eeprom_path = eeprom_path.format(self._port_to_i2c_mapping[x]) self._port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): # Override port_to_eeprom_mapping for class initialization eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' for x in range(self.PORT_START, self.PORT_END + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): for x in range(0, self.port_end): self.port_to_eeprom_mapping[x] = self.LOCAL_OOM_PATH % x SfpUtilBase.__init__(self) pim = PimUtil() pim.init_pim_fpga()
def __init__(self): # Override port_to_eeprom_mapping for class initialization eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' # QSFP port eeprom path setting for x in range(self.port_start, self.QSFPDD_PORT_START): port = x ret, bus_num = self._qsfp_get_bus_num(port) if ret != 0: print("get qsfp port {0} bus num failed".format(port)) else: port_eeprom_path = eeprom_path.format(bus_num) self.port_to_eeprom_mapping[x] = port_eeprom_path # QSFPDD port eeprom path setting for x in range(self.QSFPDD_PORT_START, self.PORTS_IN_BLOCK): port = x - self.QSFPDD_PORT_START ret, bus_num = self._qsfpdd_get_bus_num(port) if ret != 0: print("get qsfpdd port {0} bus num failed".format(port)) else: port_eeprom_path = eeprom_path.format(bus_num) self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' for x in range(0, self.port_end+1): self.port_to_eeprom_mapping[x] = eeprom_path.format( self._port_to_i2c_mapping[x]) SfpUtilBase.__init__(self)
def __init__(self): path = self.eeprom_path for x in range(self.first_port, self.last_port + 1): index = (x % 8) i2c_index = (x / 8) + 1 self.port_to_eeprom[x] = path.format(self.port_to_i2cbus_mapping[i2c_index], (index + 1)) SfpUtilBase.__init__(self)
def __init__(self): for x in range(0, self.port_end+1): self.port_to_eeprom_mapping[x] = self.BASE_OOM_PATH + self.port_to_i2c_mapping[x] + "/eeprom1" self._transceiver_presence = {} SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' for x in range(self.port_start, self.port_end + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format( self._port_to_i2c_mapping[x]) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon7/qsfp{0}_eeprom" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) SfpUtilBase.__init__(self)
def __init__(self): self.SONIC_PORT_NAME_PREFIX = "Ethernet" self.PORT_START = 1 self.PORT_END = 26 self.SFP_BASE = 1 self.PORTS_IN_BLOCK = 26 self.logical = [] self.physical_to_logical = {} self.logical_to_physical = {} self.eeprom_mapping = {} self.f_sfp_present = "/sys/class/sfp/sfp{}/sfp_presence" self.f_sfp_enable = "/sys/class/sfp/sfp{}/sfp_enable" for x in range(self.port_start, self.sfp_base): self.eeprom_mapping[x] = None for x in range(self.sfp_base, self.port_end + 1): self.eeprom_mapping[x] = "/sys/class/sfp/sfp{}/sfp_eeprom".format( x - self.sfp_base + 1) self.presence = {} for x in range(self.sfp_base, self.port_end + 1): self.presence[x] = False SfpUtilBase.__init__(self) for x in range(self.sfp_base, self.port_end + 1): self.logical.append('Ethernet' + str(x))
def __init__(self): eeprom_path = self.BASE_OOM_PATH + "eeprom" for x in range(self.port_start, self.port_end + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format( self._port_to_i2c_mapping[x]) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for x in range(0, self.port_end + 1): if x > self.port_start_qsfp -1 and x < self.port_end + 1: self.get_response(x) self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) SfpUtilBase.__init__(self)
def __init__(self): gpio_sfp_base_init() eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for x in range(0, self.port_end + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format( self.port_to_i2cbus_mapping[x]) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = self.BASE_PATH + "data_a0" for x in range(0, self.port_end + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format( self._port_to_i2c_mapping[x]) SfpUtilBase.__init__(self)
def __init__(self): for x in range(self.PORT_START, self.PORTS_IN_BLOCK): self.port_to_i2cbus_mapping[x] = (x + self.EEPROM_OFFSET) if self.get_presence(x): self.port_dict[x] = self.SFP_STATUS_INSERTED else: self.port_dict[x] = self.SFP_STATUS_REMOVED SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = self.BASE_OOM_PATH + "eeprom" for x in range(0, self.port_end + 1): bus = self.sfp_map(x) self.port_to_eeprom_mapping[x] = eeprom_path.format(bus) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' for x in range(self._port_start, self._port_end + 1): port_eeprom_path = eeprom_path.format(self._port_to_i2c_mapping[x]) self._port_to_eeprom_mapping[x] = port_eeprom_path self.init_global_port_presence() SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' for x in range(self._port_start, self._port_end + 1): port_eeprom_path = eeprom_path.format(self._port_to_i2c_mapping[x]) self._port_to_eeprom_mapping[x] = port_eeprom_path self._present_status[x] = SFP_STATUS_REMOVED SfpUtilBase.__init__(self)
def __init__(self): # Override port_to_eeprom_mapping for class initialization eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(x + self.EEPROM_OFFSET) self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/kernel/sfp/eeprom_sfp_{0}" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format( x + self.EEPROM_OFFSET) self.modprs_register = self.get_transceiver_status SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = self.BASE_VAL_PATH + "sfp_eeprom" for x in range(0, self.port_end + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format( self._port_to_i2c_mapping[x][0], self._port_to_i2c_mapping[x][1]) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = self.BASE_OOM_PATH + "eeprom1" for x in range(0, self.port_end + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format( self._port_to_i2c_mapping[x][1]) self._transceiver_presence = self._get_sfp_presence() SfpUtilBase.__init__(self)
def __init__(self): # Override port_to_eeprom_mapping for class initialization eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-00{1}/eeprom" for x in range(self.port_start, self.port_end + 1): phy_port = self.fp2phy_port_num(x) port_eeprom_path = eeprom_path.format(phy_port + self.EEPROM_OFFSET, self.EEPROM_I2C_ADDR) self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "{}/eeprom" path_list = self.get_sfp_path() for port_n in range(self._port_start, self._port_end + 1): port_eeprom_path = eeprom_path.format(path_list[port_n]) self._port_to_eeprom_mapping[port_n] = port_eeprom_path self.init_global_port_presence() SfpUtilBase.__init__(self)
def __init__(self): # Override port_to_eeprom_mapping for class initialization eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for x in range(self.port_start, self.port_end + 1): phy_port = self._logic_to_phy_port_mapping[x] port_eeprom_path = eeprom_path.format(phy_port + self.EEPROM_OFFSET) self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = self.BASE_OOM_PATH + "eeprom" for x in range(0, self.port_end+1): bus = self.sfp_map(x) self.port_to_eeprom_mapping[x] = eeprom_path.format( bus) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = self.BASE_OOM_PATH + "eeprom" for x in range(0, self.port_end+1): self.port_to_eeprom_mapping[x] = eeprom_path.format( self._port_to_i2c_mapping[x][1] ) SfpUtilBase.__init__(self)
def __init__(self): for x in range(self.first_port, self.last_port + 1): cpld_index = (x / 16) + 1 index = (x % 16) + 1 if cpld_index == 5: path = self.eeprom_path_1 else: path = self.eeprom_path self.port_to_eeprom[x] = path.format(self.port_to_i2cbus_mapping[cpld_index], index) SfpUtilBase.__init__(self)
def __init__(self): # Override port_to_eeprom_mapping for class initialization eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' for x in range(self.PORT_START, self.PORT_END + 1): if self.port_start == 1: self.port_to_eeprom_mapping[x] = eeprom_path.format((x - 1) + 26) else: self.port_to_eeprom_mapping[x] = eeprom_path.format(x + 26) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) # Get Transceiver status self.modprs_register = self.get_transceiver_status SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for x in range(0, self.port_end + 1): port_num = x + 2 self.port_to_eeprom_mapping[x] = eeprom_path.format( port_num) port_num = 0 self.init_global_port_presence() SfpUtilBase.__init__(self)
def __init__(self): sfp_eeprom_path = '/sys/bus/i2c/devices/{0[0]}-0050/sfp{0[1]}' qsfp_eeprom_path = '/sys/bus/i2c/devices/{0[0]}-0050/qsfp{0[1]}' for x in range(self.port_start, self.qsfp_port_start): port_eeprom_path = sfp_eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path for x in range(self.qsfp_port_start, self.port_end + 1): port_eeprom_path = qsfp_eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): 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] self.EEPROM_OFFSET = port_position_tuple[4] for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = self.qsfp_sysfs_path + "qsfp{}".format(x + self.EEPROM_OFFSET) SfpUtilBase.__init__(self)
def __init__(self): # Update abs, lpmode, and reset gpio base self.set_gpio_offset() self.update_gpio_base() # Override port_to_eeprom_mapping for class initialization eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(x + self.EEPROM_OFFSET) self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): # Init abs, lpmode, and reset to gpio mapping self.set_gpio_offset() self.init_abs_to_gpio_mapping() self.init_lpmode_to_gpio_mapping() self.init_reset_to_gpio_mapping() # Override port_to_eeprom_mapping for class initialization eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = self.BASE_I2C_PATH for x in range(0, self.port_end+1): self.port_to_eeprom_mapping[x] = eeprom_path.format( self._port_to_i2c_mapping[x][1] ) if(x < 9): if(self.get_presence(x)==1): self.port_to_eeprom_mapping[x] = self.BASE_I2C_PATH + "0-000" +str(x+1) + "/eeprom" else: if(self.get_presence(x)==1): self.port_to_eeprom_mapping[x] = self.BASE_I2C_PATH + "0-00" +str(x+1)+ "/eeprom" SfpUtilBase.__init__(self)
def __init__(self): """[ctlid, slavedevid]""" self.fiber_mapping = [(0, 0)] # res self.fiber_mapping.extend([(1, 7), (1, 6), (1, 5), (1, 4), (1, 3), (1, 2), (1, 1), (1, 0)]) # panel port 1~8 self.fiber_mapping.extend([(1, 15), (1, 14), (1, 13), (1, 12), (1, 11), (1, 10), (1, 9), (1, 8)]) # panel port 9~16 self.fiber_mapping.extend([(1, 19), (1, 17), (1, 16), (1, 18), (0, 7), (0, 6), (0, 5), (0, 4)]) # panel port 17~24 self.fiber_mapping.extend([(0, 3), (0, 2), (0, 1), (0, 0), (0, 15), (0, 14), (0, 13), (0, 12)]) # panel port 25~32 self.fiber_mapping.extend([(0, 11), (0, 10), (0, 9), (0, 8), (0, 23), (0, 22), (0, 21), (0, 20)]) # panel port 33~40 self.fiber_mapping.extend([(0, 19), (0, 18), (0, 17), (0, 16), (0, 31), (0, 26), (0, 29), (0, 27)]) # panel port 41~48 self.fiber_mapping.extend([(0, 24), (0, 25), (1, 23), (1, 22), (1, 21), (1, 20)]) # panel port 49~54 self.udpClient = socket(AF_INET, SOCK_DGRAM) self.eeprom_mapping = {} self.f_sfp_present = "/sys/class/sfp/sfp{}/sfp_presence" self.f_sfp_enable = "/sys/class/sfp/sfp{}/sfp_enable" for x in range(1, self.port_end + 1): self.eeprom_mapping[x] = "/var/cache/sonic/sfp/sfp{}_eeprom".format(x) try: if not os.path.exists("/var/cache/sonic/sfp"): os.makedirs("/var/cache/sonic/sfp", 0777) for x in range(1, self.port_end + 1): if not self.get_presence(x): if os.path.exists(self.eeprom_mapping[x]): os.remove(self.eeprom_mapping[x]) continue data = self.get_eeprom_data(x) if data: with open(self.eeprom_mapping[x], 'w') as sfp_eeprom: sfp_eeprom.write(data) else: DBG_PRINT("get sfp{} eeprom data failed.".format(x)) break except IOError as e: DBG_PRINT(str(e)) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/i2c-{1}/{1}-0050/eeprom" global port_to_eeprom_path for port_num in range(0, self.port_end + 1): if port_num >= self.iom1_port_start and port_num <=\ self.iom1_port_end: assigned = 0 # i2c-6 for x in range(1, 5): port_to_eeprom_path = eeprom_path.format( self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) if (os.path.isfile(port_to_eeprom_path)): self.port_to_eeprom_mapping[port_num] =\ port_to_eeprom_path assigned = 1 elif (not assigned): self.port_to_eeprom_mapping[port_num] =\ "No IOM" elif(port_num >= self.iom2_port_start and port_num <= self.iom2_port_end): assigned = 0 # i2c-8 for x in range(1, 5): port_to_eeprom_path = eeprom_path.format( self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) if (os.path.isfile(port_to_eeprom_path)): self.port_to_eeprom_mapping[port_num] =\ port_to_eeprom_path assigned = 1 elif (not assigned): self.port_to_eeprom_mapping[port_num] =\ "No IOM" elif(port_num >= self.iom3_port_start and port_num <= self.iom3_port_end): assigned = 0 # i2c-7 for x in range(1, 5): port_to_eeprom_path = eeprom_path.format( self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) if (os.path.isfile(port_to_eeprom_path)): self.port_to_eeprom_mapping[port_num] =\ port_to_eeprom_path assigned = 1 elif (not assigned): self.port_to_eeprom_mapping[port_num] =\ "No IOM" elif(port_num >= self.iom4_port_start and port_num <= self.iom4_port_end): assigned = 0 # i2c-9 for x in range(1, 5): port_to_eeprom_path = eeprom_path.format( self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) if (os.path.isfile(port_to_eeprom_path)): self.port_to_eeprom_mapping[port_num] =\ port_to_eeprom_path assigned = 1 elif (not assigned): self.port_to_eeprom_mapping[port_num] =\ "No IOM" self.oir_fd = open(self.OIR_FD_PATH, "r") self.epoll = select.epoll() if self.oir_fd != -1: self.epoll.register(self.oir_fd.fileno(), select.EPOLLIN) SfpUtilBase.__init__(self)
def __init__(self): eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/i2c-{1}/{1}-0050/eeprom" global port_to_eeprom_path for port_num in range(0, self.port_end + 1): if port_num >= self.iom1_port_start and port_num <=\ self.iom1_port_end: assigned = 0 # i2c-6 for x in range(1, 5): port_to_eeprom_path = eeprom_path.format( self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) if (os.path.isfile(port_to_eeprom_path)): self.port_to_eeprom_mapping[port_num] =\ port_to_eeprom_path assigned = 1 elif (not assigned): self.port_to_eeprom_mapping[port_num] =\ "No IOM" elif(port_num >= self.iom2_port_start and port_num <= self.iom2_port_end): assigned = 0 # i2c-8 for x in range(1, 5): port_to_eeprom_path = eeprom_path.format( self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) if (os.path.isfile(port_to_eeprom_path)): self.port_to_eeprom_mapping[port_num] =\ port_to_eeprom_path assigned = 1 elif (not assigned): self.port_to_eeprom_mapping[port_num] =\ "No IOM" elif(port_num >= self.iom3_port_start and port_num <= self.iom3_port_end): assigned = 0 # i2c-7 for x in range(1, 5): port_to_eeprom_path = eeprom_path.format( self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) if (os.path.isfile(port_to_eeprom_path)): self.port_to_eeprom_mapping[port_num] =\ port_to_eeprom_path assigned = 1 elif (not assigned): self.port_to_eeprom_mapping[port_num] =\ "No IOM" elif(port_num >= self.iom4_port_start and port_num <= self.iom4_port_end): assigned = 0 # i2c-9 for x in range(1, 5): port_to_eeprom_path = eeprom_path.format( self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) if (os.path.isfile(port_to_eeprom_path)): self.port_to_eeprom_mapping[port_num] =\ port_to_eeprom_path assigned = 1 elif (not assigned): self.port_to_eeprom_mapping[port_num] =\ "No IOM" SfpUtilBase.__init__(self)
def __init__(self): SfpUtilBase.__init__(self)