def set_sde_env(): print("Setting environment for BF_SDE.") sde_home_absolute = get_sde_home_absolute() if validate_path_existence(sde_home_absolute, 'SDE'): set_env_var(constants.sde_env_var_name, sde_home_absolute) set_env_var(constants.sde_install_env_var_name, get_env_var(constants.sde_env_var_name) + '/install') print('Environment variables set: \n SDE: {0} \n SDE_INSTALL: {1}'. format(get_env_var(constants.sde_env_var_name), get_env_var(constants.sde_install_env_var_name))) return True return False
def do_basic_path_validation(profile_name): # Do basic path verification. print('Selected build profile is {}.'.format(profile_name)) print('Switch model : {}'.format(get_switch_model_from_settings())) validate_path_existence(get_sde_pkg_abs_path(), 'Barefoot SDE') if not is_sim_profile_selected(): validate_path_existence(get_bsp_pkg_abs_path(), 'BSP') if get_selected_profile_name() in [constants.stratum_sim_profile_name, constants.stratum_hw_profile_name]: validate_path_existence(get_stratum_home_absolute(),'Stratum')
def set_sde_env(): print("Setting environment for BF_SDE.") sde_home_absolute = get_sde_home_absolute() if validate_path_existence(sde_home_absolute, 'SDE'): set_env_var(constants.sde_env_var_name, sde_home_absolute) set_env_var(constants.sde_install_env_var_name, get_env_var(constants.sde_env_var_name) + '/install/') append_to_env_var( constants.path_env_var_name, get_env_var(constants.sde_install_env_var_name) + '/bin/') print( 'Environment variables set: \n SDE: {0} \n SDE_INSTALL: {1} \n PATH: {2}' .format(get_env_var(constants.sde_env_var_name), get_env_var(constants.sde_install_env_var_name), get_env_var(constants.path_env_var_name))) return True else: print('ERROR: SDE directory couldnt be found, exiting .') exit(0)
def set_sde_env(): print("Setting environment for BF_SDE.") sde_home_absolute = get_sde_home_absolute() if validate_path_existence(sde_home_absolute, 'SDE'): set_env_var(constants.sde_env_var_name, sde_home_absolute) set_env_var(constants.sde_install_env_var_name, get_env_var(constants.sde_env_var_name) + '/install') print('Environment variables set: \n SDE: {0} \n SDE_INSTALL: {1}'. format(get_env_var(constants.sde_env_var_name), get_env_var(constants.sde_install_env_var_name))) else: print('ERROR: SDE directory couldnt be found, exiting .') exit(0) if get_sde_profile_name() == constants.sde_hw_profile_name: print('Loading kernel modules.') if not load_and_verify_kernel_modules(): print("ERROR:Some kernel modules are not loaded.") exit(0) else: print('Running simulation, No need to load kernel modules.') return True
from bf_sde import load_bf_sde_profile from common import read_settings, get_selected_profile_name, \ get_sde_pkg_abs_path, get_bsp_pkg_abs_path, \ is_sim_profile_selected, get_switch_model_from_settings, \ validate_path_existence from sal import load_sal_profile from stratum import load_stratum_profile, get_stratum_home_absolute if __name__ == '__main__': read_settings() profile_name = get_selected_profile_name() # Do basic path verification. print('Selected build profile is {}.'.format(profile_name)) print('Switch model : {}'.format(get_switch_model_from_settings())) validate_path_existence(get_sde_pkg_abs_path(), 'Barefoot SDE') if not is_sim_profile_selected(): validate_path_existence(get_bsp_pkg_abs_path(), 'BSP') if get_selected_profile_name() in [ constants.stratum_sim_profile_name, constants.stratum_hw_profile_name ]: validate_path_existence(get_stratum_home_absolute(), 'Stratum') if profile_name in ['stratum_hw_profile', 'stratum_sim_profile']: load_stratum_profile() elif profile_name == 'sde_sim_profile' or profile_name == 'sde_hw_profile': load_bf_sde_profile() else: load_sal_profile()