18

    log_manager.GetInstance().CoutLog('end to run run_hcl_conf_modify.py',Com_foreground_interface);
    return  oErrorBase.base_succeed;


#启动hcl工程并启动设备
def StartHclProject(bTest = False):
    if (bTest):
        return oErrorBase.base_succeed;
    iResult = oErrorBase.base_succeed;
    iResult = hcl_manager.GetInstance().CopyHclFileToHclServer(param_tool.GetInstance().param_hcl.m_list_hcl_param);
    if (oErrorBase.base_succeed != iResult):
        log_manager.GetInstance().CoutLog('copy hcl fail',Com_foreground_interface);
        return iResult;
    for elem in param_tool.GetInstance().param_hcl.m_list_hcl_param:
        iResult = hcl_manager.GetInstance().CopyDesConfigFileToHclServer(dir.des_config_file_dir,dir.hcl_server_config_file_dir,elem.m_str_ip);
        if (oErrorBase.base_succeed != iResult):
            log_manager.GetInstance().CoutLog('copy config file failed',Com_foreground_interface);
            return iResult;
    for elem in param_tool.GetInstance().param_hcl.m_list_hcl_param:
        iResult = (hcl_manager.GetInstance().OpenPipe(elem.m_str_ip,elem.m_str_pipe_name));
        if (oErrorBase.base_succeed != iResult):
            return iResult;
        iResult =  hcl_manager.GetInstance().OpenHclProject(elem.m_str_hcl_project_dir_file,ReadParamFromXml('OpenHclProject'));
        if (oErrorBase.base_succeed != iResult):
            return iResult;
        time.sleep(10);
        list_simu_cfg_file = os.listdir(dir.src_config_file_dir);
        t_dict_dev_cfg = {};
        for elem in list_simu_cfg_file:
            match = re.search("(\d+\.\d+\.\d+\.\d+).cfg", elem);
            if match:
                ipaddr = match.group(1);
                t_dict_dev_cfg[ipaddr] = 'C:\\des_config_file\\' + 'new_' + ipaddr + '.cfg';
        hcl_manager.GetInstance().StartSimuDevWithCfg(t_dict_dev_cfg,ReadParamFromXml('StartSimuDevWithCfg'));
        hcl_manager.GetInstance().ClosePipe();
    return oErrorBase.base_succeed;


#配置同步
def Label_Sync(bTest = False):
    if (bTest):
        return oErrorBase.base_succeed;
    #设备标签同步
    iResult = oErrorBase.base_succeed;
    log_manager.GetInstance().CoutLog('begin to run run_dev_label_update.py',Com_foreground_interface);
    dev_label_manager.GetInstance().SetDBInfo(param_tool.GetInstance().param_db_simulation.m_str_db_ip,param_tool.GetInstance().param_db_simulation.m_str_db_user,param_tool.GetInstance().param_db_simulation.m_str_db_pw);
    dev_label_manager.GetInstance().SetRestInfo(param_tool.GetInstance().param_rest_simulation.m_str_imc_user,param_tool.GetInstance().param_rest_simulation.m_str_imc_pw,param_tool.GetInstance().param_rest_simulation.m_str_imc_url);
    iResult = dev_label_manager.GetInstance().LoadDevLabelFromFile(dir.output_config_file_dir + 'dev_label.cfg');
    if (oErrorBase.base_succeed != iResult):
        log_manager.GetInstance().CoutLog('Label_Sync:LoadDevLabelFromFile failed',Com_foreground_interface);
        return iResult;
    iResult = dev_label_manager.GetInstance().UpdateLabelInDB();
    if (oErrorBase.base_succeed != iResult):
        log_manager.GetInstance().CoutLog('Label_Sync:UpdateLabelInDB failed',Com_foreground_interface);
        return iResult;
    log_manager.GetInstance().CoutLog('end to run run_dev_label_update.py',Com_foreground_interface);
    return iResult;


