def load_and_verify_kernel_modules(): output = execute_cmd('lsmod') bf_kdrv = True i2c_i801 = True os.system("sudo modprobe -q i2c-i801") os.system("sudo modprobe -q i2c-dev") if 'bf_kdrv' not in output: load_bf_kdrv() output = execute_cmd('lsmod') if 'i2c_i801' not in output and is_ubuntu(): # Ubuntu check is there because i2c_i801 appears only in output of lsmod in Ubuntu i2c_i801 = False print('ERROR:i2c_i801 is not loaded.') if 'bf_kdrv' not in output: bf_kdrv = False print("ERROR:bf_kdrv is not loaded.") # Load switch specific kernel modules if get_switch_model_from_settings() == constants.bf2556x_1t: return bf_kdrv and i2c_i801 and load_and_verify_kernel_modules_bf2556() else: return bf_kdrv and i2c_i801 and load_and_verify_kernel_modules_bf6064()
def load_and_verify_kernel_modules(): output = execute_cmd_n_get_output('lsmod') bf_mod = True i2c_i801 = True os.system("sudo modprobe -q i2c-i801") os.system("sudo modprobe -q i2c-dev") sde_module_names = get_sde_modules() if sde_module_names is not None: for module_name in sde_module_names: if module_name == sde_module_bf_kdrv_string_value: if module_name not in output: load_bf_kdrv() else: print('Module {} already loaded'.format(module_name)) elif module_name == sde_module_bf_kpkt_string_value: if module_name not in output: load_bf_kpkt() else: print('Module {} already loaded'.format(module_name)) else: print('Invalid module to load - {}.'.format(module_name)) exit(0) else: print('Select at-least one SDE module to load in settings.xml') exit(0) output = execute_cmd_n_get_output('lsmod') if 'i2c_i801' not in output and is_ubuntu(): # Ubuntu check is there because i2c_i801 appears only in output of # lsmod in Ubuntu i2c_i801 = False print('ERROR:i2c_i801 is not loaded.') if not any(mod in output for mod in [sde_module_bf_kdrv_string_value, sde_module_bf_kpkt_string_value]): bf_mod = False print("ERROR: Neither of {0}/{1} module loaded.". format(sde_module_bf_kdrv_string_value, sde_module_bf_kpkt_string_value)) # Load switch specific kernel modules if get_switch_model() == constants.bf2556x_1t: return bf_mod and i2c_i801 and load_and_verify_kernel_modules_bf2556() else: return bf_mod and i2c_i801 and load_and_verify_kernel_modules_bf6064()
def load_and_verify_kernel_modules(): output = get_cmd_output('lsmod') irq_debug = True bf_kdrv = True mv_pipe = True i2c_i801 = True os.system("sudo modprobe -q i2c-i801") os.system("sudo modprobe -q i2c-dev") if 'irq_debug' not in output: install_irq_debug() if 'bf_kdrv' not in output: load_bf_kdrv() if not os.path.exists("/delta/mv_pipe_config"): install_mv_pipe() loaded_modules = subprocess.run(['lsmod'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output = loaded_modules.stdout.decode('UTF-8') if 'i2c_i801' not in output and is_ubuntu(): # Ubuntu check is there because i2c_i801 appears only in output of lsmod in Ubuntu i2c_i801 = False print('ERROR:i2c_i801 is not loaded.') if 'irq_debug' not in output: irq_debug = False print("ERROR:irq_debug is not loaded.") if 'bf_kdrv' not in output: irq_debug = False print("ERROR:bf_kdrv is not loaded.") if not os.path.exists("/delta/mv_pipe_config"): mv_pipe = False print("ERROR:mv_pipe_config not installed.") return irq_debug and bf_kdrv and mv_pipe and i2c_i801