def If_Status_Sync(bTest = False):
    if (bTest):
        return oErrorBase.base_succeed;
    #接口状态同步
    log_manager.GetInstance().CoutLog('begin to run run_if_status_update.py',Com_foreground_interface);
    iResult = oErrorBase.base_succeed;
    iResult = if_status_manager.GetInstance().GetIfInfoByTopo(param_tool.GetInstance().param_db_real.m_str_db_ip,param_tool.GetInstance().param_db_real.m_str_db_user,param_tool.GetInstance().param_db_real.m_str_db_pw,param_tool.GetInstance().param_db_real.m_str_db_topo_name,False);
    if (oErrorBase.base_succeed != iResult):
        log_manager.GetInstance().CoutLog('If_Status_Sync:If_Status_Sync:GetIfInfoByTopo failed',Com_foreground_interface);
        return iResult;
    iResult = if_status_manager.GetInstance().SaveIfStatusInfile();
    if (oErrorBase.base_succeed != iResult):
        log_manager.GetInstance().CoutLog('If_Status_Sync:If_Status_Sync:SaveIfStatusInfile failed',Com_foreground_interface);
        return iResult;
    if_status_manager.GetInstance().SetDesIMCRestInfo(param_tool.GetInstance().param_rest_simulation.m_str_imc_user,param_tool.GetInstance().param_rest_simulation.m_str_imc_pw,param_tool.GetInstance().param_rest_simulation.m_str_imc_url);
    iResult = if_status_manager.GetInstance().LoadNewIfStatusFromFile(param_tool.GetInstance().param_db_simulation.m_str_db_ip,param_tool.GetInstance().param_db_simulation.m_str_db_user,param_tool.GetInstance().param_db_simulation.m_str_db_pw);
    if (oErrorBase.base_succeed != iResult):
        log_manager.GetInstance().CoutLog('If_Status_Sync:LoadNewIfStatusFromFile failed',Com_foreground_interface);
        return iResult;
    iResult = if_status_manager.GetInstance().GetIfInfoByTopoF(param_tool.GetInstance().param_db_simulation.m_str_db_ip,param_tool.GetInstance().param_db_simulation.m_str_db_user,param_tool.GetInstance().param_db_simulation.m_str_db_pw,param_tool.GetInstance().param_db_simulation.m_str_db_topo_name,True);
    if (oErrorBase.base_succeed != iResult):
        log_manager.GetInstance().CoutLog('If_Status_Sync:GetIfInfoByTopoF failed',Com_foreground_interface);
        return iResult;
    iResult = if_status_manager.GetInstance().UpdateIfStatus(param_tool.GetInstance().param_db_simulation.m_str_db_ip,param_tool.GetInstance().param_db_simulation.m_str_db_user,param_tool.GetInstance().param_db_simulation.m_str_db_pw);
    if (oErrorBase.base_succeed != iResult):
        log_manager.GetInstance().CoutLog('If_Status_Sync:UpdateIfStatus failed',Com_foreground_interface);
        return iResult;
    log_manager.GetInstance().CoutLog('end to run run_if_status_update.py',Com_foreground_interface);
    return oErrorBase.base_succeed;


def If_Speed_Sync(bTest = False):
    if (bTest):
        return oErrorBase.base_succeed;
    #接口速率同步
    log_manager.GetInstance().CoutLog('begin to run run_if_speed_update.py',Com_foreground_interface);
    iResult = dev_sync_manager.GetInstance().InitDevInfo(param_tool.GetInstance().param_db_real.m_str_db_ip,param_tool.GetInstance().param_db_real.m_str_db_user,param_tool.GetInstance().param_db_real.m_str_db_pw,param_tool.GetInstance().param_db_real.m_str_db_topo_name,'real');
    if (oErrorBase.base_succeed != iResult):
        log_manager.GetInstance().CoutLog('If_Speed_Sync:InitRealDevInfo failed',Com_foreground_interface);
        return iResult;
    iResult = dev_sync_manager.GetInstance().InitDevInfo(param_tool.GetInstance().param_db_simulation.m_str_db_ip,param_tool.GetInstance().param_db_simulation.m_str_db_user,param_tool.GetInstance().param_db_simulation.m_str_db_pw,param_tool.GetInstance().param_db_simulation.m_str_db_topo_name,'simu');
    if (oErrorBase.base_succeed != iResult):
        log_manager.GetInstance().CoutLog('If_Speed_Sync:InitSimuDevInfo failed',Com_foreground_interface);
        return iResult;

没有更多推荐了,返回首页